gst_element_no_more_pads (GST_ELEMENT (dvd_demux));
/* Keep video/audio/subtitle pads within 1/2 sec of the SCR */
- mpeg_demux->max_gap = 0.5 * GST_SECOND;
- mpeg_demux->max_gap_tolerance = 0.05 * GST_SECOND;
+ mpeg_demux->max_gap = GST_SECOND / 2;
+ mpeg_demux->max_gap_tolerance = GST_SECOND / 20;
} else {
GST_DEBUG_OBJECT (dvd_demux, "dvddemux Forwarding DVD event %s to all pads",
event_type);
{
int i;
- //GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (dvd_demux);
+ GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (dvd_demux);
GST_INFO ("Resetting the dvd demuxer");
for (i = 0; i < GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS; i++) {
dvd_demux->cur_subpicture_nr = 0;
dvd_demux->mpeg_version = 0;
-#if 0
/* Reset max_gap handling */
- mpeg_demux->max_gap = GST_CLOCK_TIME_NONE;
- mpeg_demux->max_gap_tolerance = GST_CLOCK_TIME_NONE;
-#endif
+ mpeg_demux->max_gap = 0.5 * GST_SECOND;
+ mpeg_demux->max_gap_tolerance = 0.05 * GST_SECOND;
}
static void
GstMPEGStream * stream, GstClockTime last_ts)
{
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_demux);
-
-#if 0
- GstClockTime start_ts;
- GstEvent *filler = NULL;
- GstFormat fmt = GST_FORMAT_TIME;
-#endif
- GstPad *outpad = NULL;
- gint cur_nr = 0;
+ GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
+ GstPad *outpad;
+ gint cur_nr;
parent_class->sync_stream_to_time (mpeg_demux, stream, last_ts);
outpad = dvd_demux->cur_subpicture;
cur_nr = dvd_demux->cur_subpicture_nr;
break;
+ default:
+ return;
}
-#if 0
- /* FIXME: fillers in 0.9 aren't specified properly yet */
- if ((outpad != NULL) && (cur_nr == stream->number)) {
- if (GST_PAD_PEER (stream->pad)
- && 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);
- }
+ if (outpad && (cur_nr == stream->number)) {
+ gst_pad_push_event (outpad, gst_event_new_new_segment (TRUE,
+ mpeg_parse->current_segment.rate, GST_FORMAT_TIME,
+ last_ts, -1, last_ts));
}
-#endif
}
static GstStateChangeReturn
if (timestamp != GST_CLOCK_TIME_NONE) {
outstream->cur_ts = timestamp;
- outstream->scr_offs = GST_CLOCK_DIFF (timestamp,
- PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse,
- mpeg_parse->current_ts));
- if (outstream->scr_offs < 0)
+ if (timestamp > mpeg_parse->current_ts)
+ outstream->scr_offs = timestamp - mpeg_parse->current_ts;
+ else
outstream->scr_offs = 0;
if (mpeg_demux->index != NULL) {
GST_FORMAT_BYTES,
GST_BUFFER_OFFSET (buffer), GST_FORMAT_TIME, timestamp, 0);
}
- } else {
- outstream->cur_ts = PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse,
- mpeg_parse->current_ts + outstream->scr_offs);
- }
+ } else
+ outstream->cur_ts = mpeg_parse->current_ts + outstream->scr_offs;
if (size == 0)
return GST_FLOW_OK;
if (GST_CLOCK_TIME_IS_VALID (mpeg_demux->max_gap) &&
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)) {
- GstClockTime threshold =
- GST_CLOCK_DIFF (PARSE_CLASS (mpeg_parse)->adjust_ts (mpeg_parse,
- 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);
+ (mpeg_parse->current_ts > mpeg_demux->max_gap)) {
+ CLASS (mpeg_demux)->synchronise_pads (mpeg_demux,
+ mpeg_parse->current_ts - mpeg_demux->max_gap,
+ mpeg_parse->current_ts - mpeg_demux->max_gap_tolerance);
}
return ret;
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;
}
}
-/* 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
- * 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.
+/*
+ * Send a new-segment event on the indicated pad to catch it up to last_ts.
*/
static void
gst_mpeg_demux_sync_stream_to_time (GstMPEGDemux * mpeg_demux,
GstMPEGStream * stream, GstClockTime last_ts)
{
- static gboolean beenhere; /* FALSE */
-
- if (!beenhere) {
- g_message ("FIXME: gst_mpeg_demux_sync_stream_to_time\n");
- beenhere = TRUE;
- }
-#if 0
- GstClockTime start_ts;
- GstEvent *filler = NULL;
- GstFormat fmt = GST_FORMAT_TIME;
-
- if (!GST_PAD_PEER (stream->pad)
- || !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));
- }
+ GstMPEGParse *mpeg_parse = GST_MPEG_PARSE (mpeg_demux);
- 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, gst_event_new_new_segment (TRUE,
+ mpeg_parse->current_segment.rate, GST_FORMAT_TIME,
+ last_ts, -1, last_ts));
- gst_pad_push_event (stream->pad, filler);
- }
-#endif
+ mpeg_parse->current_segment.start = last_ts;
}
#if 0