[FFmpeg-devel] [PATCH 1/9] lavfi: support unknown channel layouts.

Stefano Sabatini stefasab at gmail.com
Sat Dec 29 11:33:32 CET 2012


On date Wednesday 2012-12-26 18:28:12 +0100, Nicolas George encoded:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/audio.c         |    2 +-
>  libavfilter/avcodec.c       |    6 ++--
>  libavfilter/avfiltergraph.c |   73 ++++++++++++++++++++++++++++++++++-----
>  libavfilter/formats.c       |   80 ++++++++++++++++++++++++++++++++++++++-----
>  libavfilter/formats.h       |   24 +++++++++++++
>  5 files changed, 164 insertions(+), 21 deletions(-)
[...]
> diff --git a/libavfilter/formats.h b/libavfilter/formats.h
> index c5a4e3d..23fc04c 100644
> --- a/libavfilter/formats.h
> +++ b/libavfilter/formats.h
> @@ -69,6 +69,20 @@ struct AVFilterFormats {
>      struct AVFilterFormats ***refs; ///< references to this list
>  };
>  
> +/**
> + * 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;

would be possible to remove the special conditions, and add something
like:

int all_known_channel_layouts;
int all_channels_layouts;
?

> + * - 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
> +
> +/**
>   * Return a channel layouts/samplerates list which contains the intersection of
>   * the layouts/samplerates of a and b. Also, all the references of a, all the
>   * references of b, and a and b themselves will be deallocated.

I'm sorry that I missed the discussion about unknown channel layouts,
so I may be missing something.

Why the new define is required?

It is unlikely, but it could conflict with a possible *known* channel
layout, and also doesn't allow to express a number of channels greater
than 63. A possibly better solution would be to rely on the couple
(channel_layout, channel_count) which encodes all the required
information. Is there any reason for not doing like that?

Sorry again for asking about things which have been possibly already
discussed.
-- 
FFmpeg = Frenzy and Formidable Miracolous Peaceless Extensive Gnome


More information about the ffmpeg-devel mailing list