[FFmpeg-devel] [PATCH 001/293 v8] avutil/channel_layout: Add a new channel layout API

Anton Khirnov anton at khirnov.net
Mon Jan 31 15:27:38 EET 2022


Quoting Nicolas George (2022-01-27 16:08:10)
> > + * be checked)
> > + *
> > + * No new fields may be added to it without a major version bump, except for
> > + * new elements of the union fitting in sizeof(uint64_t).
> > + */
> > +typedef struct AVChannelLayout {
> > +    /**
> > +     * Channel order used in this layout.
> > +     * This is a mandatory field.
> > +     */
> > +    enum AVChannelOrder order;
> > +
> > +    /**
> > +     * Number of channels in this layout. Mandatory field.
> > +     */
> 
> > +    int nb_channels;
> 
> If it does not make sense to have a negative value, then unsigned is
> preferable.

We discussed this already a year ago or so. IIRC the conclusion was that
channels counts are signed everywhere and making this one unsigned adds
a danger of unexpected conversions.

> I would really like you to consider the option of refcounting. I think
> it would be more convenient and more robust for the future.

I considered refcounting back in 2013 when I wrote the original version
of this API and decided against; I still stand by that decision. But
I assure you this option was considered.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list