summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-09-26 17:09:03 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-09-26 17:09:03 +0000
commit398f5d3f1db27393d1b03ad7dd26cb1d82b9448b (patch)
tree0362336d629c0f20b979cbbb3685a34878d68d32 /libavformat/aviobuf.c
parent3b9a913db4d303a0305a80de496b1933cba8980f (diff)
support forward seeking in non seekable streams
Originally committed as revision 6340 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index ef72c195c1..dced0d2df9 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -22,6 +22,8 @@
#define IO_BUFFER_SIZE 32768
+static void fill_buffer(ByteIOContext *s);
+
int init_put_byte(ByteIOContext *s,
unsigned char *buffer,
int buffer_size,
@@ -122,6 +124,11 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
offset1 >= 0 && offset1 < (s->buf_end - s->buffer)) {
/* can do the seek inside the buffer */
s->buf_ptr = s->buffer + offset1;
+ } else if(s->is_streamed && !s->write_flag &&
+ offset1 >= 0 && offset1 < (s->buf_end - s->buffer) + (1<<16)){
+ while(s->pos < offset && !s->eof_reached)
+ fill_buffer(s);
+ s->buf_ptr = s->buf_end + offset - s->pos;
} else {
#ifdef CONFIG_MUXERS
if (s->write_flag) {