gst/matroska/matroska-demux.c: Advance stream time for lagging subtitle streams by sending newsegment events with the...

Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_sync_streams):
Advance stream time for lagging subtitle streams by sending
newsegment events with the update flag set.
This commit is contained in:
Tim-Philipp Müller 2006-02-14 23:23:08 +00:00
parent 45dd1af710
commit 7e62fb832c
2 changed files with 19 additions and 28 deletions

View file

@ -1,3 +1,9 @@
2006-02-14 Tim-Philipp Müller <tim at centricular dot net>
* gst/matroska/matroska-demux.c: (gst_matroska_demux_sync_streams):
Advance stream time for lagging subtitle streams by sending
newsegment events with the update flag set.
2006-02-14 Edward Hervey <edward@fluendo.com> 2006-02-14 Edward Hervey <edward@fluendo.com>
* gst/avi/gstavidemux.c: (gst_avi_demux_stream_header): * gst/avi/gstavidemux.c: (gst_avi_demux_stream_header):

View file

@ -1933,49 +1933,34 @@ gst_matroska_ebmlnum_sint (guint8 * data, guint size, gint64 * num)
static void static void
gst_matroska_demux_sync_streams (GstMatroskaDemux * demux) gst_matroska_demux_sync_streams (GstMatroskaDemux * demux)
{ {
/* FIXME: add filler events or buffers back */
#if 0
gint stream_nr; gint stream_nr;
GstMatroskaTrackContext *context;
GST_DEBUG ("Sync to %" GST_TIME_FORMAT, GST_TIME_ARGS (demux->pos)); GST_LOG ("Sync to %" GST_TIME_FORMAT, GST_TIME_ARGS (demux->pos));
for (stream_nr = 0; stream_nr < demux->num_streams; stream_nr++) { for (stream_nr = 0; stream_nr < demux->num_streams; stream_nr++) {
GstMatroskaTrackContext *context;
context = demux->src[stream_nr]; context = demux->src[stream_nr];
if (context->type != GST_MATROSKA_TRACK_TYPE_SUBTITLE) if (context->type != GST_MATROSKA_TRACK_TYPE_SUBTITLE)
continue; continue;
GST_DEBUG ("Checking for resync on stream %d (%" GST_TIME_FORMAT ")",
GST_LOG ("Checking for resync on stream %d (%" GST_TIME_FORMAT ")",
stream_nr, GST_TIME_ARGS (context->pos)); stream_nr, GST_TIME_ARGS (context->pos));
/* does it lag? 1 second is a random treshold... */ /* does it lag? 0.5 seconds is a random treshold... */
if (context->pos + (GST_SECOND / 2) < demux->pos) { if (context->pos + (GST_SECOND / 2) < demux->pos) {
GstEvent *event; GST_DEBUG ("Synchronizing stream %d with others by advancing time "
static gboolean showed_msg = FALSE; /* FIXME */ "from %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT, stream_nr,
GST_TIME_ARGS (context->pos), GST_TIME_ARGS (demux->pos));
event = gst_event_new_filler ();
/* FIXME: fillers in 0.9 aren't specified properly yet
event = gst_event_new_filler_stamped (context->pos,
demux->pos - context->pos); */
if (!showed_msg) {
g_message ("%s: fix filler stuff when spec'ed out in core", G_STRLOC);
showed_msg = TRUE;
}
context->pos = demux->pos; context->pos = demux->pos;
/* sync */ /* advance stream time */
GST_DEBUG ("Synchronizing stream %d with others by sending filler " gst_pad_push_event (context->pad,
"at time %" GST_TIME_FORMAT " and duration %" GST_TIME_FORMAT gst_event_new_new_segment (TRUE, demux->segment_rate,
" to time %" GST_TIME_FORMAT, stream_nr, GST_FORMAT_TIME, demux->pos, -1, demux->pos));
GST_TIME_ARGS (context->pos),
GST_TIME_ARGS (demux->pos - context->pos),
GST_TIME_ARGS (demux->pos));
gst_pad_push_event (context->pad, event);
} }
} }
#endif
} }
static gboolean static gboolean