taglist: add gst_tag_list_replace/take()
authorNiels De Graef <nielsdegraef@gmail.com>
Sun, 4 Nov 2018 18:14:32 +0000 (19:14 +0100)
committerSebastian Dröge <slomo@coaxion.net>
Mon, 5 Nov 2018 11:06:30 +0000 (11:06 +0000)
This makes its API consistent with the other GstMiniObject subclasses.

gst/gsttaglist.h

index cae4978..819206b 100644 (file)
@@ -523,6 +523,54 @@ gst_tag_list_copy (const GstTagList * taglist)
 }
 
 /**
+ * gst_tag_list_replace:
+ * @old_taglist: (inout) (transfer full) (nullable): pointer to a pointer to a
+ *     #GstTagList to be replaced.
+ * @new_taglist: (transfer none) (allow-none): pointer to a #GstTagList that
+ *     will replace the tag list pointed to by @old_taglist.
+ *
+ * Modifies a pointer to a #GstTagList to point to a different #GstTagList. The
+ * modification is done atomically (so this is useful for ensuring thread
+ * safety in some cases), and the reference counts are updated appropriately
+ * (the old tag list is unreffed, the new is reffed).
+ *
+ * Either @new_taglist or the #GstTagList pointed to by @old_taglist may be
+ * %NULL.
+ *
+ * Returns: %TRUE if @new_taglist was different from @old_taglist
+ *
+ * Since: 1.16
+ */
+static inline gboolean
+gst_tag_list_replace (GstTagList **old_taglist, GstTagList *new_taglist)
+{
+    return gst_mini_object_replace ((GstMiniObject **) old_taglist,
+        (GstMiniObject *) new_taglist);
+}
+
+/**
+ * gst_tag_list_take:
+ * @old_taglist: (inout) (transfer full): pointer to a pointer to a #GstTagList
+ *     to be replaced.
+ * @new_taglist: (transfer full) (allow-none): pointer to a #GstTagList that
+ *     will replace the taglist pointed to by @old_taglist.
+ *
+ * Modifies a pointer to a #GstTagList to point to a different #GstTagList.
+ * This function is similar to gst_tag_list_replace() except that it takes
+ * ownership of @new_taglist.
+ *
+ * Returns: %TRUE if @new_taglist was different from @old_taglist
+ *
+ * Since: 1.16
+ */
+static inline gboolean
+gst_tag_list_take (GstTagList **old_taglist, GstTagList *new_taglist)
+{
+  return gst_mini_object_take ((GstMiniObject **) old_taglist,
+      (GstMiniObject *) new_taglist);
+}
+
+/**
  * gst_tag_list_is_writable:
  * @taglist: a #GstTagList
  *