asfdemux: post tags only after we've created our source pads

Post global tags only after we've added our source pads, so that
tag events get sent downstream in addition to tag messages posted
on the bus. This makes sure tags can be picked up automatically
when transcoding, but also by tagreadbin/playbin2. Fixes #519721.

While we're at it, also add a container-format tag.
This commit is contained in:
Tim-Philipp Müller 2009-06-23 02:14:00 +01:00
parent aa0d6f7b48
commit 6ec0b61980

View file

@ -1226,6 +1226,17 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
GST_FORMAT_TIME, demux->segment.start, demux->segment.stop, GST_FORMAT_TIME, demux->segment.start, demux->segment.stop,
demux->segment.start)); demux->segment.start));
/* now post any global tags we may have found */
if (demux->taglist == NULL)
demux->taglist = gst_tag_list_new ();
gst_tag_list_add (demux->taglist, GST_TAG_MERGE_REPLACE,
GST_TAG_CONTAINER_FORMAT, "ASF", NULL);
GST_DEBUG_OBJECT (demux, "global tags: %" GST_PTR_FORMAT, demux->taglist);
gst_element_found_tags (GST_ELEMENT (demux), demux->taglist);
demux->taglist = NULL;
demux->need_newsegment = FALSE; demux->need_newsegment = FALSE;
demux->segment_running = TRUE; demux->segment_running = TRUE;
} }
@ -2113,25 +2124,27 @@ gst_asf_demux_get_gst_tag_from_tag_name (const gchar * name_utf16le,
return NULL; return NULL;
} }
/* gst_asf_demux_commit_taglist() takes ownership of taglist! */ /* gst_asf_demux_add_global_tags() takes ownership of taglist! */
static void static void
gst_asf_demux_commit_taglist (GstASFDemux * demux, GstTagList * taglist) gst_asf_demux_add_global_tags (GstASFDemux * demux, GstTagList * taglist)
{ {
GST_DEBUG ("Committing tags: %" GST_PTR_FORMAT, taglist);
gst_element_found_tags (GST_ELEMENT (demux), gst_tag_list_copy (taglist));
/* save internally */
if (!demux->taglist)
demux->taglist = taglist;
else {
GstTagList *t; GstTagList *t;
GST_DEBUG_OBJECT (demux, "adding global tags: %" GST_PTR_FORMAT, taglist);
if (taglist == NULL)
return;
if (gst_tag_list_is_empty (taglist)) {
gst_tag_list_free (taglist);
return;
}
t = gst_tag_list_merge (demux->taglist, taglist, GST_TAG_MERGE_APPEND); t = gst_tag_list_merge (demux->taglist, taglist, GST_TAG_MERGE_APPEND);
gst_tag_list_free (demux->taglist); gst_tag_list_free (demux->taglist);
gst_tag_list_free (taglist); gst_tag_list_free (taglist);
demux->taglist = t; demux->taglist = t;
} GST_LOG_OBJECT (demux, "global tags now: %" GST_PTR_FORMAT, demux->taglist);
} }
#define ASF_DEMUX_DATA_TYPE_UTF16LE_STRING 0 #define ASF_DEMUX_DATA_TYPE_UTF16LE_STRING 0
@ -2336,11 +2349,7 @@ gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data,
g_free (value); g_free (value);
} }
if (gst_structure_n_fields (GST_STRUCTURE (taglist)) > 0) { gst_asf_demux_add_global_tags (demux, taglist);
gst_asf_demux_commit_taglist (demux, taglist);
} else {
gst_tag_list_free (taglist);
}
return GST_FLOW_OK; return GST_FLOW_OK;
@ -2637,11 +2646,7 @@ gst_asf_demux_process_comment (GstASFDemux * demux, guint8 * data, guint64 size)
} }
g_value_unset (&value); g_value_unset (&value);
if (gst_structure_n_fields (GST_STRUCTURE (taglist)) > 0) { gst_asf_demux_add_global_tags (demux, taglist);
gst_asf_demux_commit_taglist (demux, taglist);
} else {
gst_tag_list_free (taglist);
}
for (i = 0; i < G_N_ELEMENTS (tags); ++i) for (i = 0; i < G_N_ELEMENTS (tags); ++i)
g_free (tags[i].val_utf8); g_free (tags[i].val_utf8);