gst/mpegstream/: Send newsegment updates for sparse streams (#350778).

Original commit message from CVS:
Patch by: Martin Zlomek <martin dot zlomek at itonis dot tv>
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_reset),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_synchronise_pads),
(gst_mpeg_demux_sync_stream_to_time):
Send newsegment updates for sparse streams (#350778).
This commit is contained in:
Martin Zlomek 2006-09-21 13:34:59 +00:00 committed by Tim-Philipp Müller
parent cb3798f817
commit fa5627a757
3 changed files with 42 additions and 86 deletions

View file

@ -1,3 +1,14 @@
2006-09-21 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Martin Zlomek <martin dot zlomek at itonis dot tv>
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_reset),
(gst_dvd_demux_sync_stream_to_time):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_subbuffer),
(gst_mpeg_demux_synchronise_pads),
(gst_mpeg_demux_sync_stream_to_time):
Send newsegment updates for sparse streams (#350778).
2006-09-20 Thomas Vander Stichele <thomas at apestaart dot org> 2006-09-20 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_do_convert_query): * ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_do_convert_query):

View file

@ -448,8 +448,8 @@ gst_dvd_demux_handle_dvd_event (GstDVDDemux * dvd_demux, GstEvent * event)
gst_element_no_more_pads (GST_ELEMENT (dvd_demux)); gst_element_no_more_pads (GST_ELEMENT (dvd_demux));
/* Keep video/audio/subtitle pads within 1/2 sec of the SCR */ /* Keep video/audio/subtitle pads within 1/2 sec of the SCR */
mpeg_demux->max_gap = 0.5 * GST_SECOND; mpeg_demux->max_gap = GST_SECOND / 2;
mpeg_demux->max_gap_tolerance = 0.05 * GST_SECOND; mpeg_demux->max_gap_tolerance = GST_SECOND / 20;
} else { } else {
GST_DEBUG_OBJECT (dvd_demux, "dvddemux Forwarding DVD event %s to all pads", GST_DEBUG_OBJECT (dvd_demux, "dvddemux Forwarding DVD event %s to all pads",
event_type); event_type);
@ -1052,7 +1052,7 @@ gst_dvd_demux_reset (GstDVDDemux * dvd_demux)
{ {
int i; int i;
//GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (dvd_demux); GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (dvd_demux);
GST_INFO ("Resetting the dvd demuxer"); GST_INFO ("Resetting the dvd demuxer");
for (i = 0; i < GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS; i++) { for (i = 0; i < GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS; i++) {
@ -1075,11 +1075,9 @@ gst_dvd_demux_reset (GstDVDDemux * dvd_demux)
dvd_demux->cur_subpicture_nr = 0; dvd_demux->cur_subpicture_nr = 0;
dvd_demux->mpeg_version = 0; dvd_demux->mpeg_version = 0;
#if 0
/* Reset max_gap handling */ /* Reset max_gap handling */
mpeg_demux->max_gap = GST_CLOCK_TIME_NONE; mpeg_demux->max_gap = 0.5 * GST_SECOND;
mpeg_demux->max_gap_tolerance = GST_CLOCK_TIME_NONE; mpeg_demux->max_gap_tolerance = 0.05 * GST_SECOND;
#endif
} }
static void static void
@ -1106,14 +1104,9 @@ gst_dvd_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
GstMPEGStream * stream, GstClockTime last_ts) GstMPEGStream * stream, GstClockTime last_ts)
{ {
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_demux); GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_demux);
GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
#if 0 GstPad *outpad;
GstClockTime start_ts; gint cur_nr;
GstEvent *filler = NULL;
GstFormat fmt = GST_FORMAT_TIME;
#endif
GstPad *outpad = NULL;
gint cur_nr = 0;
parent_class->sync_stream_to_time (mpeg_demux, stream, last_ts); parent_class->sync_stream_to_time (mpeg_demux, stream, last_ts);
@ -1130,27 +1123,15 @@ gst_dvd_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
outpad = dvd_demux->cur_subpicture; outpad = dvd_demux->cur_subpicture;
cur_nr = dvd_demux->cur_subpicture_nr; cur_nr = dvd_demux->cur_subpicture_nr;
break; break;
default:
return;
} }
#if 0 if (outpad && (cur_nr == stream->number)) {
/* FIXME: fillers in 0.9 aren't specified properly yet */ gst_pad_push_event (outpad, gst_event_new_new_segment (TRUE,
if ((outpad != NULL) && (cur_nr == stream->number)) { mpeg_parse->current_segment.rate, GST_FORMAT_TIME,
if (GST_PAD_PEER (stream->pad) last_ts, -1, last_ts));
&& gst_pad_query_position (GST_PAD_PEER (stream->pad), &fmt,
(gint64 *) & start_ts)) {
if (start_ts < last_ts)
filler =
gst_event_new_filler_stamped (start_ts, GST_CLOCK_DIFF (last_ts,
start_ts));
} else
filler = gst_event_new_filler_stamped (last_ts, GST_CLOCK_TIME_NONE);
if (filler) {
if (!gst_pad_push_event (stream->pad, filler))
gst_event_unref (filler);
}
} }
#endif
} }
static GstStateChangeReturn static GstStateChangeReturn

View file

@ -892,10 +892,9 @@ gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
if (timestamp != GST_CLOCK_TIME_NONE) { if (timestamp != GST_CLOCK_TIME_NONE) {
outstream->cur_ts = timestamp; outstream->cur_ts = timestamp;
outstream->scr_offs = GST_CLOCK_DIFF (timestamp, if (timestamp > mpeg_parse->current_ts)
PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse, outstream->scr_offs = timestamp - mpeg_parse->current_ts;
mpeg_parse->current_ts)); else
if (outstream->scr_offs < 0)
outstream->scr_offs = 0; outstream->scr_offs = 0;
if (mpeg_demux->index != NULL) { if (mpeg_demux->index != NULL) {
@ -905,10 +904,8 @@ gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
GST_FORMAT_BYTES, GST_FORMAT_BYTES,
GST_BUFFER_OFFSET (buffer), GST_FORMAT_TIME, timestamp, 0); GST_BUFFER_OFFSET (buffer), GST_FORMAT_TIME, timestamp, 0);
} }
} else { } else
outstream->cur_ts = PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse, outstream->cur_ts = mpeg_parse->current_ts + outstream->scr_offs;
mpeg_parse->current_ts + outstream->scr_offs);
}
if (size == 0) if (size == 0)
return GST_FLOW_OK; return GST_FLOW_OK;
@ -928,16 +925,10 @@ gst_mpeg_demux_send_subbuffer (GstMPEGDemux * mpeg_demux,
if (GST_CLOCK_TIME_IS_VALID (mpeg_demux->max_gap) && if (GST_CLOCK_TIME_IS_VALID (mpeg_demux->max_gap) &&
GST_CLOCK_TIME_IS_VALID (mpeg_parse->current_ts) && GST_CLOCK_TIME_IS_VALID (mpeg_parse->current_ts) &&
(PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse, (mpeg_parse->current_ts > mpeg_demux->max_gap)) {
mpeg_parse->current_ts) > mpeg_demux->max_gap)) { CLASS (mpeg_demux)->synchronise_pads (mpeg_demux,
GstClockTime threshold = mpeg_parse->current_ts - mpeg_demux->max_gap,
GST_CLOCK_DIFF (PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse, mpeg_parse->current_ts - mpeg_demux->max_gap_tolerance);
mpeg_parse->current_ts),
mpeg_demux->max_gap);
CLASS (mpeg_demux)->synchronise_pads (mpeg_demux, threshold,
PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse,
mpeg_parse->current_ts) - mpeg_demux->max_gap_tolerance);
} }
return ret; return ret;
@ -963,7 +954,7 @@ gst_mpeg_demux_synchronise_pads (GstMPEGDemux * mpeg_demux,
GstClockTime threshold, GstClockTime new_ts) GstClockTime threshold, GstClockTime new_ts)
{ {
/* /*
* Send a filler event to any pad with cur_ts < threshold to catch it up * Send a new-segment event to any pad with cur_ts < threshold to catch it up
*/ */
gint i; gint i;
@ -992,47 +983,20 @@ gst_mpeg_demux_synchronise_pads (GstMPEGDemux * mpeg_demux,
} }
} }
/* Send a filler event on the indicated pad to catch it up to /*
* last_ts. Query the pad for current time, and use that time * Send a new-segment event on the indicated pad to catch it up to last_ts.
* to set the duration of the filler event, otherwise we use
* the last timestamp of the stream and rely on the sinks
* to absorb any overlap with the decoded data.
*/ */
static void static void
gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux, gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
GstMPEGStream * stream, GstClockTime last_ts) GstMPEGStream * stream, GstClockTime last_ts)
{ {
static gboolean beenhere; /* FALSE */ GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
if (!beenhere) { gst_pad_push_event (stream->pad, gst_event_new_new_segment (TRUE,
g_message ("FIXME: gst_mpeg_demux_sync_stream_to_time\n"); mpeg_parse->current_segment.rate, GST_FORMAT_TIME,
beenhere = TRUE; last_ts, -1, last_ts));
}
#if 0
GstClockTime start_ts;
GstEvent *filler = NULL;
GstFormat fmt = GST_FORMAT_TIME;
if (!GST_PAD_PEER (stream->pad) mpeg_parse->current_segment.start = last_ts;
|| !gst_pad_query (GST_PAD_PEER (stream->pad), GST_QUERY_POSITION, &fmt,
(gint64 *) & start_ts)) {
start_ts = stream->cur_ts;
}
if (start_ts < last_ts) {
filler = gst_event_new_filler_stamped (start_ts, GST_CLOCK_DIFF (last_ts,
start_ts));
}
if (filler) {
GST_LOG ("Advancing %s from %llu by %lld to %llu (diff %lld)",
GST_PAD_NAME (stream->pad), stream->cur_ts,
gst_event_filler_get_duration (filler), last_ts,
GST_CLOCK_DIFF (last_ts, stream->cur_ts));
gst_pad_push_event (stream->pad, filler);
}
#endif
} }
#if 0 #if 0