summaryrefslogtreecommitdiffstats
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorRodger Combs <rodger.combs@gmail.com>2015-07-01 14:14:26 -0500
committerMichael Niedermayer <michaelni@gmx.at>2015-07-06 15:40:13 +0200
commit2375a85c36c4941042e6ee58a31d6560bde91d37 (patch)
tree5188ba01ad33dc6bd65ad1f6fcedece8a5e316f8 /ffmpeg_opt.c
parent8234f0e3b485811d60c228c40a94a141c46e61ca (diff)
downloadffmpeg-streaming-2375a85c36c4941042e6ee58a31d6560bde91d37.zip
ffmpeg-streaming-2375a85c36c4941042e6ee58a31d6560bde91d37.tar.gz
ffmpeg_opt: allow the user to ignore unused stream maps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 048c3df..a356cad 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -231,6 +231,7 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
int sync_file_idx = -1, sync_stream_idx = 0;
char *p, *sync;
char *map;
+ char *allow_unused;
if (*arg == '-') {
negative = 1;
@@ -275,6 +276,8 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
exit_program(1);
}
} else {
+ if (allow_unused = strchr(map, '?'))
+ *allow_unused = 0;
file_idx = strtol(map, &p, 0);
if (file_idx >= nb_input_files || file_idx < 0) {
av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx);
@@ -312,8 +315,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) {
+ 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, add a trailing '?' to the map.\n", arg);
+ exit_program(1);
+ }
}
av_freep(&map);
OpenPOWER on IntegriCloud