summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-10-02 06:36:39 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-10-02 06:36:39 +0000
commit7f7686dfb1c8a1fab7cdf2f867d46b04a3123399 (patch)
treef4c8eb1c57e08c7b9ec046f3552ae0376490195c /libavformat/aviobuf.c
parentde27f4d95726aed333e8ef78fdfbc0b4357130d8 (diff)
Make get_buffer and get_partial_buffer return url_ferror or AVERROR_EOF as
appropriate if it couldn't read any data at all. This should make handling of EOF and error simpler or make it work right without extra code in a few place (e.g. raw demuxer). Originally committed as revision 20135 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index f270139a9b..c670d48c98 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -415,6 +415,10 @@ int get_buffer(ByteIOContext *s, unsigned char *buf, int size)
size -= len;
}
}
+ if (size1 == size) {
+ if (url_ferror(s)) return url_ferror(s);
+ if (url_feof(s)) return AVERROR_EOF;
+ }
return size1 - size;
}
@@ -434,6 +438,10 @@ int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)
len = size;
memcpy(buf, s->buf_ptr, len);
s->buf_ptr += len;
+ if (!len) {
+ if (url_ferror(s)) return url_ferror(s);
+ if (url_feof(s)) return AVERROR_EOF;
+ }
return len;
}