changeset 5254:83cc2a571542 libavformat

Return any error return values from av_get_packet, get_buffer etc. unchanged in the raw demuxers. Also remove special handling of 0-size reads, if they are due to an error/eof, these are already converted to the appropriate error by get_buffer.
author reimar
date Fri, 02 Oct 2009 06:40:50 +0000
parents a2289b41a9f2
children 6a23d76cc72c
files raw.c
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/raw.c	Fri Oct 02 06:36:39 2009 +0000
+++ b/raw.c	Fri Oct 02 06:40:50 2009 +0000
@@ -120,9 +120,8 @@
     ret= av_get_packet(s->pb, pkt, size);
 
     pkt->stream_index = 0;
-    if (ret <= 0) {
-        return AVERROR(EIO);
-    }
+    if (ret < 0)
+        return ret;
 
     bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id);
     assert(bps); // if false there IS a bug elsewhere (NOT in this function)
@@ -144,9 +143,9 @@
     pkt->pos= url_ftell(s->pb);
     pkt->stream_index = 0;
     ret = get_partial_buffer(s->pb, pkt->data, size);
-    if (ret <= 0) {
+    if (ret < 0) {
         av_free_packet(pkt);
-        return AVERROR(EIO);
+        return ret;
     }
     pkt->size = ret;
     return ret;
@@ -171,8 +170,8 @@
     pkt->dts= pkt->pos / packet_size;
 
     pkt->stream_index = 0;
-    if (ret <= 0)
-        return AVERROR(EIO);
+    if (ret < 0)
+        return ret;
     return 0;
 }
 #endif
@@ -206,9 +205,9 @@
     pkt->pos = url_ftell(s->pb);
     pkt->stream_index = 0;
     ret = get_buffer(s->pb, pkt->data, size);
-    if (ret <= 0) {
+    if (ret < 0) {
         av_free_packet(pkt);
-        return AVERROR(EIO);
+        return ret;
     }
     pkt->size = ret;
     return ret;