[FFmpeg-devel] [PATCH 1/3] avutil/buffer: change public function and struct size parameter types to size_t

Hendrik Leppkes h.leppkes at gmail.com
Mon Jun 1 01:30:44 EEST 2020


On Sun, May 31, 2020 at 10:13 PM James Almer <jamrial at gmail.com> wrote:
>
> On 5/31/2020 1:38 PM, James Almer wrote:
> > Signed-off-by: James Almer <jamrial at gmail.com>
> > ---
> > Aside from being more correct, it's also needed now that the video_enc_params
> > API, which may allocate arrays > INT_MAX, is used as frame side data.
> >
> >  doc/APIchanges              |  4 ++++
> >  libavutil/buffer.c          | 25 +++++++++++++++++++++++++
> >  libavutil/buffer.h          | 31 +++++++++++++++++++++++++++++++
> >  libavutil/buffer_internal.h | 13 +++++++++++++
> >  libavutil/version.h         |  3 +++
> >  5 files changed, 76 insertions(+)
>
> [...]
>
> > +#if FF_API_BUFFER_SIZE_T
> >  AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
> >                                     AVBufferRef* (*alloc)(void *opaque, int size),
> > +#else
> > +AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
> > +                                   AVBufferRef* (*alloc)(void *opaque, size_t size),
> > +#endif
> >                                     void (*pool_free)(void *opaque))
> >  {
> >      AVBufferPool *pool = av_mallocz(sizeof(*pool));
> > @@ -236,7 +257,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
> >      return pool;
> >  }
> >
> > +#if FF_API_BUFFER_SIZE_T
> >  AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size))
> > +#else
> > +AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size))
>
> These two pool alloc functions are the ones that make me think we may
> need to let two years pass before making the switch. Library users
> implementing their own callbacks will need to adapt them.
>
> I'll for that matter resend the AVPacket patch later, changing only the
> side data parts.

A deprecation period only makes sense if you plan to offer the
alternate API under a new (permanent) name. The point of such a period
is to deprecate the old name and give people time to swap to the new
one.
Announcing a future change without any pro-active migration does not
help, and thus the two year period would do nothing but delay the
change.

- Hendrik


More information about the ffmpeg-devel mailing list