API: add gst_tag_list_is_empty() (#360467).
authorTim-Philipp Müller <tim@centricular.net>
Mon, 9 Oct 2006 11:20:44 +0000 (11:20 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Mon, 9 Oct 2006 11:20:44 +0000 (11:20 +0000)
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.

ChangeLog
docs/gst/gstreamer-sections.txt
gst/gsttaglist.c
gst/gsttaglist.h
tests/check/gst/gsttag.c

index cc5b6cf..8b0765f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * gst/gstmessage.h:
index 3cb7a46..06e3b89 100644 (file)
@@ -1831,6 +1831,7 @@ gst_tag_get_flag
 gst_tag_is_fixed
 gst_tag_list_new
 gst_is_tag_list
+gst_tag_list_is_empty
 gst_tag_list_copy
 gst_tag_list_insert
 gst_tag_list_merge
index 29a54bd..2c6cbc2 100644 (file)
@@ -469,6 +469,25 @@ gst_tag_list_new (void)
 }
 
 /**
+ * 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:
  * @p: Object that might be a taglist
  *
index 62508b7..b059c91 100644 (file)
@@ -135,6 +135,7 @@ gboolean               gst_tag_is_fixed        (const gchar * tag);
 GstTagList * gst_tag_list_new               (void);
 gboolean     gst_is_tag_list                (gconstpointer p);
 GstTagList * gst_tag_list_copy              (const GstTagList * list);
+gboolean     gst_tag_list_is_empty          (const GstTagList * list);
 void         gst_tag_list_insert            (GstTagList       * into,
                                              const GstTagList * from,
                                              GstTagMergeMode    mode);
index e0b1be3..9f1afa2 100644 (file)
@@ -229,6 +229,14 @@ GST_START_TEST (test_type)
 
   /* this however should be fine */
   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;