[FFmpeg-devel] [PATCH 1/2] avutil/buffer: add get_opaque

Xidorn Quan quanxunzhen at gmail.com
Fri Mar 29 16:15:19 CET 2013


---
 libavutil/buffer.c | 5 +++++
 libavutil/buffer.h | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index bccf089..20eaa73 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -125,6 +125,11 @@ int av_buffer_is_writable(const AVBufferRef *buf)
     return avpriv_atomic_int_get(&buf->buffer->refcount) == 1;
 }
 
+void *av_buffer_get_opaque(const AVBufferRef *buf)
+{
+    return buf->buffer->opaque;
+}
+
 int av_buffer_make_writable(AVBufferRef **pbuf)
 {
     AVBufferRef *newbuf, *buf = *pbuf;
diff --git a/libavutil/buffer.h b/libavutil/buffer.h
index e33775a..ea49342 100644
--- a/libavutil/buffer.h
+++ b/libavutil/buffer.h
@@ -122,7 +122,7 @@ AVBufferRef *av_buffer_allocz(int size);
  * @param data   data array
  * @param size   size of data in bytes
  * @param free   a callback for freeing data
- * @param opaque parameter to be passed to free
+ * @param opaque parameter to be got for processing or passed to free
  * @param flags  a combination of AV_BUFFER_FLAG_*
  *
  * @return an AVBufferRef referring to data on success, NULL on failure.
@@ -163,6 +163,11 @@ void av_buffer_unref(AVBufferRef **buf);
 int av_buffer_is_writable(const AVBufferRef *buf);
 
 /**
+ * @return the opaque parameter set by av_buffer_create.
+ */
+void *av_buffer_get_opaque(const AVBufferRef *buf);
+
+/**
  * Create a writable reference from a given buffer reference, avoiding data copy
  * if possible.
  *
-- 
1.8.2



More information about the ffmpeg-devel mailing list