[FFmpeg-devel] [PATCH 001/293 v8] avutil/channel_layout: Add a new channel layout API

Marton Balint cus at passwd.hu
Mon Jan 24 23:08:51 EET 2022



On Mon, 24 Jan 2022, James Almer wrote:

> From: Anton Khirnov <anton at khirnov.net>
>
> The new API is more extensible and allows for custom layouts.
> More accurate information is exported, eg for decoders that do not
> set a channel layout, lavc will not make one up for them.
>
> Deprecate the old API working with just uint64_t bitmasks.
>
> Expanded and completed by Vittorio Giovara <vittorio.giovara at gmail.com>
> and James Almer <jamrial at gmail.com>.
> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> Changes since last version:
>
> *Both av_channel_layout_describe() and av_channel_layout_from_string() now
> support a "2 channels (FL+LFE)" syntax, to signal native (usually
> non-standard) or custom order layouts.
> *a single decimal value is now interpreted as a mask by
> av_channel_layout_from_string(), same as a single hexadecimal value.
> *De-duplicated code by simplifying av_channel_layout_channel_from_string().

AV_CHAN_UNKWNOWN is fixed in the Amibsonic patch, but it should be fixed 
in this patch.

> +/**
> + * Check whether a channel layout is valid, i.e. can possibly describe audio
> + * data.
> + *
> + * @param channel_layout input channel layout
> + * @return 1 if channel_layout is valid, 0 otherwise.
> + */
> +int av_channel_layout_check(const AVChannelLayout *channel_layout);

I still find the name av_channel_layout_valid() more readable, but feel 
free to keep it as is if you disagree.

Thanks,
Marton


More information about the ffmpeg-devel mailing list