mirror of https://git.ffmpeg.org/ffmpeg.git
ffmpeg_opt: allow the user to ignore unused stream maps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
8234f0e3b4
commit
2375a85c36
12
ffmpeg_opt.c
12
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;
|
int sync_file_idx = -1, sync_stream_idx = 0;
|
||||||
char *p, *sync;
|
char *p, *sync;
|
||||||
char *map;
|
char *map;
|
||||||
|
char *allow_unused;
|
||||||
|
|
||||||
if (*arg == '-') {
|
if (*arg == '-') {
|
||||||
negative = 1;
|
negative = 1;
|
||||||
|
@ -275,6 +276,8 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
|
||||||
exit_program(1);
|
exit_program(1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (allow_unused = strchr(map, '?'))
|
||||||
|
*allow_unused = 0;
|
||||||
file_idx = strtol(map, &p, 0);
|
file_idx = strtol(map, &p, 0);
|
||||||
if (file_idx >= nb_input_files || file_idx < 0) {
|
if (file_idx >= nb_input_files || file_idx < 0) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx);
|
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) {
|
if (!m) {
|
||||||
av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n", arg);
|
if (allow_unused) {
|
||||||
exit_program(1);
|
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);
|
av_freep(&map);
|
||||||
|
|
Loading…
Reference in New Issue