[FFmpeg-cvslog] avfilter/vf_stack: make it possible to stop with shortest stream

Paul B Mahol git at videolan.org
Thu Nov 26 10:13:06 CET 2015


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Nov 26 09:56:43 2015 +0100| [a33043023848495a7474fefb11c2ec2e69d47916] | committer: Paul B Mahol

avfilter/vf_stack: make it possible to stop with shortest stream

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 doc/filters.texi       |    8 ++++++++
 libavfilter/vf_stack.c |    4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index daa1b38..a7f8a53 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7154,6 +7154,10 @@ The filter accept the following option:
 @table @option
 @item inputs
 Set number of input streams. Default is 2.
+
+ at item shortest
+If set to 1, force the output to terminate when the shortest input
+terminates. Default value is 0.
 @end table
 
 @section hue
@@ -11598,6 +11602,10 @@ The filter accept the following option:
 @table @option
 @item inputs
 Set number of input streams. Default is 2.
+
+ at item shortest
+If set to 1, force the output to terminate when the shortest input
+terminates. Default value is 0.
 @end table
 
 @section w3fdif
diff --git a/libavfilter/vf_stack.c b/libavfilter/vf_stack.c
index c4bbd61..2fe3712 100644
--- a/libavfilter/vf_stack.c
+++ b/libavfilter/vf_stack.c
@@ -33,6 +33,7 @@ typedef struct StackContext {
     const AVClass *class;
     const AVPixFmtDescriptor *desc;
     int nb_inputs;
+    int shortest;
     int is_vertical;
     int nb_planes;
 
@@ -199,7 +200,7 @@ static int config_output(AVFilterLink *outlink)
         in[i].time_base = inlink->time_base;
         in[i].sync   = 1;
         in[i].before = EXT_STOP;
-        in[i].after  = EXT_INFINITY;
+        in[i].after  = s->shortest ? EXT_STOP : EXT_INFINITY;
     }
 
     return ff_framesync_configure(&s->fs);
@@ -222,6 +223,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
 static const AVOption stack_options[] = {
     { "inputs", "set number of inputs", OFFSET(nb_inputs), AV_OPT_TYPE_INT, {.i64=2}, 2, INT_MAX, .flags = FLAGS },
+    { "shortest", "force termination when the shortest input terminates", OFFSET(shortest), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS },
     { NULL },
 };
 



More information about the ffmpeg-cvslog mailing list