diff mbox series

[FFmpeg-devel,v2,1/2] avutil/buffer: add av_buffer_pool_flush()

Message ID 20220412155316.22417-2-xademax@gmail.com
State New
Headers show
Series Add common V4L2 request API code | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Elie Roudninski April 12, 2022, 3:53 p.m. UTC
From: Jonas Karlman <jonas@kwiboo.se>

Co-authored-by: Elie ROUDNINSKI <xademax@gmail.com>
---
 doc/APIchanges      | 3 +++
 libavutil/buffer.c  | 7 +++++++
 libavutil/buffer.h  | 5 +++++
 libavutil/version.h | 4 ++--
 4 files changed, 17 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index 1a9f0a303e..049b23a6fa 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@  libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2022-xx-xx - xxxxxxxxxx - lavu 57.25.100 - buffer.h
+  Add av_buffer_pool_flush().
+
 2022-03-16 - xxxxxxxxxx - all libraries - version_major.h
   Add lib<name>/version_major.h as new installed headers, which only
   contain the major version number (and corresponding API deprecation
diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 54590be566..4bbe7b2787 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -304,6 +304,13 @@  static void buffer_pool_flush(AVBufferPool *pool)
     }
 }
 
+void av_buffer_pool_flush(AVBufferPool *pool)
+{
+    ff_mutex_lock(&pool->mutex);
+    buffer_pool_flush(pool);
+    ff_mutex_unlock(&pool->mutex);
+}
+
 /*
  * This function gets called when the pool has been uninited and
  * all the buffers returned to it.
diff --git a/libavutil/buffer.h b/libavutil/buffer.h
index e1ef5b7f07..3eb4eef34c 100644
--- a/libavutil/buffer.h
+++ b/libavutil/buffer.h
@@ -284,6 +284,11 @@  AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque,
                                    AVBufferRef* (*alloc)(void *opaque, size_t 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 6735c20090..dd7d20a9fa 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@ 
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  57
-#define LIBAVUTIL_VERSION_MINOR  24
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR  25
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \