History

ffmpeg: add -guess_layout_max option.

Nicolas George committed 13 years ago

Commit fccd8c21 parent 9648e144 files · +15 −0Browse files

Unified · Split

4 files
  1. doc/ffmpeg.texi +6 −0
  2. ffmpeg.c +2 −0
  3. ffmpeg.h +3 −0
  4. ffmpeg_opt.c +4 −0
doc/ffmpeg.texi+6−0
@@ -611,6 +611,12 @@ This is an alias for @code{-filter:a}, see the @ref{filter_option,,-filter optio · 610 unmodified lines
611611 Force audio tag/fourcc. This is an alias for @code{-tag:a}.
612612 @item -absf @var{bitstream_filter}
613613 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.
614620 @end table
615621
616622 @section Subtitle options:
ffmpeg.c+2−0
@@ -1443,6 +1443,8 @@ int guess_input_channel_layout(InputStream *ist) · 1442 unmodified lines
14431443 if (!dec->channel_layout) {
14441444 char layout_name[256];
14451445
1446+ if (dec->channels > ist->guess_layout_max)
1447+ return 0;
14461448 dec->channel_layout = av_get_default_channel_layout(dec->channels);
14471449 if (!dec->channel_layout)
14481450 return 0;
ffmpeg.h+3−0
@@ -171,6 +171,8 @@ typedef struct OptionsContext { · 170 unmodified lines
171171 int nb_pass;
172172 SpecifierOpt *passlogfiles;
173173 int nb_passlogfiles;
174+ SpecifierOpt *guess_layout_max;
175+ int nb_guess_layout_max;
174176 } OptionsContext;
175177
176178 typedef struct InputFilter {
@@ -229,6 +231,7 @@ typedef struct InputStream { · 52 unmodified lines
229231 AVDictionary *opts;
230232 AVRational framerate; /* framerate forced with -r */
231233 int top_field_first;
234+ int guess_layout_max;
232235
233236 int resample_height;
234237 int resample_width;
ffmpeg_opt.c+4−0
@@ -616,6 +616,8 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) · 615 unmodified lines
616616
617617 break;
618618 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);
619621 guess_input_channel_layout(ist);
620622
621623 ist->resample_sample_fmt = dec->sample_fmt;
@@ -2581,6 +2583,8 @@ const OptionDef options[] = { · 1959 unmodified lines
25812583 "set channel layout", "layout" },
25822584 { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE, { .func_arg = opt_audio_filters },
25832585 "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" },
25842588
25852589 /* subtitle options */
25862590 { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET, { .off = OFFSET(subtitle_disable) },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t