[FFmpeg-cvslog] lavfi: add avfilter_unref_bufferp()

Robert Nagy git at videolan.org
Sat Jul 21 22:32:07 CEST 2012


ffmpeg | branch: master | Robert Nagy <ronag89 at gmail.com> | Mon Apr 16 08:17:25 2012 +0200| [b70d89a033dacf53758256f875f1b23ce0ae13f1] | committer: Anton Khirnov

lavfi: add avfilter_unref_bufferp()

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b70d89a033dacf53758256f875f1b23ce0ae13f1
---

 doc/APIchanges         |    3 +++
 libavfilter/avfilter.h |   12 ++++++++++++
 libavfilter/buffer.c   |    6 ++++++
 3 files changed, 21 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index f936d5f..8770b6d 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2011-04-18
 
 API changes, most recent first:
 
+2012-07-xx - xxxxxxx - lavfi 3.0.0 - avfilter.h
+  Add avfilter_unref_bufferp().
+
 2012-07-10 - 5fade8a - lavu 51.37.0
   Add av_malloc_array() and av_mallocz_array()
 
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 10d64ad..7fbdd8a 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -195,9 +195,21 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
  * buffer, the buffer itself is also automatically freed.
  *
  * @param ref reference to the buffer, may be NULL
+ *
+ * @note it is recommended to use avfilter_unref_bufferp() instead of this
+ * function
  */
 void avfilter_unref_buffer(AVFilterBufferRef *ref);
 
+/**
+ * Remove a reference to a buffer and set the pointer to NULL.
+ * If this is the last reference to the buffer, the buffer itself
+ * is also automatically freed.
+ *
+ * @param ref pointer to the buffer reference
+ */
+void avfilter_unref_bufferp(AVFilterBufferRef **ref);
+
 #if FF_API_AVFILTERPAD_PUBLIC
 /**
  * A filter pad used for either input or output.
diff --git a/libavfilter/buffer.c b/libavfilter/buffer.c
index be0da26..e3ebc9b 100644
--- a/libavfilter/buffer.c
+++ b/libavfilter/buffer.c
@@ -84,6 +84,12 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref)
     av_free(ref);
 }
 
+void avfilter_unref_bufferp(AVFilterBufferRef **ref)
+{
+    avfilter_unref_buffer(*ref);
+    *ref = NULL;
+}
+
 int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
 {
     dst->pts    = src->pts;



More information about the ffmpeg-cvslog mailing list