summaryrefslogtreecommitdiff
path: root/libavutil/buffer_internal.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-14 11:29:23 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-18 23:16:49 +0200
commit4e0da7d3117bbf84203358940cba82ef10b6dfde (patch)
treee615af324744e7fe5df30a0e3974324a2d785246 /libavutil/buffer_internal.h
parent6556146aa0c21c32981405b45bb7eea7376e54c9 (diff)
avutil/buffer: Avoid allocation of AVBuffer when using buffer pool
Do this by putting an AVBuffer structure into BufferPoolEntry and reuse it for all subsequent uses of said BufferPoolEntry. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavutil/buffer_internal.h')
-rw-r--r--libavutil/buffer_internal.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavutil/buffer_internal.h b/libavutil/buffer_internal.h
index 839dc05f8f..bdff1b5b32 100644
--- a/libavutil/buffer_internal.h
+++ b/libavutil/buffer_internal.h
@@ -30,6 +30,11 @@
* The buffer was av_realloc()ed, so it is reallocatable.
*/
#define BUFFER_FLAG_REALLOCATABLE (1 << 0)
+/**
+ * The AVBuffer structure is part of a larger structure
+ * and should not be freed.
+ */
+#define BUFFER_FLAG_NO_FREE (1 << 1)
struct AVBuffer {
uint8_t *data; /**< data described by this buffer */
@@ -73,6 +78,12 @@ typedef struct BufferPoolEntry {
AVBufferPool *pool;
struct BufferPoolEntry *next;
+
+ /*
+ * An AVBuffer structure to (re)use as AVBuffer for subsequent uses
+ * of this BufferPoolEntry.
+ */
+ AVBuffer buffer;
} BufferPoolEntry;
struct AVBufferPool {