Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2019-12-07 03:56:56 +0300
committerMarton Balint <cus@passwd.hu>2019-12-26 02:47:24 +0300
commit16685114d5999a9b5ab3ea537d89fca3669d94c9 (patch)
tree635c8f50f3f15c2ad9a34182972216a761f042e3 /libavutil
parente3dca0744d21aa8d2c6f31f74a0e2142376333e1 (diff)
avutil/buffer: add av_buffer_pool_buffer_get_opaque
In order to access the original opaque parameter of a buffer in the buffer pool. (The buffer pool implementation overrides the normal opaque parameter but also saves it so it is accessible). v2: add assertion check before dereferencing the BufferPoolEntry. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/buffer.c8
-rw-r--r--libavutil/buffer.h13
-rw-r--r--libavutil/version.h4
3 files changed, 23 insertions, 2 deletions
diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index f0034b026a..6d9cb7428e 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <string.h>
+#include "avassert.h"
#include "buffer_internal.h"
#include "common.h"
#include "mem.h"
@@ -355,3 +356,10 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool)
return ret;
}
+
+void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref)
+{
+ BufferPoolEntry *buf = ref->buffer->opaque;
+ av_assert0(buf);
+ return buf->opaque;
+}
diff --git a/libavutil/buffer.h b/libavutil/buffer.h
index 73b6bd0b14..e0f94314f4 100644
--- a/libavutil/buffer.h
+++ b/libavutil/buffer.h
@@ -285,6 +285,19 @@ void av_buffer_pool_uninit(AVBufferPool **pool);
AVBufferRef *av_buffer_pool_get(AVBufferPool *pool);
/**
+ * Query the original opaque parameter of an allocated buffer in the pool.
+ *
+ * @param ref a buffer reference to a buffer returned by av_buffer_pool_get.
+ * @return the opaque parameter set by the buffer allocator function of the
+ * buffer pool.
+ *
+ * @note the opaque parameter of ref is used by the buffer pool implementation,
+ * therefore you have to use this function to access the original opaque
+ * parameter of an allocated buffer.
+ */
+void *av_buffer_pool_buffer_get_opaque(AVBufferRef *ref);
+
+/**
* @}
*/
diff --git a/libavutil/version.h b/libavutil/version.h
index e18163388d..4de0fa1fc3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 56
-#define LIBAVUTIL_VERSION_MINOR 36
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR 37
+#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \