bufferlist: add gst_clear_buffer_list()
authorNiels De Graef <nielsdegraef@gmail.com>
Sun, 4 Nov 2018 17:52:50 +0000 (18:52 +0100)
committerSebastian Dröge <slomo@coaxion.net>
Mon, 5 Nov 2018 11:06:30 +0000 (11:06 +0000)
Basically, you can use this instead of using gst_buffer_list_unref
(which needs to be preceded by a NULL-check).

Also fixes #275

gst/gstbufferlist.h

index ce9fe11..529a12b 100644 (file)
@@ -93,6 +93,25 @@ gst_buffer_list_unref (GstBufferList * list)
   gst_mini_object_unref (GST_MINI_OBJECT_CAST (list));
 }
 
+/**
+ * gst_clear_buffer_list: (skip)
+ * @list_ptr: a pointer to a #GstBufferList reference
+ *
+ * Clears a reference to a #GstBufferList.
+ *
+ * @list_ptr must not be %NULL.
+ *
+ * If the reference is %NULL then this function does nothing. Otherwise, the
+ * reference count of the list is decreased and the pointer is set to %NULL.
+ *
+ * Since: 1.16
+ */
+static inline void
+gst_clear_buffer_list (GstBufferList ** list_ptr)
+{
+  gst_clear_mini_object (list_ptr);
+}
+
 /* copy */
 /**
  * gst_buffer_list_copy: