[FFmpeg-devel] [PATCH 02/10] lavfi: support unknown channel layouts.

Stefano Sabatini stefasab at gmail.com
Sun Dec 30 20:14:58 CET 2012


On date Sunday 2012-12-30 18:13:42 +0100, Nicolas George encoded:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/audio.c         |    2 +-
>  libavfilter/avcodec.c       |    3 --
>  libavfilter/avfiltergraph.c |   73 ++++++++++++++++++++++++++++++++++-----
>  libavfilter/formats.c       |   80 ++++++++++++++++++++++++++++++++++++++-----
>  libavfilter/formats.h       |   24 +++++++++++++
>  5 files changed, 162 insertions(+), 20 deletions(-)
[...]
> +/**
> + * A list of supported channel layouts.
> + *
> + * The list works the same as AVFilterFormats, except for the following
> + * differences:

> + * - an empty list means all channel layouts with known disposition;
> + * - a list consisting of only AV_CH_LAYOUT_UNKNOWN means all channel
> + *   layouts or channel counts;

What I mean: adding a specific field 
all_channel_layouts
to mean that all channel layouts are supported, and a field:

all_channel_counts
to mean that all channel counts (and layouts) are supported.

This should provide a more consistent semantic, and remove the
arbitrary mapping:

empty list -> all channel layout
{ CH_LAYOUT_UNKNOWN } -> all channel layout and counts

which looks rather arbitrary to me. My supposition is that such fields
would make the code simpler/more readable.

> + * - all layouts with known disposition must come before all counts with
> + *   unknown disposition;
> + * - the list must not contain a layout with known disposition and a channel
> + *   count with unknown disposition with the same number of channels (e.g.
> + *   AV_CH_LAYOUT_STEREO and AV_CH_LAYOUT_UNKNOWN|2).
> + */
>  typedef struct AVFilterChannelLayouts {
>      uint64_t *channel_layouts;  ///< list of channel layouts
>      int    nb_channel_layouts;  ///< number of channel layouts
> @@ -78,6 +92,16 @@ typedef struct AVFilterChannelLayouts {
>  } AVFilterChannelLayouts;
  
>  /**
> + * The channel layout codes only a channel count.
> + *
> + * "AV_CH_LAYOUT_UNKNOWN | n" means a n-channels stream with any layout,
> + * known or unknown.
> + * This flag is only permitted inside the AVFilterChannelLayouts lists and
> + * immediately related functions.
> + */
> +#define AV_CH_LAYOUT_UNKNOWN         0x8000000000000000ULL

I wonder if AVFILTER_CH_... would be better, since it is
lavfi-specific.

Thanks for working on this.
-- 
FFmpeg = Fostering & Fundamental Mastodontic Pitiless Elitarian Game


More information about the ffmpeg-devel mailing list