[FFmpeg-devel] [PATCH v2 4/5] avutil/channel_layout: add av_channel_layout_retype()

Marton Balint cus at passwd.hu
Mon Feb 12 00:38:29 EET 2024



On Fri, 9 Feb 2024, Anton Khirnov wrote:

> Quoting Marton Balint (2024-02-04 20:28:11)
>> +/**
>> + * Change the AVChannelOrder of a channel layout.
>> + *
>> + * Change of AVChannelOrder can be either lossless or lossy. In case of a
>> + * lossless conversion all the channel designations and the associated channel
>> + * names (if any) are kept. On a lossy conversion the channel names and channel
>> + * designations might be lost depending on the capabilities of the desired
>> + * AVChannelOrder. Note that some conversions are simply not possible in which
>> + * case this function returns AVERROR(ENOSYS).
>> + *
>> + * The following conversions are supported:
>> + *
>> + * Any       -> Custom     : Always possible, always lossless.
>> + * Any       -> Unspecified: Always possible, lossless if channel designations
>> + *   are all unknown and channel names are not used, lossy otherwise.
>> + * Custom    -> Ambisonic  : Possible if it contains ambisonic channels with
>> + *   optional non-diegetic channels in the end. Lossy if the channels have
>> + *   custom names, lossless otherwise.
>> + * Custom    -> Native     : Possible if it contains native channels in native
>> + *     order. Lossy if the channels have custom names, lossless otherwise.
>> + *
>> + * On error this function keeps the original channel layout untouched.
>> + *
>> + * @param channel_layout channel layout which will be changed
>> + * @param order the desired channel layout order
>> + * @param flags a combination of AV_CHANNEL_LAYOUT_RETYPE_FLAG_* constants
>> + * @return 0 if the conversion was successful and lossless or if the channel
>> + *           layout was already in the desired order
>> + *         1 if the conversion was successful but lossy
>
> You could say 'positive number' instead of 1, which leaves us wiggle
> room to use other numbers in the future in a backwards compatible way.
>
> Looks ok otherwise.

Ok, thanks, will apply the series with that change.

Regards,
Marton


More information about the ffmpeg-devel mailing list