mpegdemux: start pushing data again when a pad gets linked later
authorTim-Philipp Müller <tim@centricular.net>
Tue, 3 Sep 2013 10:11:54 +0000 (11:11 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sun, 2 Nov 2014 22:49:05 +0000 (22:49 +0000)
The whole not_linked optimisation is really a bit dodgy here, but
let's leave it in place for now and at least start pushing data
again when a pad got linked later, in which case we should get a
RECONFIGURE event.

gst/mpegdemux/gstmpegdemux.c

index 53cdbaa..a337672 100644 (file)
@@ -547,6 +547,23 @@ unknown_stream:
   }
 }
 
+static GstPsStream *
+gst_ps_demux_get_stream_from_pad (GstPsDemux * demux, GstPad * srcpad)
+{
+  gint i, count;
+
+  count = demux->found_count;
+  for (i = 0; i < count; i++) {
+    GstPsStream *stream = demux->streams_found[i];
+
+    if (stream && stream->pad == srcpad)
+      return stream;
+  }
+
+  GST_DEBUG_OBJECT (srcpad, "no stream found for pad!");
+  return NULL;
+}
+
 static inline void
 gst_ps_demux_send_segment (GstPsDemux * demux, GstPsStream * stream,
     GstClockTime pts)
@@ -1324,6 +1341,17 @@ gst_ps_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
         res = gst_ps_demux_handle_seek_push (demux, event);
       }
       break;
+    case GST_EVENT_RECONFIGURE:{
+      GstPsStream *stream;
+
+      stream = gst_ps_demux_get_stream_from_pad (demux, pad);
+      if (stream != NULL)
+        stream->notlinked = FALSE;
+
+      gst_event_unref (event);
+      res = TRUE;
+      break;
+    }
     default:
       res = gst_pad_push_event (demux->sinkpad, event);
       break;