resindvd: Fix segment handling in the demuxer.

Transfer the incoming segment base time to the src
segment the demuxer sends downstream. Add some
(disabled) debug to the bin for tracking outgoing
timestamps.
This commit is contained in:
Jan Schmidt 2012-09-17 23:59:34 +10:00
parent 14e220f600
commit c90cdadbe4
2 changed files with 62 additions and 9 deletions

View file

@ -920,7 +920,8 @@ gst_flups_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
GST_DEBUG_OBJECT (demux,
"demux: received new segment start %" G_GINT64_FORMAT " stop %"
G_GINT64_FORMAT " time %" G_GINT64_FORMAT, start, stop, time);
G_GINT64_FORMAT " time %" G_GINT64_FORMAT
" base %" G_GINT64_FORMAT, start, stop, time, base);
adjust = base - start + SCR_MUNGE;
start = base + SCR_MUNGE;
@ -937,20 +938,22 @@ gst_flups_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
stop = demux->src_segment.position;
}
GST_DEBUG_OBJECT (demux,
"sending new segment: rate %g format %d, start: %"
G_GINT64_FORMAT ", stop: %" G_GINT64_FORMAT ", time: %"
G_GINT64_FORMAT " scr_adjust: %" G_GINT64_FORMAT "(%" GST_TIME_FORMAT
")", segment->rate, segment->format, start, stop, time,
demux->scr_adjust,
GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (demux->scr_adjust)));
demux->src_segment.rate = segment->rate;
demux->src_segment.applied_rate = segment->applied_rate;
demux->src_segment.format = segment->format;
demux->src_segment.start = start;
demux->src_segment.stop = stop;
demux->src_segment.time = time;
demux->src_segment.base = base;
GST_DEBUG_OBJECT (demux,
"sending new segment: rate %g format %d, start: %"
G_GINT64_FORMAT ", stop: %" G_GINT64_FORMAT ", time: %"
G_GINT64_FORMAT ", base: %" G_GINT64_FORMAT
", scr_adjust: %" G_GINT64_FORMAT "(%" GST_TIME_FORMAT ")",
segment->rate, segment->format, start, stop, time, base,
demux->scr_adjust,
GST_TIME_ARGS (MPEGTIME_TO_GSTTIME (demux->scr_adjust)));
if (demux->in_still && stop != -1) {
/* Generate gap buffers, due to closing segment from a still-frame */

View file

@ -353,6 +353,49 @@ _pad_block_destroy_notify (RsnDvdBinPadBlockCtx * ctx)
g_slice_free (RsnDvdBinPadBlockCtx, ctx);
}
#if DEBUG_TIMING
static GstPadProbeReturn
dvdbin_dump_timing_info (GstPad * opad,
GstPadProbeInfo * info, gpointer userdata)
{
if (GST_PAD_PROBE_INFO_TYPE (info) & (GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM |
GST_PAD_PROBE_TYPE_EVENT_FLUSH)) {
GstEvent *event = GST_PAD_PROBE_INFO_EVENT (info);
if (GST_EVENT_TYPE (event) == GST_EVENT_SEGMENT) {
const GstSegment *seg;
gst_event_parse_segment (event, &seg);
g_print ("%s:%s segment: rate %g format %d, start: %"
GST_TIME_FORMAT ", stop: %" GST_TIME_FORMAT ", time: %"
GST_TIME_FORMAT " base: %" GST_TIME_FORMAT "\n",
GST_DEBUG_PAD_NAME (opad),
seg->rate, seg->format, GST_TIME_ARGS (seg->start),
GST_TIME_ARGS (seg->stop), GST_TIME_ARGS (seg->time),
GST_TIME_ARGS (seg->base));
} else if (GST_EVENT_TYPE (event) == GST_EVENT_GAP) {
GstClockTime ts, dur, end;
gst_event_parse_gap (event, &ts, &dur);
end = ts;
if (ts != GST_CLOCK_TIME_NONE && dur != GST_CLOCK_TIME_NONE)
end += dur;
g_print ("%s:%s Gap TS: %" GST_TIME_FORMAT " dur %" GST_TIME_FORMAT
" (to %" GST_TIME_FORMAT ")\n", GST_DEBUG_PAD_NAME (opad),
GST_TIME_ARGS (ts), GST_TIME_ARGS (dur), GST_TIME_ARGS (end));
} else if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP) {
g_print ("%s:%s FLUSHED\n", GST_DEBUG_PAD_NAME (opad));
}
}
if (GST_PAD_PROBE_INFO_TYPE (info) & GST_PAD_PROBE_TYPE_BUFFER) {
GstBuffer *buf = GST_PAD_PROBE_INFO_BUFFER (info);
g_print ("%s:%s Buffer PTS %" GST_TIME_FORMAT " duration %" GST_TIME_FORMAT
"\n", GST_DEBUG_PAD_NAME (opad), GST_TIME_ARGS (GST_BUFFER_PTS (buf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
}
return GST_PAD_PROBE_OK;
}
#endif
static gboolean
try_link_pieces (GstElement * e1, const gchar * pad1, GstElement * e2,
const gchar * pad2)
@ -466,6 +509,13 @@ create_elements (RsnDvdBin * dvdbin)
gst_object_unref (src);
src = NULL;
#if DEBUG_TIMING
gst_pad_add_probe (dvdbin->video_pad,
GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_BUFFER |
GST_PAD_PROBE_TYPE_EVENT_FLUSH,
(GstPadProbeCallback) dvdbin_dump_timing_info, NULL, NULL);
#endif
/* FIXME: Merge stream-selection logic to core and switch back */
if (!try_create_piece (dvdbin, DVD_ELEM_SPU_SELECT, NULL,
RSN_TYPE_INPUT_SELECTOR, "subpselect", "Subpicture stream selector"))