summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-01-03 13:42:12 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2012-01-03 13:42:12 +0100
commit713696d0c05886d6546b3d7a1941bfd69393508e (patch)
tree3d5247e2eeab255e5ed2b8c052a2e50aa5342409
parent07952da04dd520f5502ae58dd6ce3e9f9765f1e1 (diff)
taglist: add missing functions
Add missing and essential functions now that we can't directly use GstStructure methods on the taglist anymore.
-rw-r--r--gst/gsttaglist.c54
-rw-r--r--gst/gsttaglist.h6
2 files changed, 60 insertions, 0 deletions
diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c
index 1287e9346b..ff5ee48de8 100644
--- a/gst/gsttaglist.c
+++ b/gst/gsttaglist.c
@@ -760,6 +760,41 @@ gst_tag_list_new_from_string (const gchar * str)
}
/**
+ * gst_tag_list_n_tags:
+ * @list: A #GstTagList.
+ *
+ * Get the number of tags in @list.
+ *
+ * Returns: The number of tags in @list.
+ */
+gint
+gst_tag_list_n_tags (const GstTagList * list)
+{
+ g_return_val_if_fail (list != NULL, 0);
+ g_return_val_if_fail (GST_IS_TAG_LIST (list), 0);
+
+ return gst_structure_n_fields ((GstStructure *) list);
+}
+
+/**
+ * gst_tag_list_nth_tag_name:
+ * @list: A #GstTagList.
+ * @index: the index
+ *
+ * Get the name of the tag in @list at @index.
+ *
+ * Returns: The name of the tag at @index.
+ */
+const gchar *
+gst_tag_list_nth_tag_name (const GstTagList * list, guint index)
+{
+ g_return_val_if_fail (list != NULL, 0);
+ g_return_val_if_fail (GST_IS_TAG_LIST (list), 0);
+
+ return gst_structure_nth_field_name ((GstStructure *) list, index);
+}
+
+/**
* gst_tag_list_is_empty:
* @list: A #GstTagList.
*
@@ -1368,6 +1403,25 @@ gst_tag_list_copy_value (GValue * dest, const GstTagList * list,
return TRUE;
}
+/**
+ * gst_tag_list_get_value:
+ * @list: list to get the tag from
+ * @tag: tag to read out
+ *
+ * Get the value for the given tag.
+ *
+ * Returns: The #GValue for @tag.
+ */
+const GValue *
+gst_tag_list_get_value (const GstTagList * list, const gchar * tag)
+{
+ g_return_val_if_fail (GST_IS_TAG_LIST (list), NULL);
+ g_return_val_if_fail (tag != NULL, NULL);
+
+ return gst_structure_get_value ((GstStructure *) list, tag);
+}
+
+
/* FIXME 0.11: this whole merge function business is overdesigned, and the
* _get_foo() API is misleading as well - how many application developers will
* expect gst_tag_list_get_string (list, GST_TAG_ARTIST, &val) might return a
diff --git a/gst/gsttaglist.h b/gst/gsttaglist.h
index ec1f7a22b9..c0759784fd 100644
--- a/gst/gsttaglist.h
+++ b/gst/gsttaglist.h
@@ -208,6 +208,8 @@ GstTagList * gst_tag_list_new_from_string (const gchar * str) G_GNUC_MALL
gboolean gst_is_tag_list (gconstpointer p);
GstTagList * gst_tag_list_copy (const GstTagList * list) G_GNUC_MALLOC;
+gint gst_tag_list_n_tags (const GstTagList * list);
+const gchar* gst_tag_list_nth_tag_name (const GstTagList * list, guint index);
gboolean gst_tag_list_is_empty (const GstTagList * list);
gboolean gst_tag_list_is_equal (const GstTagList * list1,
const GstTagList * list2);
@@ -255,6 +257,10 @@ gboolean gst_tag_list_copy_value (GValue * dest,
const gchar * tag);
/* simplifications (FIXME: do we want them?) */
+const GValue *
+ gst_tag_list_get_value (const GstTagList * list,
+ const gchar * tag);
+
gboolean gst_tag_list_get_boolean (const GstTagList * list,
const gchar * tag,
gboolean * value);