[FFmpeg-devel] [PATCH 1/3] avutil/buffer: change public function and struct size parameter types to size_t
James Almer
jamrial at gmail.com
Sun May 31 23:13:17 EEST 2020
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.
More information about the ffmpeg-devel
mailing list