summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 911c078)
raw | patch | inline | side by side (parent: 911c078)
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | |
Sun, 30 Oct 2011 09:58:16 +0000 (09:58 +0000) | ||
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | |
Sun, 30 Oct 2011 09:58:16 +0000 (09:58 +0000) |
We want to make GstTagList opaque and not have people use
GstStructure API on it.
API: gst_tag_list_to_string()
API: gst_tag_list_new_from_string()
GstStructure API on it.
API: gst_tag_list_to_string()
API: gst_tag_list_new_from_string()
index 5373972e840629502fafb4fa46cd3830da5e58a5..b9500b7d13b3470d56616307d2edff41d44784d8 100644 (file)
gst_tag_list_new
gst_tag_list_new_full
gst_tag_list_new_full_valist
+gst_tag_list_new_from_string
+gst_tag_list_to_string
gst_is_tag_list
gst_tag_list_is_empty
gst_tag_list_is_equal
diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c
index 0de5a644312aba5819963212a9bd21c0413173d1..566a4e0d9dfd66e61b50f10a7d2e8a0260e6a4a8 100644 (file)
--- a/gst/gsttaglist.c
+++ b/gst/gsttaglist.c
return list;
}
+/**
+ * gst_tag_list_to_string:
+ * @list: a #GstTagList
+ *
+ * Serializes a tag list to a string.
+ *
+ * Returns: a newly-allocated string, or NULL in case of an error. The
+ * string must be freed with g_free() when no longer needed.
+ *
+ * Since: 0.10.36
+ */
+gchar *
+gst_tag_list_to_string (const GstTagList * list)
+{
+ g_return_val_if_fail (GST_IS_TAG_LIST (list), NULL);
+
+ return gst_structure_to_string (GST_STRUCTURE (list));
+}
+
+/**
+ * gst_tag_list_new_from_string:
+ * @str: a string created with gst_tag_list_to_string()
+ *
+ * Deserializes a tag list.
+ *
+ * Returns: a new #GstTagList, or NULL in case of an error.
+ *
+ * Since: 0.10.36
+ */
+GstTagList *
+gst_tag_list_new_from_string (const gchar * str)
+{
+ g_return_val_if_fail (str != NULL, NULL);
+ g_return_val_if_fail (g_str_has_prefix (str, "taglist"), NULL);
+
+ return GST_TAG_LIST (gst_structure_from_string (str, NULL));
+}
+
/**
* gst_tag_list_is_empty:
* @list: A #GstTagList.
diff --git a/gst/gsttaglist.h b/gst/gsttaglist.h
index cc0601fd9f4f2b21ad6765daaed3c732b30415ae..92b938863e745a99dac92e8af5f8d9ab678be13a 100644 (file)
--- a/gst/gsttaglist.h
+++ b/gst/gsttaglist.h
GstTagList * gst_tag_list_new_full (const gchar * tag, ...);
GstTagList * gst_tag_list_new_full_valist (va_list var_args);
+gchar * gst_tag_list_to_string (const GstTagList * list);
+GstTagList * gst_tag_list_new_from_string (const gchar * str);
+
gboolean gst_is_tag_list (gconstpointer p);
GstTagList * gst_tag_list_copy (const GstTagList * list);
gboolean gst_tag_list_is_empty (const GstTagList * list);
index 7efcf2cd60c362fed4a7749227c781006d5fd3ea..30a352e8f61d8cbe378ed1f220942d4caf259a8d 100644 (file)
--- a/tests/check/gst/gsttag.c
+++ b/tests/check/gst/gsttag.c
tag_list = gst_tag_list_new ();
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, GST_TAG_DATE, date, NULL);
- str = gst_structure_to_string (tag_list);
+ str = gst_tag_list_to_string (tag_list);
fail_if (str == NULL);
fail_if (strstr (str, "2005-10-14") == NULL);
- tag_list2 = gst_structure_from_string (str, NULL);
+ tag_list2 = gst_tag_list_new_from_string (str);
fail_if (tag_list2 == NULL);
fail_if (!gst_tag_list_get_date (tag_list2, GST_TAG_DATE, &date2));
fail_unless (gst_tag_list_is_equal (tag_list2, tag_list));
index e0f60af1283242dfb756ff6ffdf2ba6cab7fdfb7..3c3084afff5d01c6743ae97c0e1c5c503af9f20a 100644 (file)
gst_tag_list_is_equal
gst_tag_list_merge
gst_tag_list_new
+ gst_tag_list_new_from_string
gst_tag_list_new_full
gst_tag_list_new_full_valist
gst_tag_list_peek_string_index
gst_tag_list_remove_tag
+ gst_tag_list_to_string
gst_tag_merge_mode_get_type
gst_tag_merge_strings_with_comma
gst_tag_merge_use_first