diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-02-02 18:52:03 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-02-02 18:52:03 +0100 |
commit | 9e0e8e10c7b496fdc73d6f2da053313c0f105ae3 (patch) | |
tree | 1187107a6b954d9deab9d11abdeac5dbaa34ec77 /libavfilter/vf_mix.c | |
parent | 6dc06e979c3867d5805d4e7418d86e25bdd4809f (diff) | |
download | ffmpeg-9e0e8e10c7b496fdc73d6f2da053313c0f105ae3.tar.gz |
avfilter/vf_mix: add timeline support to tmix filter
Diffstat (limited to 'libavfilter/vf_mix.c')
-rw-r--r-- | libavfilter/vf_mix.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libavfilter/vf_mix.c b/libavfilter/vf_mix.c index f84b9bd974..79b3733145 100644 --- a/libavfilter/vf_mix.c +++ b/libavfilter/vf_mix.c @@ -348,6 +348,9 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in) ThreadData td; AVFrame *out; + if (s->nb_inputs == 1) + return ff_filter_frame(outlink, in); + if (s->nb_frames < s->nb_inputs) { s->frames[s->nb_frames] = in; s->nb_frames++; @@ -358,6 +361,13 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in) s->frames[s->nb_inputs - 1] = in; } + if (ctx->is_disabled) { + out = av_frame_clone(s->frames[0]); + if (!out) + return AVERROR(ENOMEM); + return ff_filter_frame(outlink, out); + } + out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) return AVERROR(ENOMEM); @@ -371,7 +381,7 @@ static int tmix_filter_frame(AVFilterLink *inlink, AVFrame *in) } static const AVOption tmix_options[] = { - { "frames", "set number of successive frames to mix", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=3}, 2, 128, .flags = FLAGS }, + { "frames", "set number of successive frames to mix", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=3}, 1, 128, .flags = FLAGS }, { "weights", "set weight for each frame", OFFSET(weights_str), AV_OPT_TYPE_STRING, {.str="1 1 1"}, 0, 0, .flags = FLAGS }, { "scale", "set scale", OFFSET(scale), AV_OPT_TYPE_FLOAT, {.dbl=0}, 0, INT16_MAX, .flags = FLAGS }, { NULL }, @@ -398,7 +408,7 @@ AVFilter ff_vf_tmix = { .inputs = inputs, .init = init, .uninit = uninit, - .flags = AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, }; #endif /* CONFIG_TMIX_FILTER */ |