MpegTSBaseStream stream;
GstPad *pad;
+ /* Whether the pad was added or not */
+ gboolean active;
/* the return of the latest push */
GstFlowReturn flow_return;
/* Create the pad */
if (bstream->stream_type != 0xff)
stream->pad = create_pad_for_stream (base, bstream, program);
+ stream->active = FALSE;
stream->need_newsegment = TRUE;
stream->pts = GST_CLOCK_TIME_NONE;
TSDemuxStream *stream = (TSDemuxStream *) bstream;
if (stream->pad) {
- if (gst_pad_is_active (stream->pad)) {
+ if (stream->active && gst_pad_is_active (stream->pad)) {
/* Flush out all data */
GST_DEBUG_OBJECT (stream->pad, "Flushing out pending data");
gst_ts_demux_push_pending_data ((GstTSDemux *) base, stream);
GST_DEBUG_OBJECT (stream->pad, "Deactivating and removing pad");
gst_pad_set_active (stream->pad, FALSE);
gst_element_remove_pad (GST_ELEMENT_CAST (base), stream->pad);
+ stream->active = FALSE;
}
stream->pad = NULL;
}
GST_DEBUG_PAD_NAME (stream->pad), stream);
gst_pad_set_active (stream->pad, TRUE);
gst_element_add_pad ((GstElement *) tsdemux, stream->pad);
+ stream->active = TRUE;
GST_DEBUG_OBJECT (stream->pad, "done adding pad");
} else
GST_WARNING_OBJECT (tsdemux,
if (demux->program_number == -1 ||
demux->program_number == program->program_number) {
- GList *tmp;
GST_LOG ("program %d started", program->program_number);
demux->program_number = program->program_number;
GST_EVENT_SRC (demux->segment_event) = gst_object_ref (demux);
}
- /* Activate all stream pads, pads will already have been created */
- if (base->mode != BASE_MODE_SCANNING) {
- for (tmp = program->stream_list; tmp; tmp = tmp->next)
- activate_pad_for_stream (demux, (TSDemuxStream *) tmp->data);
- gst_element_no_more_pads ((GstElement *) demux);
- }
+ /* FIXME : When do we emit no_more_pads ? */
/* Inform scanner we have got our program */
demux->current_program_number = program->program_number;
if (G_UNLIKELY (stream->state != PENDING_PACKET_BUFFER))
goto beach;
+ if (G_UNLIKELY (!stream->active))
+ activate_pad_for_stream (demux, stream);
+
if (G_UNLIKELY (stream->pad == NULL)) {
g_list_foreach (stream->currentlist, (GFunc) gst_buffer_unref, NULL);
g_list_free (stream->currentlist);