ffmpeg | branch: master | Paul B Mahol <one...@gmail.com> | Sat Feb  2 18:52:03 
2019 +0100| [9e0e8e10c7b496fdc73d6f2da053313c0f105ae3] | committer: Paul B Mahol

avfilter/vf_mix: add timeline support to tmix filter

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e0e8e10c7b496fdc73d6f2da053313c0f105ae3
---

 libavfilter/vf_mix.c | 14 ++++++++++++--
 1 file 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 */

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to