mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
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>.
This commit is contained in:
parent
698037c1f6
commit
0e5276ed14
2 changed files with 37 additions and 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>
|
2005-01-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* gst/rtp/gstrtpgsmenc.c: (gst_rtpgsmenc_init):
|
* gst/rtp/gstrtpgsmenc.c: (gst_rtpgsmenc_init):
|
||||||
|
|
|
@ -516,10 +516,11 @@ gst_qtdemux_change_state (GstElement * element)
|
||||||
|
|
||||||
switch (GST_STATE_TRANSITION (element)) {
|
switch (GST_STATE_TRANSITION (element)) {
|
||||||
case GST_STATE_NULL_TO_READY:
|
case GST_STATE_NULL_TO_READY:
|
||||||
break;
|
|
||||||
case GST_STATE_READY_TO_PAUSED:
|
|
||||||
qtdemux->bs = gst_bytestream_new (qtdemux->sinkpad);
|
qtdemux->bs = gst_bytestream_new (qtdemux->sinkpad);
|
||||||
qtdemux->state = QTDEMUX_STATE_HEADER;
|
qtdemux->state = QTDEMUX_STATE_HEADER;
|
||||||
|
GST_DEBUG ("new bytestream");
|
||||||
|
break;
|
||||||
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
|
@ -531,7 +532,6 @@ gst_qtdemux_change_state (GstElement * element)
|
||||||
qtdemux->last_ts = GST_CLOCK_TIME_NONE;
|
qtdemux->last_ts = GST_CLOCK_TIME_NONE;
|
||||||
qtdemux->need_discont = FALSE;
|
qtdemux->need_discont = FALSE;
|
||||||
qtdemux->need_flush = FALSE;
|
qtdemux->need_flush = FALSE;
|
||||||
gst_bytestream_destroy (qtdemux->bs);
|
|
||||||
if (qtdemux->tag_list) {
|
if (qtdemux->tag_list) {
|
||||||
gst_tag_list_free (qtdemux->tag_list);
|
gst_tag_list_free (qtdemux->tag_list);
|
||||||
qtdemux->tag_list = NULL;
|
qtdemux->tag_list = NULL;
|
||||||
|
@ -546,6 +546,7 @@ gst_qtdemux_change_state (GstElement * element)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_STATE_READY_TO_NULL:
|
case GST_STATE_READY_TO_NULL:
|
||||||
|
gst_bytestream_destroy (qtdemux->bs);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -633,6 +634,7 @@ gst_qtdemux_loop_header (GstElement * element)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
qtdemux->offset += length;
|
||||||
|
|
||||||
qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length);
|
qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length);
|
||||||
if (1) {
|
if (1) {
|
||||||
|
@ -654,11 +656,18 @@ gst_qtdemux_loop_header (GstElement * element)
|
||||||
}
|
}
|
||||||
ret = gst_bytestream_seek (qtdemux->bs, cur_offset + length,
|
ret = gst_bytestream_seek (qtdemux->bs, cur_offset + length,
|
||||||
GST_SEEK_METHOD_SET);
|
GST_SEEK_METHOD_SET);
|
||||||
if (!ret) {
|
GST_DEBUG ("seek returned %d", ret);
|
||||||
g_warning ("seek failed");
|
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;
|
qtdemux->offset = cur_offset + length;
|
||||||
GST_DEBUG ("seek returned %d", ret);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QTDEMUX_STATE_SEEKING_EOS:
|
case QTDEMUX_STATE_SEEKING_EOS:
|
||||||
|
@ -707,8 +716,8 @@ gst_qtdemux_loop_header (GstElement * element)
|
||||||
GST_DATA (gst_event_new (GST_EVENT_EOS)));
|
GST_DATA (gst_event_new (GST_EVENT_EOS)));
|
||||||
}
|
}
|
||||||
ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END);
|
ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END);
|
||||||
if (!ret) {
|
if (ret == FALSE) {
|
||||||
g_warning ("seek failed");
|
gst_bytestream_flush (qtdemux->bs, 0xffffffff);
|
||||||
}
|
}
|
||||||
GST_DEBUG ("seek returned %d", ret);
|
GST_DEBUG ("seek returned %d", ret);
|
||||||
|
|
||||||
|
@ -728,16 +737,22 @@ gst_qtdemux_loop_header (GstElement * element)
|
||||||
|
|
||||||
/* don't believe bytestream */
|
/* don't believe bytestream */
|
||||||
//cur_offset = gst_bytestream_tell (qtdemux->bs);
|
//cur_offset = gst_bytestream_tell (qtdemux->bs);
|
||||||
|
cur_offset = qtdemux->offset;
|
||||||
|
|
||||||
if (offset != cur_offset) {
|
if (offset != cur_offset) {
|
||||||
GST_DEBUG ("seeking to offset %d (currently at %d)", offset,
|
GST_DEBUG ("seeking to offset %d (currently at %d)", offset,
|
||||||
cur_offset);
|
cur_offset);
|
||||||
ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET);
|
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);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,6 +769,7 @@ gst_qtdemux_loop_header (GstElement * element)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (TRUE);
|
} while (TRUE);
|
||||||
|
qtdemux->offset += size;
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
/* hum... FIXME changing framerate breaks horribly, better set
|
/* hum... FIXME changing framerate breaks horribly, better set
|
||||||
|
|
Loading…
Reference in a new issue