From 700d8b1c289ff4488db1359bb1ddaa97234b825c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 8 Sep 2011 14:33:00 +0100 Subject: [PATCH] rmdemux: delay announcing container tags until we have pads Fixes tags when transcoding. https://bugzilla.gnome.org/show_bug.cgi?id=658297 --- gst/realmedia/rmdemux.c | 18 +++++++++++++++--- gst/realmedia/rmdemux.h | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gst/realmedia/rmdemux.c b/gst/realmedia/rmdemux.c index 56c1f44483..65abd7e4b2 100644 --- a/gst/realmedia/rmdemux.c +++ b/gst/realmedia/rmdemux.c @@ -707,6 +707,11 @@ gst_rmdemux_reset (GstRMDemux * rmdemux) rmdemux->n_audio_streams = 0; rmdemux->n_video_streams = 0; + if (rmdemux->pending_tags != NULL) { + gst_tag_list_free (rmdemux->pending_tags); + rmdemux->pending_tags = NULL; + } + gst_adapter_clear (rmdemux->adapter); rmdemux->state = RMDEMUX_STATE_HEADER; rmdemux->have_pads = FALSE; @@ -1861,9 +1866,11 @@ gst_rmdemux_parse_cont (GstRMDemux * rmdemux, const guint8 * data, int length) GstTagList *tags; tags = gst_rm_utils_read_tags (data, length, gst_rm_utils_read_string16); - if (tags) { - gst_element_found_tags (GST_ELEMENT (rmdemux), tags); - } + + GST_LOG_OBJECT (rmdemux, "tags: %" GST_PTR_FORMAT, tags); + + rmdemux->pending_tags = + gst_tag_list_merge (rmdemux->pending_tags, tags, GST_TAG_MERGE_APPEND); } static GstFlowReturn @@ -2604,6 +2611,11 @@ gst_rmdemux_parse_packet (GstRMDemux * rmdemux, GstBuffer * in, guint16 version) gst_rmdemux_send_event (rmdemux, event); rmdemux->need_newsegment = FALSE; + + if (rmdemux->pending_tags != NULL) { + gst_element_found_tags (GST_ELEMENT (rmdemux), rmdemux->pending_tags); + rmdemux->pending_tags = NULL; + } } if (stream->pending_tags != NULL) { diff --git a/gst/realmedia/rmdemux.h b/gst/realmedia/rmdemux.h index 7a26741c82..eafba04b97 100644 --- a/gst/realmedia/rmdemux.h +++ b/gst/realmedia/rmdemux.h @@ -123,6 +123,9 @@ struct _GstRMDemux { guint32 object_id; guint32 size; guint16 object_version; + + /* container tags for all streams */ + GstTagList *pending_tags; }; struct _GstRMDemuxClass {