gst/asfdemux/: Make all timestamps start from zero in pull-mode too; some small clean-ups and FIXMEs here and there.

Original commit message from CVS:
* gst/asfdemux/asfpacket.c: (gst_asf_payload_queue_for_stream):
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_reset),
(gst_asf_demux_init), (gst_asf_demux_push_complete_payloads),
(gst_asf_demux_process_file):
* gst/asfdemux/gstasfdemux.h:
Make all timestamps start from zero in pull-mode too; some small
clean-ups and FIXMEs here and there.
This commit is contained in:
Tim-Philipp Müller 2007-05-04 11:04:16 +00:00
parent c2784b4ca8
commit f7abd8bbc8
4 changed files with 41 additions and 12 deletions

View file

@ -1,3 +1,13 @@
2007-05-04 Tim-Philipp Müller <tim at centricular dot net>
* gst/asfdemux/asfpacket.c: (gst_asf_payload_queue_for_stream):
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_reset),
(gst_asf_demux_init), (gst_asf_demux_push_complete_payloads),
(gst_asf_demux_process_file):
* gst/asfdemux/gstasfdemux.h:
Make all timestamps start from zero in pull-mode too; some small
clean-ups and FIXMEs here and there.
2007-05-01 Tim-Philipp Müller <tim at centricular dot net>
* gst/asfdemux/asfpacket.c: (gst_asf_demux_parse_payload),

View file

@ -121,6 +121,27 @@ static void
gst_asf_payload_queue_for_stream (GstASFDemux * demux, AsfPayload * payload,
AsfStream * stream)
{
/* remember the first timestamp in the stream */
if (!GST_CLOCK_TIME_IS_VALID (demux->first_ts) &&
GST_CLOCK_TIME_IS_VALID (payload->ts)) {
GST_DEBUG_OBJECT (demux, "first ts: %" GST_TIME_FORMAT,
GST_TIME_ARGS (payload->ts));
demux->first_ts = payload->ts;
}
/* better drop a few frames at the beginning than send bogus timestamps */
if (G_UNLIKELY (payload->ts < demux->first_ts)) {
GST_LOG_OBJECT (stream->pad, "Dropping payload with timestamp %"
GST_TIME_FORMAT " which is before the first timestamp %"
GST_TIME_FORMAT, GST_TIME_ARGS (payload->ts),
GST_TIME_ARGS (demux->first_ts));
gst_buffer_replace (&payload->buf, NULL);
return;
}
/* make timestamps start from 0 */
payload->ts -= demux->first_ts;
/* remove any incomplete payloads that will never be completed */
while (stream->payloads->len > 0) {
AsfPayload *prev;

View file

@ -205,6 +205,7 @@ gst_asf_demux_reset (GstASFDemux * demux)
demux->num_audio_streams = 0;
demux->num_video_streams = 0;
demux->num_streams = 0;
demux->first_ts = GST_CLOCK_TIME_NONE;
demux->state = GST_ASF_DEMUX_STATE_HEADER;
demux->seekable = FALSE;
demux->broadcast = FALSE;
@ -237,6 +238,7 @@ gst_asf_demux_init (GstASFDemux * demux, GstASFDemuxClass * klass)
demux->num_streams = 0;
demux->taglist = NULL;
demux->first_ts = GST_CLOCK_TIME_NONE;
demux->state = GST_ASF_DEMUX_STATE_HEADER;
}
@ -1033,12 +1035,6 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux)
GST_BUFFER_DURATION (payload->buf) = payload->duration;
/* FIXME: we should really set durations on buffers if we can */
/* (this is a hack, obviously)
if (strncmp (GST_PAD_NAME (stream->pad), "video", 5) == 0 &&
!GST_BUFFER_DURATION_IS_VALID (payload->buf)) {
GST_BUFFER_DURATION (payload->buf) = GST_SECOND / 30;
}
*/
GST_LOG_OBJECT (stream->pad, "pushing buffer, ts=%" GST_TIME_FORMAT
", dur=%" GST_TIME_FORMAT " size=%u",
@ -2047,14 +2043,14 @@ gst_asf_demux_process_file (GstASFDemux * demux, guint8 * data, guint64 size)
else
demux->play_time = 0;
demux->preroll = preroll;
demux->preroll = preroll; /* FIXME: make GstClockTime */
if (demux->play_time == 0)
demux->seekable = FALSE;
GST_DEBUG_OBJECT (demux,
"play_time %" GST_TIME_FORMAT " preroll %" GST_TIME_FORMAT,
GST_TIME_ARGS (demux->play_time),
GST_DEBUG_OBJECT (demux, "play_time %" GST_TIME_FORMAT,
GST_TIME_ARGS (demux->play_time));
GST_DEBUG_OBJECT (demux, "preroll %" GST_TIME_FORMAT,
GST_TIME_ARGS (demux->preroll * GST_MSECOND));
if (demux->play_time > 0) {

View file

@ -87,7 +87,7 @@ typedef struct
guint32 sequence;
guint64 delay;
guint64 first_pts;
guint64 last_pts;
guint64 last_pts; /* FIXME: remove, not actually evaluated */
GstBuffer *payload;
/* video-only */
@ -150,11 +150,13 @@ struct _GstASFDemux {
guint32 num_streams;
AsfStream stream[GST_ASF_DEMUX_NUM_STREAMS];
GstClockTime first_ts; /* first timestamp found */
guint32 packet_size;
guint32 timestamp; /* in milliseconds */
guint64 play_time;
guint64 preroll;
guint64 preroll; /* FIXME: make into GstClockTime */
guint64 pts;
gboolean seekable;