[FFmpeg-devel] [PATCH 01/10] ffmpeg: add -guess_layout_max option.

Michael Niedermayer michaelni at gmx.at
Sat Jan 5 18:49:48 CET 2013


On Sat, Jan 05, 2013 at 02:50:36PM +0100, Nicolas George wrote:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  doc/ffmpeg.texi |    6 ++++++
>  ffmpeg.c        |    2 ++
>  ffmpeg.h        |    1 +
>  ffmpeg_opt.c    |    3 +++
>  4 files changed, 12 insertions(+)
> 
> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> index d0fe327..7ccfc5c 100644
> --- a/doc/ffmpeg.texi
> +++ b/doc/ffmpeg.texi
> @@ -595,6 +595,12 @@ also sources and sinks).  This is an alias for @code{-filter:a}.
>  Force audio tag/fourcc. This is an alias for @code{-tag:a}.
>  @item -absf @var{bitstream_filter}
>  Deprecated, see -bsf
> + at item -guess_layout_max @var{channels} (@emph{input})
> +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
>  
>  @section Subtitle options:
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 977218f..de6e66c 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1441,6 +1441,8 @@ int guess_input_channel_layout(InputStream *ist)
>      if (!dec->channel_layout) {
>          char layout_name[256];
>  
> +        if (dec->channels > guess_layout_max)
> +            return 0;
>          dec->channel_layout = av_get_default_channel_layout(dec->channels);
>          if (!dec->channel_layout)
>              return 0;
> diff --git a/ffmpeg.h b/ffmpeg.h
> index 1260563..9864eac 100644
> --- a/ffmpeg.h
> +++ b/ffmpeg.h
> @@ -385,6 +385,7 @@ extern int copy_ts;
>  extern int copy_tb;
>  extern int debug_ts;
>  extern int exit_on_error;
> +extern int guess_layout_max;
>  extern int print_stats;
>  extern int qp_hist;
>  extern int stdin_interaction;
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 63e3de9..5d7f689 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -81,6 +81,7 @@ int copy_ts           = 0;
>  int copy_tb           = -1;
>  int debug_ts          = 0;
>  int exit_on_error     = 0;
> +int guess_layout_max  = INT_MAX;
>  int print_stats       = 1;
>  int qp_hist           = 0;
>  int stdin_interaction = 1;

This looks wrong
the thing is semantically per InputStream but placed in a global
variable.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

DNS cache poisoning attacks, popular search engine, Google internet authority
dont be evil, please
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130105/255eb3b2/attachment.asc>


More information about the ffmpeg-devel mailing list