message, event: update for tag lists not being structures any more

This commit is contained in:
Tim-Philipp Müller 2012-05-26 11:37:49 +01:00
parent 97c2498bbe
commit 61dcbaab63
4 changed files with 29 additions and 15 deletions

View file

@ -1002,9 +1002,16 @@ gst_event_copy_segment (GstEvent * event, GstSegment * segment)
GstEvent *
gst_event_new_tag (GstTagList * taglist)
{
GstStructure *s;
GValue val = G_VALUE_INIT;
g_return_val_if_fail (taglist != NULL, NULL);
return gst_event_new_custom (GST_EVENT_TAG, (GstStructure *) taglist);
s = gst_structure_new_id_empty (GST_QUARK (EVENT_TAG));
g_value_init (&val, GST_TYPE_TAG_LIST);
g_value_take_boxed (&val, taglist);
gst_structure_id_take_value (s, GST_QUARK (TAGLIST), &val);
return gst_event_new_custom (GST_EVENT_TAG, s);
}
/**
@ -1020,11 +1027,16 @@ gst_event_new_tag (GstTagList * taglist)
void
gst_event_parse_tag (GstEvent * event, GstTagList ** taglist)
{
const GValue *val;
g_return_if_fail (GST_IS_EVENT (event));
g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_TAG);
val = gst_structure_id_get_value (GST_EVENT_STRUCTURE (event),
GST_QUARK (TAGLIST));
if (taglist)
*taglist = (GstTagList *) GST_EVENT_STRUCTURE (event);
*taglist = (GstTagList *) g_value_get_boxed (val);
}
/* buffersize event */

View file

@ -480,13 +480,17 @@ gst_message_new_info (GstObject * src, GError * error, const gchar * debug)
GstMessage *
gst_message_new_tag (GstObject * src, GstTagList * tag_list)
{
GstStructure *s;
GstMessage *message;
GValue val = G_VALUE_INIT;
g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL);
message =
gst_message_new_custom (GST_MESSAGE_TAG, src, (GstStructure *) tag_list);
g_return_val_if_fail (GST_IS_TAG_LIST (tag_list), NULL);
s = gst_structure_new_id_empty (GST_QUARK (MESSAGE_TAG));
g_value_init (&val, GST_TYPE_TAG_LIST);
g_value_take_boxed (&val, tag_list);
gst_structure_id_take_value (s, GST_QUARK (TAGLIST), &val);
message = gst_message_new_custom (GST_MESSAGE_TAG, src, s);
return message;
}
@ -1017,16 +1021,12 @@ gst_message_has_name (GstMessage * message, const gchar * name)
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 (GST_MESSAGE_STRUCTURE (message));
gst_structure_remove_field (ret, "source-pad");
*tag_list = (GstTagList *) ret;
gst_structure_id_get (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (TAGLIST), GST_TYPE_TAG_LIST, tag_list, NULL);
}
/**
@ -2210,7 +2210,7 @@ gst_message_new_toc (GstObject * src, GstToc * toc, gboolean updated)
* @toc: (out): return location for the TOC.
* @updated: (out): return location for the updated flag.
*
* Extract the TOC from the #GstMessage. The TOC returned in the
* Extract thef TOC from the #GstMessage. The TOC returned in the
* output argument is a copy; the caller must free it with
* gst_toc_free() when done.
*

View file

@ -62,7 +62,7 @@ static const gchar *_quark_strings[] = {
GST_ELEMENT_METADATA_KLASS, GST_ELEMENT_METADATA_DESCRIPTION,
GST_ELEMENT_METADATA_AUTHOR, "toc", "toc-entry", "updated", "extend-uid",
"uid", "tags", "sub-entries", "info", "info-structure",
"time-structure"
"time-structure", "GstMessageTag", "GstEventTag"
};
GQuark _priv_gst_quark_table[GST_QUARK_MAX];

View file

@ -181,7 +181,9 @@ typedef enum _GstQuarkId
GST_QUARK_INFO = 152,
GST_QUARK_INFO_STRUCTURE = 153,
GST_QUARK_TIME_STRUCTURE = 154,
GST_QUARK_MAX = 155
GST_QUARK_MESSAGE_TAG = 155,
GST_QUARK_EVENT_TAG = 156,
GST_QUARK_MAX = 157
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];