diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-01-09 09:25:32 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-02-14 21:24:39 +0100 |
commit | 721a4efc0545548a241080b53ab480e34f366240 (patch) | |
tree | 18a42b31590ac34907c2f76d77b92078c2f0f656 /libavutil/buffer.h | |
parent | c084d6d2cfb570b10d8784eb20cc696dfb7c5605 (diff) | |
download | ffmpeg-721a4efc0545548a241080b53ab480e34f366240.tar.gz |
buffer: add support for pools using caller data in allocation
This should allow using more complex allocators than simple malloc
wrappers.
Diffstat (limited to 'libavutil/buffer.h')
-rw-r--r-- | libavutil/buffer.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libavutil/buffer.h b/libavutil/buffer.h index 56b4d020e5..7fc18e09bf 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -242,6 +242,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 * is safe to call this function while some of the allocated buffers are still |