[FFmpeg-devel] [PATCH] ffmpeg_opt: allow the user to ignore unused stream maps

Rodger Combs rodger.combs at gmail.com
Tue Jun 30 22:13:12 CEST 2015


---
 ffmpeg_opt.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index a746405..11511d3 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -114,6 +114,7 @@ static int override_ffserver  = 0;
 static int input_stream_potentially_available = 0;
 static int ignore_unknown_streams = 0;
 static int copy_unknown_streams = 0;
+static int allow_unused_maps = 0;
 
 static void uninit_options(OptionsContext *o)
 {
@@ -312,8 +313,13 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
     }
 
     if (!m) {
-        av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n", arg);
-        exit_program(1);
+        if (allow_unused_maps) {
+            av_log(NULL, AV_LOG_VERBOSE, "Stream map '%s' matches no streams; ignoring.\n", arg);
+        } else {
+            av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n"
+                                       "To ignore this, please use -allow_unused_maps.\n", arg);
+            exit_program(1);
+        }
     }
 
     av_freep(&map);
@@ -2904,6 +2910,8 @@ const OptionDef options[] = {
         "Ignore unknown stream types" },
     { "copy_unknown",   OPT_BOOL | OPT_EXPERT,                       {              &copy_unknown_streams },
         "Copy unknown stream types" },
+    { "allow_unused_maps", OPT_BOOL | OPT_EXPERT,                    {              &allow_unused_maps },
+        "Allow stream maps that don't match anything" },
     { "c",              HAS_ARG | OPT_STRING | OPT_SPEC |
                         OPT_INPUT | OPT_OUTPUT,                      { .off       = OFFSET(codec_names) },
         "codec name", "codec" },
-- 
2.4.1



More information about the ffmpeg-devel mailing list