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

Michael Niedermayer michael at niedermayer.cc
Tue Dec 25 04:14:29 EET 2018


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

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20181225/5871c180/attachment.sig>


More information about the ffmpeg-devel mailing list