summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-04 13:01:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-04 13:01:54 +0100
commite1cf1a9c89dbb3b867c50421cf543221a4d223f9 (patch)
treeacbed33573df63b7d86f785bb44d875326f59420 /libavformat/aviobuf.c
parentd0b450457b3aeb8c234b0b0a987db55d3485326b (diff)
parenta0b7e289075dccf223b7f407790d8a86fc5d77e8 (diff)
Merge commit 'a0b7e289075dccf223b7f407790d8a86fc5d77e8'
* commit 'a0b7e289075dccf223b7f407790d8a86fc5d77e8': aviobuf: Partial support for reading in read/write contexts build: Avoid detecting bogus components named 'x' Conflicts: libavcodec/allcodecs.c libavdevice/alldevices.c libavformat/allformats.c libavformat/aviobuf.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 6733b59dab..95a41bbbc6 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -483,7 +483,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
len = s->buf_end - s->buf_ptr;
if (len > size)
len = size;
- if (len == 0) {
+ if (len == 0 || s->write_flag) {
if((s->direct || size > s->buffer_size) && !s->update_checksum){
if(s->read_packet)
len = s->read_packet(s->opaque, buf, size);
@@ -529,6 +529,13 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
if (size < 0)
return -1;
+ if (s->read_packet && s->write_flag) {
+ len = s->read_packet(s->opaque, buf, size);
+ if (len > 0)
+ s->pos += len;
+ return len;
+ }
+
len = s->buf_end - s->buf_ptr;
if (len == 0) {
fill_buffer(s);