support forward seeking in non seekable streams

Originally committed as revision 6340 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2006-09-26 17:09:03 +00:00
parent 3b9a913db4
commit 398f5d3f1d

View File

@ -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) {