From 08c4bd4168dc08da1e1fadb90f2d9b8370d4f1fa Mon Sep 17 00:00:00 2001 From: Fabrizio Gennari Date: Mon, 27 Mar 2006 10:39:03 +0000 Subject: [PATCH] gst/asfdemux/gstasfdemux.*: Subtract first timestamp from timestamps, so that stream starts from 0; makes live stream... Original commit message from CVS: Patch by: Fabrizio Gennari * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_setup_pad), (gst_asf_demux_process_chunk): * gst/asfdemux/gstasfdemux.h: Subtract first timestamp from timestamps, so that stream starts from 0; makes live streams that don't start at 0 work again (fixes #317310, #336097). --- ChangeLog | 11 +++++++++++ gst/asfdemux/gstasfdemux.c | 9 +++++++-- gst/asfdemux/gstasfdemux.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d0ed44446b..84e54b6307 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-03-27 Tim-Philipp Müller + + Patch by: Fabrizio Gennari + + * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_setup_pad), + (gst_asf_demux_process_chunk): + * gst/asfdemux/gstasfdemux.h: + Subtract first timestamp from timestamps, so that + stream starts from 0; makes live streams that don't + start at 0 work again (fixes #317310, #336097). + 2006-03-27 Tim-Philipp Müller Patch by: Christian Kirbach diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index dbbaa329a1..108d5be2ca 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -828,6 +828,7 @@ gst_asf_demux_setup_pad (GstASFDemux * demux, GstPad * src_pad, stream->frag_offset = 0; stream->sequence = 0; stream->delay = 0; + stream->first_pts = GST_CLOCK_TIME_NONE; stream->last_pts = GST_CLOCK_TIME_NONE; stream->fps_known = !is_video; /* bit hacky for audio */ stream->is_video = is_video; @@ -1812,7 +1813,10 @@ gst_asf_demux_process_chunk (GstASFDemux * demux, if (segment_info->frag_offset == 0) { /* new packet */ stream->sequence = segment_info->sequence; - demux->pts = segment_info->frag_timestamp - demux->preroll; + if (!GST_CLOCK_TIME_IS_VALID (stream->first_pts)) + stream->first_pts = segment_info->frag_timestamp - demux->preroll; + demux->pts = + segment_info->frag_timestamp - demux->preroll - stream->first_pts; /* if (stream->is_video) { @@ -1871,7 +1875,8 @@ gst_asf_demux_process_chunk (GstASFDemux * demux, #endif stream->frag_offset = 0; } - demux->pts = segment_info->frag_timestamp - demux->preroll; + demux->pts = + segment_info->frag_timestamp - demux->preroll - stream->first_pts; /* if (stream->is_video) { diff --git a/gst/asfdemux/gstasfdemux.h b/gst/asfdemux/gstasfdemux.h index 406d613bbd..b9eeca9d3c 100644 --- a/gst/asfdemux/gstasfdemux.h +++ b/gst/asfdemux/gstasfdemux.h @@ -47,6 +47,7 @@ typedef struct guint32 frag_offset; guint32 sequence; guint64 delay; + guint64 first_pts; guint64 last_pts; GstBuffer *payload;