ffmpeg: add -guess_layout_max option.
This commit is contained in:
@ -611,6 +611,12 @@ This is an alias for @code{-filter:a}, see the @ref{filter_option,,-filter optio
|
|||||||
Force audio tag/fourcc. This is an alias for @code{-tag:a}.
|
Force audio tag/fourcc. This is an alias for @code{-tag:a}.
|
||||||
@item -absf @var{bitstream_filter}
|
@item -absf @var{bitstream_filter}
|
||||||
Deprecated, see -bsf
|
Deprecated, see -bsf
|
||||||
|
@item -guess_layout_max @var{channels} (@emph{input,per-stream})
|
||||||
|
If some input channel layout is not known, try to guess only if it
|
||||||
|
corresponds to at most the specified number of channels. For example, 2
|
||||||
|
tells to @command{ffmpeg} to recognize 1 channel as mono and 2 channels as
|
||||||
|
stereo but not 6 channels as 5.1. The default is to always try to guess. Use
|
||||||
|
0 to disable all guessing.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@section Subtitle options:
|
@section Subtitle options:
|
||||||
|
2
ffmpeg.c
2
ffmpeg.c
@ -1443,6 +1443,8 @@ int guess_input_channel_layout(InputStream *ist)
|
|||||||
if (!dec->channel_layout) {
|
if (!dec->channel_layout) {
|
||||||
char layout_name[256];
|
char layout_name[256];
|
||||||
|
|
||||||
|
if (dec->channels > ist->guess_layout_max)
|
||||||
|
return 0;
|
||||||
dec->channel_layout = av_get_default_channel_layout(dec->channels);
|
dec->channel_layout = av_get_default_channel_layout(dec->channels);
|
||||||
if (!dec->channel_layout)
|
if (!dec->channel_layout)
|
||||||
return 0;
|
return 0;
|
||||||
|
3
ffmpeg.h
3
ffmpeg.h
@ -171,6 +171,8 @@ typedef struct OptionsContext {
|
|||||||
int nb_pass;
|
int nb_pass;
|
||||||
SpecifierOpt *passlogfiles;
|
SpecifierOpt *passlogfiles;
|
||||||
int nb_passlogfiles;
|
int nb_passlogfiles;
|
||||||
|
SpecifierOpt *guess_layout_max;
|
||||||
|
int nb_guess_layout_max;
|
||||||
} OptionsContext;
|
} OptionsContext;
|
||||||
|
|
||||||
typedef struct InputFilter {
|
typedef struct InputFilter {
|
||||||
@ -229,6 +231,7 @@ typedef struct InputStream {
|
|||||||
AVDictionary *opts;
|
AVDictionary *opts;
|
||||||
AVRational framerate; /* framerate forced with -r */
|
AVRational framerate; /* framerate forced with -r */
|
||||||
int top_field_first;
|
int top_field_first;
|
||||||
|
int guess_layout_max;
|
||||||
|
|
||||||
int resample_height;
|
int resample_height;
|
||||||
int resample_width;
|
int resample_width;
|
||||||
|
@ -616,6 +616,8 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
|
ist->guess_layout_max = INT_MAX;
|
||||||
|
MATCH_PER_STREAM_OPT(guess_layout_max, i, ist->guess_layout_max, ic, st);
|
||||||
guess_input_channel_layout(ist);
|
guess_input_channel_layout(ist);
|
||||||
|
|
||||||
ist->resample_sample_fmt = dec->sample_fmt;
|
ist->resample_sample_fmt = dec->sample_fmt;
|
||||||
@ -2581,6 +2583,8 @@ const OptionDef options[] = {
|
|||||||
"set channel layout", "layout" },
|
"set channel layout", "layout" },
|
||||||
{ "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_filters },
|
{ "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_filters },
|
||||||
"set audio filters", "filter_graph" },
|
"set audio filters", "filter_graph" },
|
||||||
|
{ "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT, { .off = OFFSET(guess_layout_max) },
|
||||||
|
"set the maximum number of channels to try to guess the channel layout" },
|
||||||
|
|
||||||
/* subtitle options */
|
/* subtitle options */
|
||||||
{ "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) },
|
{ "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) },
|
||||||
|
Reference in New Issue
Block a user