Signed-off-by: Jonas Karlman <jo...@kwiboo.se> --- doc/APIchanges | 3 +++ libavutil/buffer.c | 13 +++++++++++++ libavutil/buffer.h | 5 +++++ libavutil/version.h | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges index 3fb9e12525..4a739ce453 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2020-xx-xx - xxxxxxxxxx - lavu 56.63.100 - buffer.h + Add av_buffer_pool_flush(). + 2020-12-03 - xxxxxxxxxx - lavu 56.62.100 - timecode.h Add av_timecode_init_from_components. diff --git a/libavutil/buffer.c b/libavutil/buffer.c index d67b4bbdaf..a0683664cf 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -300,6 +300,19 @@ static void buffer_pool_free(AVBufferPool *pool) av_freep(&pool); } +void av_buffer_pool_flush(AVBufferPool *pool) +{ + ff_mutex_lock(&pool->mutex); + while (pool->pool) { + BufferPoolEntry *buf = pool->pool; + pool->pool = buf->next; + + buf->free(buf->opaque, buf->data); + av_freep(&buf); + } + ff_mutex_unlock(&pool->mutex); +} + void av_buffer_pool_uninit(AVBufferPool **ppool) { AVBufferPool *pool; diff --git a/libavutil/buffer.h b/libavutil/buffer.h index fd4e381efa..cef2d08f5a 100644 --- a/libavutil/buffer.h +++ b/libavutil/buffer.h @@ -283,6 +283,11 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque, AVBufferRef* (*alloc)(void *opaque, int size), void (*pool_free)(void *opaque)); +/** + * Free all available buffers in a buffer pool. + */ + void av_buffer_pool_flush(AVBufferPool *pool); + /** * 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 diff --git a/libavutil/version.h b/libavutil/version.h index 9b311b5b27..9db2797aee 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 56 -#define LIBAVUTIL_VERSION_MINOR 62 +#define LIBAVUTIL_VERSION_MINOR 63 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".