[FFmpeg-devel] [PATCH 3/5] avutil/channel_layout: add av_channel_layout_from_custom()

Anton Khirnov anton at khirnov.net
Thu Feb 1 10:56:54 EET 2024


Quoting Marton Balint (2024-01-30 00:27:53)
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  doc/APIchanges             |  3 +++
>  libavutil/channel_layout.c | 20 ++++++++++++++++++++
>  libavutil/channel_layout.h | 13 +++++++++++++
>  libavutil/version.h        |  4 ++--
>  4 files changed, 38 insertions(+), 2 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index e477ed78e0..8e8498f803 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09
>  
>  API changes, most recent first:
>  
> +2024-02-xx - xxxxxxxxxx - lavu 58.37.100 - channel_layout.h
> +  Add av_channel_layout_from_custom().

The name seems misleading to me, there is no 'custom' from which a
channel layout is derived.

It should be something like av_channel_layout_custom_init() instead.

> +/**
> + * Initialize a custom channel layout with the specified number of channels.
> + * The designation of all channels will be unknown.
> + *
> + * @param channel_layout the layout structure to be initialized
> + * @param nb_channels the number of channels
> + *
> + * @return 0 on success
> + *         AVERROR(EINVAL) if the number of channels <= 0
> + *         AVERROR(ENOMEM) if the channel map could not be allocated
> + */

It should say that this is a convenience helper, so people don't think
this is the only way to build custom layouts.
It should also explicitly say it allocates the channel map array.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list