[FFmpeg-devel] [PATCH] Add a new channel layout API

Paul B Mahol onemda at gmail.com
Tue Dec 25 15:11:45 EET 2018


On 12/25/18, Michael Niedermayer <michael at niedermayer.cc> wrote:
> On Mon, Dec 24, 2018 at 06:34:30PM +0100, Paul B Mahol wrote:
> [...]
>> -static const char *get_channel_name(int channel_id)
>> +const char *av_channel_name(enum AVChannel channel_id)
>>  {
>
>>      if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names))
>>          return NULL;
>> +    if ((unsigned) channel_id >= FF_ARRAY_ELEMS(channel_names))
>> +        return "?";
>
> this looks like a untended duplicate check
>
> [...]
>
>> +/**
>> + * Check whether two channel layouts are semantically the same, i.e. the
>> same
>> + * channels are present on the same positions in both.
>> + *
>> + * If one of the channel layouts is AV_CHANNEL_ORDER_UNSPEC, while the
>> other is
>> + * not, they are considered to be unequal. If both are
>> AV_CHANNEL_ORDER_UNSPEC,
>> + * they are considered equal iff the channel counts are the same in
>> both.
>> + *
>> + * @param chl input channel layout
>> + * @param chl1 input channel layout
>> + * @return 0 if chl and chl1 are equal, 1 if they are not equal. A
>> negative
>> + *         AVERROR code if one or both are invalid.
>> + */
>> +int av_channel_layout_compare(const AVChannelLayout *chl, const
>> AVChannelLayout *chl1);
>
> It could be usefull if this is a full compare function that allows
> sorting/ordering

Which kind of sorting? That could be only added later when needed.


More information about the ffmpeg-devel mailing list