[FFmpeg-devel] [PATCH v3 11/18] swscale: expose SwsContext publicly

Anton Khirnov anton at khirnov.net
Thu Oct 24 13:01:42 EEST 2024


Quoting Niklas Haas (2024-10-24 11:28:16)
> On Thu, 24 Oct 2024 11:14:32 +0200 Anton Khirnov <anton at khirnov.net> wrote:
> > Quoting Niklas Haas (2024-10-20 22:05:20)
> > > +/**
> > > + * Main external API structure. New fields can be added to the end with
> > > + * minor version bumps. Removal, reordering and changes to existing fields
> > > + * require a major version bump. sizeof(SwsContext) is not part of the ABI.
> > > + */
> > > +typedef struct SwsContext {
> > > +    const AVClass *av_class;
> > > +
> > > +    /**
> > > +     * Private context used for internal data.
> > > +     */
> > > +    struct SwsInternal *internal;
> >
> > Why is this visible in the public context?
> 
> I was following the precedent established by AVCodecContext.

That's historical and we are gradually moving away from it, especially
in new code. See e.g. fed02825081bd6441f865c9cfcf50e384b2392f5.

> If you prefer, I could instead allocate SwsInternal as a superset of
> SwsContext. That would actually make a lot of the code changes a bit cleaner
> to implement, and avoids some pointer dereferencing.

I think that would be preferable.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list