API: add gst_tag_list_is_empty() (#360467).

Original commit message from CVS:
* gst/gsttaglist.c: (gst_tag_list_is_empty):
* gst/gsttaglist.h:
* docs/gst/gstreamer-sections.txt:
API: add gst_tag_list_is_empty() (#360467).
* tests/check/gst/gsttag.c: (GST_START_TEST):
And a test case.
This commit is contained in:
Tim-Philipp Müller 2006-10-09 11:20:44 +00:00
parent 6ac7827d3c
commit 3a8fdc1d39
5 changed files with 39 additions and 0 deletions

View file

@ -1,3 +1,13 @@
2006-10-09 Tim-Philipp Müller <tim at centricular dot net>
* gst/gsttaglist.c: (gst_tag_list_is_empty):
* gst/gsttaglist.h:
* docs/gst/gstreamer-sections.txt:
API: add gst_tag_list_is_empty() (#360467).
* tests/check/gst/gsttag.c: (GST_START_TEST):
And a test case.
2006-10-09 Zaheer Abbas Merali <zaheerabbas at merali dot org> 2006-10-09 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* gst/gstmessage.h: * gst/gstmessage.h:

View file

@ -1831,6 +1831,7 @@ gst_tag_get_flag
gst_tag_is_fixed gst_tag_is_fixed
gst_tag_list_new gst_tag_list_new
gst_is_tag_list gst_is_tag_list
gst_tag_list_is_empty
gst_tag_list_copy gst_tag_list_copy
gst_tag_list_insert gst_tag_list_insert
gst_tag_list_merge gst_tag_list_merge

View file

@ -468,6 +468,25 @@ gst_tag_list_new (void)
return GST_TAG_LIST (gst_structure_new (TAGLIST, NULL)); return GST_TAG_LIST (gst_structure_new (TAGLIST, NULL));
} }
/**
* gst_tag_list_is_empty:
* @taglist: A #GstTagList.
*
* Checks if the given taglist is empty.
*
* Returns: TRUE if the taglist is empty, otherwise FALSE.
*
* Since: 0.10.11
*/
gboolean
gst_tag_list_is_empty (const GstTagList * taglist)
{
g_return_val_if_fail (taglist != NULL, FALSE);
g_return_val_if_fail (GST_IS_TAG_LIST (taglist), FALSE);
return (gst_structure_n_fields ((GstStructure *) taglist) == 0);
}
/** /**
* gst_is_tag_list: * gst_is_tag_list:
* @p: Object that might be a taglist * @p: Object that might be a taglist

View file

@ -135,6 +135,7 @@ gboolean gst_tag_is_fixed (const gchar * tag);
GstTagList * gst_tag_list_new (void); GstTagList * gst_tag_list_new (void);
gboolean gst_is_tag_list (gconstpointer p); gboolean gst_is_tag_list (gconstpointer p);
GstTagList * gst_tag_list_copy (const GstTagList * list); GstTagList * gst_tag_list_copy (const GstTagList * list);
gboolean gst_tag_list_is_empty (const GstTagList * list);
void gst_tag_list_insert (GstTagList * into, void gst_tag_list_insert (GstTagList * into,
const GstTagList * from, const GstTagList * from,
GstTagMergeMode mode); GstTagMergeMode mode);

View file

@ -229,6 +229,14 @@ GST_START_TEST (test_type)
/* this however should be fine */ /* this however should be fine */
fail_if (GST_IS_TAG_LIST (NULL)); fail_if (GST_IS_TAG_LIST (NULL));
/* check gst_tag_list_is_empty */
ASSERT_CRITICAL (gst_tag_list_is_empty (NULL));
taglist = gst_tag_list_new ();
fail_unless (gst_tag_list_is_empty (taglist));
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, GST_TAG_ARTIST, "JD", NULL);
fail_if (gst_tag_list_is_empty (taglist));
gst_tag_list_free (taglist);
} }
GST_END_TEST; GST_END_TEST;