From 00b358d46104bb44dbe4a80c991e6fdd770bbf3d Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Sun, 4 Nov 2018 19:14:32 +0100 Subject: [PATCH] taglist: add gst_tag_list_replace/take() This makes its API consistent with the other GstMiniObject subclasses. --- gst/gsttaglist.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/gst/gsttaglist.h b/gst/gsttaglist.h index cae4978..819206b 100644 --- a/gst/gsttaglist.h +++ b/gst/gsttaglist.h @@ -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 * -- 2.7.4