avutil/buffer: add get_opaque 62/171562/1 accepted/tizen/unified/20180306.061333 submit/tizen/20180305.232545
authorMichal Jurkiewicz <m.jurkiewicz@samsung.com>
Thu, 21 Sep 2017 08:05:37 +0000 (10:05 +0200)
committerhj kim <backto.kim@samsung.com>
Mon, 5 Mar 2018 23:14:05 +0000 (23:14 +0000)
Ported patch from ffmpeg:
    author Xidorn Quan <quanxunzhen@gmail.com>
    Fri, 29 Mar 2013 17:15:19 +0200 (23:15 +0800)
    committer Michael Niedermayer <michaelni@gmx.at>
    Fri, 29 Mar 2013 18:31:16 +0200 (17:31 +0100)
    commit c81d2fa96ddc9f6dab38d61a8803caca7e63bea0

    avutil/buffer: add get_opaque

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Change-Id: I456b163a92e2f87c7c4148bfb68f0f610194f3a5
Signed-off-by: Michal Jurkiewicz <m.jurkiewicz@samsung.com>
(cherry picked from commit 40bec43a69561bba5c3914d762813f32a7e1983f)

libavutil/buffer.c
libavutil/buffer.h

index 49a1f2d..127eb14 100644 (file)
@@ -126,6 +126,11 @@ int av_buffer_is_writable(const AVBufferRef *buf)
     return avpriv_atomic_int_add_and_fetch(&buf->buffer->refcount, 0) == 1;
 }
 
+void *av_buffer_get_opaque(const AVBufferRef *buf)
+{
+    return buf->buffer->opaque;
+}
+
 int av_buffer_make_writable(AVBufferRef **pbuf)
 {
     AVBufferRef *newbuf, *buf = *pbuf;
index 58def6f..71b8d52 100644 (file)
@@ -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 this buffer's 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.
  *