diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2005-01-29 12:55:18 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2005-01-29 12:55:18 +0000 |
commit | 698554fdf16a54c4a467b4456b44b012dfb5acea (patch) | |
tree | c102d1a5b7d01e67bcc047aa785a8677733c74ef | |
parent | 6246084f650ce031ea53165775f35f5cdd8d52e2 (diff) | |
download | gst-plugins-bad-698554fdf16a54c4a467b4456b44b012dfb5acea.tar.gz gst-plugins-bad-698554fdf16a54c4a467b4456b44b012dfb5acea.tar.bz2 gst-plugins-bad-698554fdf16a54c4a467b4456b44b012dfb5acea.zip |
gst/qtdemux/qtdemux.c: Re-apply patch from #142272 that allows non-seekable sources,
Original commit message from CVS:
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/qtdemux/qtdemux.c: (gst_qtdemux_change_state),
(gst_qtdemux_loop_header):
Re-apply patch from #142272 that allows non-seekable sources,
re-proposed by Daniel Drake <dsd@gentoo.org>.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gst/qtdemux/qtdemux.c | 40 |
2 files changed, 37 insertions, 12 deletions
@@ -1,3 +1,12 @@ +2005-01-29 David Moore <dcm@acm.org> + + Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> + + * gst/qtdemux/qtdemux.c: (gst_qtdemux_change_state), + (gst_qtdemux_loop_header): + Re-apply patch from #142272 that allows non-seekable sources, + re-proposed by Daniel Drake <dsd@gentoo.org>. + 2005-01-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net> * gst/rtp/gstrtpgsmenc.c: (gst_rtpgsmenc_init): diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index c565e285..b9ea73fe 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -516,10 +516,11 @@ gst_qtdemux_change_state (GstElement * element) 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"); + break; + case GST_STATE_READY_TO_PAUSED: break; case GST_STATE_PAUSED_TO_PLAYING: break; @@ -531,7 +532,6 @@ gst_qtdemux_change_state (GstElement * element) qtdemux->last_ts = GST_CLOCK_TIME_NONE; qtdemux->need_discont = FALSE; qtdemux->need_flush = FALSE; - gst_bytestream_destroy (qtdemux->bs); if (qtdemux->tag_list) { gst_tag_list_free (qtdemux->tag_list); qtdemux->tag_list = NULL; @@ -546,6 +546,7 @@ gst_qtdemux_change_state (GstElement * element) break; } case GST_STATE_READY_TO_NULL: + gst_bytestream_destroy (qtdemux->bs); break; default: break; @@ -633,6 +634,7 @@ gst_qtdemux_loop_header (GstElement * element) break; } } while (1); + qtdemux->offset += length; qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length); if (1) { @@ -654,11 +656,18 @@ gst_qtdemux_loop_header (GstElement * element) } ret = gst_bytestream_seek (qtdemux->bs, cur_offset + length, GST_SEEK_METHOD_SET); - if (!ret) { - g_warning ("seek failed"); + 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; - GST_DEBUG ("seek returned %d", ret); break; } case QTDEMUX_STATE_SEEKING_EOS: @@ -707,8 +716,8 @@ gst_qtdemux_loop_header (GstElement * element) GST_DATA (gst_event_new (GST_EVENT_EOS))); } ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END); - if (!ret) { - g_warning ("seek failed"); + if (ret == FALSE) { + gst_bytestream_flush (qtdemux->bs, 0xffffffff); } GST_DEBUG ("seek returned %d", ret); @@ -728,16 +737,22 @@ gst_qtdemux_loop_header (GstElement * element) /* don't believe bytestream */ //cur_offset = gst_bytestream_tell (qtdemux->bs); + cur_offset = qtdemux->offset; if (offset != cur_offset) { GST_DEBUG ("seeking to offset %d (currently at %d)", offset, cur_offset); ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET); - if (!ret) { - g_warning ("seek failed"); - } - qtdemux->offset = offset; GST_DEBUG ("seek returned %d", ret); + 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; return; } @@ -754,6 +769,7 @@ gst_qtdemux_loop_header (GstElement * element) break; } } while (TRUE); + qtdemux->offset += size; if (buf) { /* hum... FIXME changing framerate breaks horribly, better set |