taglist: add gst_tag_list_replace/take()

This makes its API consistent with the other GstMiniObject subclasses.
This commit is contained in:
Niels De Graef 2018-11-04 19:14:32 +01:00 committed by Sebastian Dröge
parent 63e3edecfd
commit 00b358d461

View file

@ -522,6 +522,54 @@ gst_tag_list_copy (const GstTagList * taglist)
return GST_TAG_LIST (gst_mini_object_copy (GST_MINI_OBJECT_CAST (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