rmdemux: delay announcing container tags until we have pads
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 8 Sep 2011 13:33:00 +0000 (14:33 +0100)
committerNikhil Devshatwar <a0132237@ti.com>
Fri, 17 May 2013 09:40:38 +0000 (15:10 +0530)
Fixes tags when transcoding.

https://bugzilla.gnome.org/show_bug.cgi?id=658297

gst/realmedia/rmdemux.c
gst/realmedia/rmdemux.h

index 56c1f444834086207fa8b9960f464a03a5c5c386..65abd7e4b23f04b7dad7ebd3434595ccbb03a6b3 100644 (file)
@@ -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) {
index 7a26741c82cb66f0a577d4dd4198b6134239d21b..eafba04b97d2d9b01369013a9bd62d0ee3717f92 100644 (file)
@@ -123,6 +123,9 @@ struct _GstRMDemux {
   guint32 object_id;
   guint32 size;
   guint16 object_version;
+
+  /* container tags for all streams */
+  GstTagList *pending_tags;
 };
 
 struct _GstRMDemuxClass {