On 2019-04-08 23:04, James Almer wrote: > On 4/8/2019 5:12 PM, Jonas Karlman wrote: >> Signed-off-by: Jonas Karlman <jo...@kwiboo.se> >> --- >> libavutil/buffer.c | 13 +++++++++++++ >> libavutil/buffer.h | 5 +++++ >> 2 files changed, 18 insertions(+) >> >> diff --git a/libavutil/buffer.c b/libavutil/buffer.c >> index 8d1aa5fa84..9c5d530c7a 100644 >> --- a/libavutil/buffer.c >> +++ b/libavutil/buffer.c >> @@ -272,6 +272,19 @@ static void buffer_pool_free(AVBufferPool *pool) >> av_freep(&pool); >> } >> >> +void av_buffer_pool_reclaim(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 73b6bd0b14..fab745f853 100644 >> --- a/libavutil/buffer.h >> +++ b/libavutil/buffer.h >> @@ -266,6 +266,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_reclaim(AVBufferPool *pool); > Maybe flush instead of reclaim? It'd be more in line with other API. > > Also, you need to add an entry for the new function in doc/APIChanges, > and increase LIBAVUTIL_VERSION_MINOR by 1 in libavutil/version.h
Thanks, I will rename to av_buffer_pool_flush() and add to doc/APIChanges and fix LIBAVUTIL_VERSION_MINOR in v2. Regards, Jonas _______________________________________________ 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".