}
/**
+ * gst_message_new_tag_full:
+ * @src: The object originating the message.
+ * @pad: The originating pad for the tag.
+ * @tag_list: The tag list for the message.
+ *
+ * Create a new tag message. The message will take ownership of the tag list.
+ * The message is posted by elements that discovered a new taglist.
+ *
+ * Returns: The new tag message.
+ *
+ * Since: 0.10.24
+ *
+ * MT safe.
+ */
+GstMessage *
+gst_message_new_tag_full (GstObject * src, GstPad * pad, GstTagList * tag_list)
+{
+ GstMessage *message;
+ GstStructure *s;
+
+ g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL);
+ g_return_val_if_fail (pad == NULL || GST_IS_PAD (pad), NULL);
+
+ s = (GstStructure *) tag_list;
+ if (pad)
+ gst_structure_set (s, "source-pad", GST_TYPE_PAD, pad, NULL);
+
+ message = gst_message_new_custom (GST_MESSAGE_TAG, src, s);
+
+ return message;
+}
+
+/**
* gst_message_new_buffering:
* @src: The object originating the message.
* @percent: The buffering percent
void
gst_message_parse_tag (GstMessage * message, GstTagList ** tag_list)
{
+ GstStructure *ret;
+
+ g_return_if_fail (GST_IS_MESSAGE (message));
+ g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
+ g_return_if_fail (tag_list != NULL);
+
+ ret = gst_structure_copy (message->structure);
+ gst_structure_remove_field (ret, "source-pad");
+
+ *tag_list = (GstTagList *) ret;
+}
+
+/**
+ * gst_message_parse_tag_full:
+ * @message: A valid #GstMessage of type GST_MESSAGE_TAG.
+ * @pad: Location where the originating pad is stored, unref after usage
+ * @tag_list: Return location for the tag-list.
+ *
+ * Extracts the tag list from the GstMessage. The tag list returned in the
+ * output argument is a copy; the caller must free it when done.
+ *
+ * Since: 0.10.24
+ *
+ * MT safe.
+ */
+void
+gst_message_parse_tag_full (GstMessage * message, GstPad ** pad,
+ GstTagList ** tag_list)
+{
+ GstStructure *ret;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
g_return_if_fail (tag_list != NULL);
- *tag_list = (GstTagList *) gst_structure_copy (message->structure);
+ ret = gst_structure_copy (message->structure);
+
+ if (gst_structure_has_field (ret, "source-pad") && pad) {
+ const GValue *v;
+
+ v = gst_structure_get_value (ret, "source-pad");
+ if (v && G_VALUE_HOLDS (v, GST_TYPE_PAD))
+ *pad = g_value_dup_object (v);
+ else
+ *pad = NULL;
+ } else if (pad) {
+ *pad = NULL;
+ }
+ gst_structure_remove_field (ret, "source-pad");
+
+ *tag_list = (GstTagList *) ret;
}
/**
g_return_if_fail (list != NULL);
gst_pad_push_event (pad, gst_event_new_tag (gst_tag_list_copy (list)));
- /* FIXME 0.11: Set the pad as source to make it possible to detect for
- * which pad the tags are actually found.
- */
+ /* FIXME 0.11: Set the pad as source. */
gst_element_post_message (element,
- gst_message_new_tag (GST_OBJECT (element), list));
+ gst_message_new_tag_full (GST_OBJECT (element), pad, list));
}
static void