diff options
author | Clément Bœsch <ubitux@gmail.com> | 2013-05-09 01:04:41 +0200 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2013-05-12 13:07:47 +0200 |
commit | 1776177b7f1ae67ad3b42d99464b141ee4082310 (patch) | |
tree | 1044d44ef5459e4706b639eea2923472420dcbd7 /libavfilter/vf_overlay.c | |
parent | 60f0e304312d0fe1d26f7344cb86dc4cdab52b15 (diff) |
lavfi: replace passthrough_filter_frame with a flag.
With the introduction of AVFilterContext->is_disabled, we can simplify
the custom passthrough mode in filters.
This commit is technically a small compat break, but the timeline was
introduced very recently.
Doxy by Stefano Sabatini.
Diffstat (limited to 'libavfilter/vf_overlay.c')
-rw-r--r-- | libavfilter/vf_overlay.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 6494bada3c..ec58dc4b66 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -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, }; |