|
|
|
@@ -88,7 +88,6 @@ enum var_name { |
|
|
|
typedef struct { |
|
|
|
const AVClass *class; |
|
|
|
int x, y; ///< position of overlayed picture |
|
|
|
int enable; ///< tells if blending is enabled |
|
|
|
|
|
|
|
int allow_packed_rgb; |
|
|
|
uint8_t frame_requested; |
|
|
|
@@ -597,7 +596,7 @@ static int try_filter_frame(AVFilterContext *ctx, AVFrame *mainpic) |
|
|
|
over->var_values[VAR_X], over->x, |
|
|
|
over->var_values[VAR_Y], over->y); |
|
|
|
} |
|
|
|
if (over->enable) |
|
|
|
if (!ctx->is_disabled) |
|
|
|
blend_image(ctx, mainpic, over->overpicref, over->x, over->y); |
|
|
|
|
|
|
|
} |
|
|
|
@@ -663,20 +662,6 @@ static int filter_frame_over(AVFilterLink *inlink, AVFrame *inpicref) |
|
|
|
return ret == AVERROR(EAGAIN) ? 0 : ret; |
|
|
|
} |
|
|
|
|
|
|
|
#define DEF_FILTER_FRAME(name, mode, enable_value) \ |
|
|
|
static int filter_frame_##name##_##mode(AVFilterLink *inlink, AVFrame *frame) \ |
|
|
|
{ \ |
|
|
|
AVFilterContext *ctx = inlink->dst; \ |
|
|
|
OverlayContext *over = ctx->priv; \ |
|
|
|
over->enable = enable_value; \ |
|
|
|
return filter_frame_##name(inlink, frame); \ |
|
|
|
} |
|
|
|
|
|
|
|
DEF_FILTER_FRAME(main, enabled, 1); |
|
|
|
DEF_FILTER_FRAME(main, disabled, 0); |
|
|
|
DEF_FILTER_FRAME(over, enabled, 1); |
|
|
|
DEF_FILTER_FRAME(over, disabled, 0); |
|
|
|
|
|
|
|
static int request_frame(AVFilterLink *outlink) |
|
|
|
{ |
|
|
|
AVFilterContext *ctx = outlink->src; |
|
|
|
@@ -734,16 +719,14 @@ static const AVFilterPad avfilter_vf_overlay_inputs[] = { |
|
|
|
.type = AVMEDIA_TYPE_VIDEO, |
|
|
|
.get_video_buffer = ff_null_get_video_buffer, |
|
|
|
.config_props = config_input_main, |
|
|
|
.filter_frame = filter_frame_main_enabled, |
|
|
|
.passthrough_filter_frame = filter_frame_main_disabled, |
|
|
|
.filter_frame = filter_frame_main, |
|
|
|
.needs_writable = 1, |
|
|
|
}, |
|
|
|
{ |
|
|
|
.name = "overlay", |
|
|
|
.type = AVMEDIA_TYPE_VIDEO, |
|
|
|
.config_props = config_input_overlay, |
|
|
|
.filter_frame = filter_frame_over_enabled, |
|
|
|
.passthrough_filter_frame = filter_frame_over_disabled, |
|
|
|
.filter_frame = filter_frame_over, |
|
|
|
}, |
|
|
|
{ NULL } |
|
|
|
}; |
|
|
|
@@ -773,5 +756,5 @@ AVFilter avfilter_vf_overlay = { |
|
|
|
|
|
|
|
.inputs = avfilter_vf_overlay_inputs, |
|
|
|
.outputs = avfilter_vf_overlay_outputs, |
|
|
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE, |
|
|
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, |
|
|
|
}; |