diff options
author | Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> | 2011-09-26 12:16:30 +0100 |
---|---|---|
committer | Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> | 2011-11-28 15:08:06 +0000 |
commit | f909c5754693d9c62fe779b8216712894b9ca494 (patch) | |
tree | 089af689a8a71ee15ddaa7130ee57bc4c4c1b830 /gst/mpegdemux | |
parent | 9715fc318980763a3665afb977c8fc52aaf794a8 (diff) | |
download | gstreamer-plugins-bad-f909c5754693d9c62fe779b8216712894b9ca494.tar.gz |
mpegtsdemux: signal no-more-pads when appropriate
We track streams for which a data callback is set (and for which
pads will be added only when data is received), and signal
no-more-pads when the last pad is added.
https://bugzilla.gnome.org/show_bug.cgi?id=659924
Diffstat (limited to 'gst/mpegdemux')
-rw-r--r-- | gst/mpegdemux/gstmpegtsdemux.c | 20 | ||||
-rw-r--r-- | gst/mpegdemux/gstmpegtsdemux.h | 3 |
2 files changed, 22 insertions, 1 deletions
diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c index 648bc2128..1fab2b0bd 100644 --- a/gst/mpegdemux/gstmpegtsdemux.c +++ b/gst/mpegdemux/gstmpegtsdemux.c @@ -1245,7 +1245,12 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first, /* activate and add */ gst_pad_set_active (srcpad, TRUE); gst_element_add_pad (GST_ELEMENT_CAST (demux), srcpad); - demux->need_no_more_pads = TRUE; + demux->pending_pads--; + GST_DEBUG_OBJECT (demux, + "Adding pad due to received data, decreasing pending pads to %d", + demux->pending_pads); + if (demux->pending_pads == 0) + gst_element_no_more_pads (GST_ELEMENT (demux)); stream->discont = TRUE; @@ -1471,6 +1476,8 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream, g_array_free (PMT->entries, TRUE); PMT->entries = g_array_new (FALSE, TRUE, sizeof (GstMpegTSPMTEntry)); + GST_DEBUG_OBJECT (demux, "Resetting pending pads due to parsing the PMT"); + demux->pending_pads = 0; while (entries > 0) { GstMpegTSPMTEntry entry; GstMpegTSStream *ES_stream; @@ -1554,6 +1561,12 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream, ES_stream->filter.gather_pes = TRUE; } } + + ++demux->pending_pads; + GST_DEBUG_OBJECT (demux, + "Setting data callback, increasing pending pads to %d", + demux->pending_pads); + gst_pes_filter_set_callbacks (&ES_stream->filter, (GstPESFilterData) gst_mpegts_demux_data_cb, (GstPESFilterResync) gst_mpegts_demux_resync_cb, ES_stream); @@ -1585,6 +1598,11 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream, gst_mpegts_activate_pmt (demux, stream); } + GST_DEBUG_OBJECT (demux, "Done parsing PMT, pending pads now %d", + demux->pending_pads); + if (demux->pending_pads == 0) + gst_element_no_more_pads (GST_ELEMENT (demux)); + return TRUE; /* ERRORS */ diff --git a/gst/mpegdemux/gstmpegtsdemux.h b/gst/mpegdemux/gstmpegtsdemux.h index d25e7fde8..9a5db0e1a 100644 --- a/gst/mpegdemux/gstmpegtsdemux.h +++ b/gst/mpegdemux/gstmpegtsdemux.h @@ -231,6 +231,9 @@ struct _GstMpegTSDemux { /* Detect when the source stops for a while, we will resync the interpolation gap */ GstClockTime last_buf_ts; + + /* Number of expected pads which have not been added yet */ + gint pending_pads; }; struct _GstMpegTSDemuxClass { |