changeset 5253:a2289b41a9f2 libavformat

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).
author reimar
date Fri, 02 Oct 2009 06:36:39 +0000
parents ae691877fdea
children 83cc2a571542
files aviobuf.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/aviobuf.c	Thu Oct 01 21:15:36 2009 +0000
+++ b/aviobuf.c	Fri Oct 02 06:36:39 2009 +0000
@@ -415,6 +415,10 @@
             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 @@
         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;
 }