From 074d6347d120f2fbd11436dcdbb840c4c8935396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 3 Sep 2013 11:11:54 +0100 Subject: [PATCH] mpegdemux: start pushing data again when a pad gets linked later 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 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c index 53cdbaa594..a337672d16 100644 --- a/gst/mpegdemux/gstmpegdemux.c +++ b/gst/mpegdemux/gstmpegdemux.c @@ -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;