diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-03-24 22:07:54 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-03-24 22:07:54 +0000 |
commit | 3e2b6358e0c9744aee2a024c2be8e51e8900b0b1 (patch) | |
tree | 8964475711d5e56e482d21aec82ef0355ae464ca /libavformat | |
parent | d46db490b1ee887be0804572e6598291bb3fa47d (diff) | |
download | ffmpeg-3e2b6358e0c9744aee2a024c2be8e51e8900b0b1.tar.gz |
bypass internal buffer for "large" packets
Originally committed as revision 4080 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/aviobuf.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 7db4f15515..6eab0e18f3 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -333,10 +333,28 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size) if (len > size) len = size; if (len == 0) { - fill_buffer(s); - len = s->buf_end - s->buf_ptr; - if (len == 0) - break; + if(size > s->buffer_size && !s->update_checksum){ + len = s->read_packet(s->opaque, buf, size); + if (len <= 0) { + /* do not modify buffer if EOF reached so that a seek back can + be done without rereading data */ + s->eof_reached = 1; + if(len<0) + s->error= len; + break; + } else { + s->pos += len; + size -= len; + buf += len; + s->buf_ptr = s->buffer; + s->buf_end = s->buffer/* + len*/; + } + }else{ + fill_buffer(s); + len = s->buf_end - s->buf_ptr; + if (len == 0) + break; + } } else { memcpy(buf, s->buf_ptr, len); buf += len; |