1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

ffmpeg: generate more specific error message in case of inconsistent filtering options

In particular, distinguish if the option was -filter or -filter_script.

Suggested-by: Nicolas George
This commit is contained in:
Stefano Sabatini 2013-11-04 10:05:24 +01:00
parent 0f8bdfe3e8
commit f591ba60ff

View File

@ -1172,13 +1172,11 @@ static void check_streamcopy_filters(OptionsContext *o, AVFormatContext *oc,
{ {
if (ost->filters_script || ost->filters) { if (ost->filters_script || ost->filters) {
av_log(NULL, AV_LOG_ERROR, av_log(NULL, AV_LOG_ERROR,
"Filtergraph '%s' or filter_script '%s' was defined for %s output stream " "%s '%s' was defined for %s output stream %d:%d but codec copy was selected.\n"
"%d:%d but codec copy was selected.\n"
"Filtering and streamcopy cannot be used together.\n", "Filtering and streamcopy cannot be used together.\n",
(char *)av_x_if_null(ost->filters, "(none)"), ost->filters ? "Filtergraph" : "Filtergraph script",
(char *)av_x_if_null(ost->filters_script, "(none)"), ost->filters ? ost->filters : ost->filters_script,
av_get_media_type_string(type), av_get_media_type_string(type), ost->file_index, ost->index);
ost->file_index, ost->index);
exit_program(1); exit_program(1);
} }
} }
@ -1573,14 +1571,15 @@ static void init_output_filter(OutputFilter *ofilter, OptionsContext *o,
} }
if (ost->avfilter && (ost->filters || ost->filters_script)) { if (ost->avfilter && (ost->filters || ost->filters_script)) {
av_log(NULL, AV_LOG_ERROR, const char *opt = ost->filters ? "-vf/-af/-filter" : "-filter_script";
"Filter graph '%s' or filter script '%s' was specified through the -filter/-filter_script/-vf/-af option " av_log(NULL, AV_LOG_ERROR,
"for output stream %d:%d, which is fed from a complex filtergraph.\n" "%s '%s' was specified through the %s option "
"-filter/-filter_script and -filter_complex cannot be used together for the same stream.\n", "for output stream %d:%d, which is fed from a complex filtergraph.\n"
(char *)av_x_if_null(ost->filters, "(none)"), "%s and -filter_complex cannot be used together for the same stream.\n",
(char *)av_x_if_null(ost->filters_script, "(none)"), ost->filters ? "Filtergraph" : "Filtergraph script",
ost->file_index, ost->index); ost->filters ? ost->filters : ost->filters_script,
exit_program(1); opt, ost->file_index, ost->index, opt);
exit_program(1);
} }
if (configure_output_filter(ofilter->graph, ofilter, ofilter->out_tmp) < 0) { if (configure_output_filter(ofilter->graph, ofilter, ofilter->out_tmp) < 0) {