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

Marton Balint cus at passwd.hu
Thu Feb 1 22:01:37 EET 2024



On Thu, 1 Feb 2024, Anton Khirnov wrote:

> 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.

The other initializer functions follow the av_channel_layout_from_* 
pattern. But I can rename of course if that is preferred.

>
>> +/**
>> + * 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.

Ok, will send v2.

Thanks,
Marton


More information about the ffmpeg-devel mailing list