Unified · Split
| @@ -611,6 +611,12 @@ This is an alias for @code{-filter:a}, see the @ref{filter_option,,-filter optio · 610 unmodified lines | |||
| 611 | Force audio tag/fourcc. This is an alias for @code{-tag:a}. | 611 | Force audio tag/fourcc. This is an alias for @code{-tag:a}. |
| 612 | @item -absf @var{bitstream_filter} | 612 | @item -absf @var{bitstream_filter} |
| 613 | Deprecated, see -bsf | 613 | Deprecated, see -bsf |
| 614 | @item -guess_layout_max @var{channels} (@emph{input,per-stream}) | ||
| 615 | If some input channel layout is not known, try to guess only if it | ||
| 616 | corresponds to at most the specified number of channels. For example, 2 | ||
| 617 | tells to @command{ffmpeg} to recognize 1 channel as mono and 2 channels as | ||
| 618 | stereo but not 6 channels as 5.1. The default is to always try to guess. Use | ||
| 619 | 0 to disable all guessing. | ||
| 614 | @end table | 620 | @end table |
| 615 | 621 | ||
| 616 | @section Subtitle options: | 622 | @section Subtitle options: |
| @@ -1443,6 +1443,8 @@ int guess_input_channel_layout(InputStream *ist) · 1442 unmodified lines | |||
| 1443 | if (!dec->channel_layout) { | 1443 | if (!dec->channel_layout) { |
| 1444 | char layout_name[256]; | 1444 | char layout_name[256]; |
| 1445 | 1445 | ||
| 1446 | if (dec->channels > ist->guess_layout_max) | ||
| 1447 | return 0; | ||
| 1446 | dec->channel_layout = av_get_default_channel_layout(dec->channels); | 1448 | dec->channel_layout = av_get_default_channel_layout(dec->channels); |
| 1447 | if (!dec->channel_layout) | 1449 | if (!dec->channel_layout) |
| 1448 | return 0; | 1450 | return 0; |
| @@ -171,6 +171,8 @@ typedef struct OptionsContext { · 170 unmodified lines | |||
| 171 | int nb_pass; | 171 | int nb_pass; |
| 172 | SpecifierOpt *passlogfiles; | 172 | SpecifierOpt *passlogfiles; |
| 173 | int nb_passlogfiles; | 173 | int nb_passlogfiles; |
| 174 | SpecifierOpt *guess_layout_max; | ||
| 175 | int nb_guess_layout_max; | ||
| 174 | } OptionsContext; | 176 | } OptionsContext; |
| 175 | 177 | ||
| 176 | typedef struct InputFilter { | 178 | typedef struct InputFilter { |
| @@ -229,6 +231,7 @@ typedef struct InputStream { · 52 unmodified lines | |||
| 229 | AVDictionary *opts; | 231 | AVDictionary *opts; |
| 230 | AVRational framerate; /* framerate forced with -r */ | 232 | AVRational framerate; /* framerate forced with -r */ |
| 231 | int top_field_first; | 233 | int top_field_first; |
| 234 | int guess_layout_max; | ||
| 232 | 235 | ||
| 233 | int resample_height; | 236 | int resample_height; |
| 234 | int resample_width; | 237 | int resample_width; |
| @@ -616,6 +616,8 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) · 615 unmodified lines | |||
| 616 | 616 | ||
| 617 | break; | 617 | break; |
| 618 | case AVMEDIA_TYPE_AUDIO: | 618 | case AVMEDIA_TYPE_AUDIO: |
| 619 | ist->guess_layout_max = INT_MAX; | ||
| 620 | MATCH_PER_STREAM_OPT(guess_layout_max, i, ist->guess_layout_max, ic, st); | ||
| 619 | guess_input_channel_layout(ist); | 621 | guess_input_channel_layout(ist); |
| 620 | 622 | ||
| 621 | ist->resample_sample_fmt = dec->sample_fmt; | 623 | ist->resample_sample_fmt = dec->sample_fmt; |
| @@ -2581,6 +2583,8 @@ const OptionDef options[] = { · 1959 unmodified lines | |||
| 2581 | "set channel layout", "layout" }, | 2583 | "set channel layout", "layout" }, |
| 2582 | { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_filters }, | 2584 | { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_filters }, |
| 2583 | "set audio filters", "filter_graph" }, | 2585 | "set audio filters", "filter_graph" }, |
| 2586 | { "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT, { .off = OFFSET(guess_layout_max) }, | ||
| 2587 | "set the maximum number of channels to try to guess the channel layout" }, | ||
| 2584 | 2588 | ||
| 2585 | /* subtitle options */ | 2589 | /* subtitle options */ |
| 2586 | { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) }, | 2590 | { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) }, |