gst_tag_list_get_pointer_index
gst_tag_list_get_date
gst_tag_list_get_date_index
+gst_tag_list_get_buffer
+gst_tag_list_get_buffer_index
<SUBSECTION Standard>
GST_TAG_LIST
GST_IS_TAG_LIST
*value = (GDate *) g_value_dup_boxed (v);
return (*value != NULL);
}
+
+/**
+ * gst_tag_list_get_buffer:
+ * @list: a #GstTagList to get the tag from
+ * @tag: tag to read out
+ * @value: address of a GstBuffer pointer variable to store the result into
+ *
+ * Copies the first buffer for the given tag in the taglist into the variable
+ * pointed to by @value. Free the buffer with gst_buffer_unref() when it is
+ * no longer needed.
+ *
+ * Returns: TRUE, if a buffer was copied, FALSE if the tag didn't exist in the
+ * given list or if it was #NULL.
+ *
+ * Since: 0.10.23
+ */
+gboolean
+gst_tag_list_get_buffer (const GstTagList * list, const gchar * tag,
+ GstBuffer ** value)
+{
+ GValue v = { 0, };
+
+ g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE);
+ g_return_val_if_fail (tag != NULL, FALSE);
+ g_return_val_if_fail (value != NULL, FALSE);
+
+ if (!gst_tag_list_copy_value (&v, list, tag))
+ return FALSE;
+ *value = (GstBuffer *) gst_value_dup_mini_object (&v);
+ g_value_unset (&v);
+ return (*value != NULL);
+}
+
+/**
+ * gst_tag_list_get_buffer_index:
+ * @list: a #GstTagList to get the tag from
+ * @tag: tag to read out
+ * @index: number of entry to read out
+ * @value: address of a GstBuffer pointer variable to store the result into
+ *
+ * Gets the buffer that is at the given index for the given tag in the given
+ * list and copies it into the variable pointed to by @value. Free the buffer
+ * with gst_buffer_unref() when it is no longer needed.
+ *
+ * Returns: TRUE, if a buffer was copied, FALSE if the tag didn't exist in the
+ * given list or if it was #NULL.
+ *
+ * Since: 0.10.23
+ */
+gboolean
+gst_tag_list_get_buffer_index (const GstTagList * list,
+ const gchar * tag, guint index, GstBuffer ** value)
+{
+ const GValue *v;
+
+ g_return_val_if_fail (GST_IS_TAG_LIST (list), FALSE);
+ g_return_val_if_fail (tag != NULL, FALSE);
+ g_return_val_if_fail (value != NULL, FALSE);
+
+ if ((v = gst_tag_list_get_value_index (list, tag, index)) == NULL)
+ return FALSE;
+ *value = (GstBuffer *) gst_value_dup_mini_object (v);
+ return (*value != NULL);
+}
#ifndef __GST_TAGLIST_H__
#define __GST_TAGLIST_H__
+#include <gst/gstbuffer.h>
#include <gst/gststructure.h>
#include <gst/glib-compat.h>
const gchar * tag,
guint index,
GDate ** value);
+gboolean gst_tag_list_get_buffer (const GstTagList * list,
+ const gchar * tag,
+ GstBuffer ** value);
+gboolean gst_tag_list_get_buffer_index (const GstTagList * list,
+ const gchar * tag,
+ guint index,
+ GstBuffer ** value);
/* GStreamer core tags */
/**
GST_END_TEST;
+GST_START_TEST (test_buffer_tags)
+{
+ GstTagList *tags;
+ GstBuffer *buf1, *buf2;
+
+ tags = gst_tag_list_new ();
+ buf1 = gst_buffer_new_and_alloc (222);
+ buf2 = gst_buffer_new_and_alloc (100);
+ gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_IMAGE, buf1,
+ GST_TAG_PREVIEW_IMAGE, buf2, NULL);
+ gst_buffer_unref (buf1);
+ gst_buffer_unref (buf2);
+
+ buf1 = buf2 = NULL;
+ fail_if (!gst_tag_list_get_buffer (tags, GST_TAG_IMAGE, &buf1));
+ gst_buffer_unref (buf1);
+ fail_if (!gst_tag_list_get_buffer (tags, GST_TAG_PREVIEW_IMAGE, &buf2));
+ gst_buffer_unref (buf2);
+
+ fail_if (gst_tag_list_get_buffer_index (tags, GST_TAG_IMAGE, 1, &buf1));
+ fail_if (gst_tag_list_get_buffer_index (tags, GST_TAG_IMAGE, 2, &buf1));
+ fail_if (gst_tag_list_get_buffer_index (tags, GST_TAG_PREVIEW_IMAGE, 1,
+ &buf1));
+ fail_if (gst_tag_list_get_buffer_index (tags, GST_TAG_PREVIEW_IMAGE, 2,
+ &buf1));
+
+ fail_if (!gst_tag_list_get_buffer_index (tags, GST_TAG_IMAGE, 0, &buf1));
+ fail_if (!gst_tag_list_get_buffer_index (tags, GST_TAG_PREVIEW_IMAGE, 0,
+ &buf2));
+ fail_unless_equals_int (GST_BUFFER_SIZE (buf1), 222);
+ fail_unless_equals_int (GST_BUFFER_SIZE (buf2), 100);
+
+ gst_buffer_unref (buf1);
+ gst_buffer_unref (buf2);
+
+ gst_tag_list_free (tags);
+}
+
+GST_END_TEST;
+
static Suite *
gst_tag_suite (void)
{
tcase_add_test (tc_chain, test_date_tags);
tcase_add_test (tc_chain, test_type);
tcase_add_test (tc_chain, test_set_non_utf8_string);
+ tcase_add_test (tc_chain, test_buffer_tags);
return s;
}
gst_tag_list_free
gst_tag_list_get_boolean
gst_tag_list_get_boolean_index
+ gst_tag_list_get_buffer
+ gst_tag_list_get_buffer_index
gst_tag_list_get_char
gst_tag_list_get_char_index
gst_tag_list_get_date