X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Fbuffer.h;h=0c0ce12cf2fa71a5c41330b5c1553561e184adc9;hb=33aa8a62219d07f77f11f38dd71c5999e0f8e242;hp=b4399fd39ff5a86313534ef5e0c60ff8832189ce;hpb=43c0298208ad6fe36a4dbf03824842d89c3ed143;p=ffmpeg diff --git a/libavutil/buffer.h b/libavutil/buffer.h index b4399fd39ff..0c0ce12cf2f 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -248,6 +248,23 @@ typedef struct AVBufferPool AVBufferPool; */ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); +/** + * Allocate and initialize a buffer pool with a more complex allocator. + * + * @param size size of each buffer in this pool + * @param opaque arbitrary user data used by the allocator + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. + * @param pool_free a function that will be called immediately before the pool + * is freed. I.e. after av_buffer_pool_can_uninit() is called + * by the pool and all the frames are returned to the pool and + * freed. It is intended to uninitialize the user opaque data. + * @return newly created buffer pool on success, NULL on error. + */ +AVBufferPool *av_buffer_pool_init2(int size, void *opaque, + AVBufferRef* (*alloc)(void *opaque, int size), + void (*pool_free)(void *opaque)); + /** * Mark the pool as being available for freeing. It will actually be freed only * once all the allocated buffers associated with the pool are released. Thus it @@ -255,7 +272,6 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); * in use. * * @param pool pointer to the pool to be freed. It will be set to NULL. - * @see av_buffer_pool_can_uninit() */ void av_buffer_pool_uninit(AVBufferPool **pool);