mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
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
This commit is contained in:
parent
9715fc3189
commit
f909c57546
2 changed files with 22 additions and 1 deletions
|
@ -1245,7 +1245,12 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first,
|
||||||
/* activate and add */
|
/* activate and add */
|
||||||
gst_pad_set_active (srcpad, TRUE);
|
gst_pad_set_active (srcpad, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (demux), srcpad);
|
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;
|
stream->discont = TRUE;
|
||||||
|
|
||||||
|
@ -1471,6 +1476,8 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream,
|
||||||
g_array_free (PMT->entries, TRUE);
|
g_array_free (PMT->entries, TRUE);
|
||||||
PMT->entries = g_array_new (FALSE, TRUE, sizeof (GstMpegTSPMTEntry));
|
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) {
|
while (entries > 0) {
|
||||||
GstMpegTSPMTEntry entry;
|
GstMpegTSPMTEntry entry;
|
||||||
GstMpegTSStream *ES_stream;
|
GstMpegTSStream *ES_stream;
|
||||||
|
@ -1554,6 +1561,12 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream,
|
||||||
ES_stream->filter.gather_pes = TRUE;
|
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,
|
gst_pes_filter_set_callbacks (&ES_stream->filter,
|
||||||
(GstPESFilterData) gst_mpegts_demux_data_cb,
|
(GstPESFilterData) gst_mpegts_demux_data_cb,
|
||||||
(GstPESFilterResync) gst_mpegts_demux_resync_cb, ES_stream);
|
(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_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;
|
return TRUE;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
|
|
@ -231,6 +231,9 @@ struct _GstMpegTSDemux {
|
||||||
|
|
||||||
/* Detect when the source stops for a while, we will resync the interpolation gap */
|
/* Detect when the source stops for a while, we will resync the interpolation gap */
|
||||||
GstClockTime last_buf_ts;
|
GstClockTime last_buf_ts;
|
||||||
|
|
||||||
|
/* Number of expected pads which have not been added yet */
|
||||||
|
gint pending_pads;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstMpegTSDemuxClass {
|
struct _GstMpegTSDemuxClass {
|
||||||
|
|
Loading…
Reference in a new issue