|
From: David S. <ds...@pd...> - 2004-05-19 06:23:52
|
CVS Root: /home/cvs/gstreamer
Module: gst-plugins
Changes by: ds
Date: Tue May 18 2004 23:23:50 PDT
Log message:
* gst/qtdemux/qtdemux.c: (gst_qtdemux_change_state),
(gst_qtdemux_loop_header): Patch from dc...@ac... (David Moore)
to allow qtdemux to use non-seekable streams. (bug #142272)
Modified files:
. : ChangeLog
gst/qtdemux : qtdemux.c
Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.681&r2=1.682
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/qtdemux/qtdemux.c.diff?r1=1.59&r2=1.60
====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /home/cvs/gstreamer/gst-plugins/ChangeLog,v
retrieving revision 1.681
retrieving revision 1.682
diff -u -d -r1.681 -r1.682
--- a/ChangeLog 19 May 2004 06:14:05 -0000 1.681
+++ b/ChangeLog 19 May 2004 06:23:37 -0000 1.682
@@ -1,5 +1,11 @@
2004-05-18 David Schleef <ds...@sc...>
+ * gst/qtdemux/qtdemux.c: (gst_qtdemux_change_state),
+ (gst_qtdemux_loop_header): Patch from dc...@ac... (David Moore)
+ to allow qtdemux to use non-seekable streams. (bug #142272)
+
+2004-05-18 David Schleef <ds...@sc...>
* gst-libs/gst/resample/resample.c: (gst_resample_sinc_ft_s16),
(gst_resample_sinc_ft_float): Remove use of static temporary
buffer. This code was obviously not supposed to last long, but
Index: qtdemux.c
RCS file: /home/cvs/gstreamer/gst-plugins/gst/qtdemux/qtdemux.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- a/qtdemux.c 14 May 2004 19:26:35 -0000 1.59
+++ b/qtdemux.c 19 May 2004 06:23:38 -0000 1.60
@@ -478,20 +478,21 @@
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
- break;
- case GST_STATE_READY_TO_PAUSED:
qtdemux->bs = gst_bytestream_new (qtdemux->sinkpad);
qtdemux->state = QTDEMUX_STATE_HEADER;
+ GST_DEBUG ("new bytestream");
/* FIXME */
break;
+ case GST_STATE_READY_TO_PAUSED:
+ break;
case GST_STATE_PAUSED_TO_PLAYING:
case GST_STATE_PLAYING_TO_PAUSED:
case GST_STATE_PAUSED_TO_READY:
- gst_bytestream_destroy (qtdemux->bs);
case GST_STATE_READY_TO_NULL:
+ gst_bytestream_destroy (qtdemux->bs);
default:
@@ -579,6 +580,7 @@
break;
}
} while (1);
+ qtdemux->offset += length;
qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length);
if (1) {
@@ -597,8 +599,18 @@
}
ret = gst_bytestream_seek (qtdemux->bs, cur_offset + length,
GST_SEEK_METHOD_SET);
- qtdemux->offset = cur_offset + length;
GST_DEBUG ("seek returned %d", ret);
+ if (ret == FALSE) {
+ length = cur_offset + length;
+ cur_offset = qtdemux->offset;
+ length -= cur_offset;
+ if (gst_bytestream_flush (qtdemux->bs, length) == FALSE) {
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ }
+ }
+ qtdemux->offset = cur_offset + length;
}
case QTDEMUX_STATE_SEEKING_EOS:
@@ -648,6 +660,9 @@
}
ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END);
GST_DEBUG ("seek returned %d", ret);
+ if (ret == FALSE) {
+ gst_bytestream_flush (qtdemux->bs, 0xffffffff);
qtdemux->state = QTDEMUX_STATE_SEEKING_EOS;
return;
@@ -663,12 +678,22 @@
index, stream->sample_index, offset, size,
stream->samples[stream->sample_index].timestamp);
- cur_offset = gst_bytestream_tell (qtdemux->bs);
+ // cur_offset = gst_bytestream_tell (qtdemux->bs);
+ cur_offset = qtdemux->offset;
if (offset != cur_offset) {
GST_DEBUG ("seeking to offset %d", offset);
GST_LOG ("seeking to offset %d", offset);
ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET);
+ if (ret == FALSE && offset > cur_offset) {
+ if (gst_bytestream_flush (qtdemux->bs, offset - cur_offset) == FALSE) {
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ } else if (ret == FALSE && offset < cur_offset)
+ GST_ERROR ("cannot flush backwards");
+ qtdemux->offset = offset;
@@ -685,6 +710,7 @@
break;
} while (TRUE);
+ qtdemux->offset += size;
if (buf) {
/* hum... */
|