[FFmpeg-cvslog] asvdec: return meaningful error codes.

Anton Khirnov git at videolan.org
Sun Jan 6 23:55:15 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Nov 14 14:59:40 2012 +0100| [38de3365ca7e1e35fba87b8e0e119fdccc629669] | committer: Anton Khirnov

asvdec: return meaningful error codes.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38de3365ca7e1e35fba87b8e0e119fdccc629669
---

 libavcodec/asvdec.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index 16722a9..f36fa7f 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -111,7 +111,7 @@ static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64])
                 break;
             if (ccp < 0 || i >= 10) {
                 av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n");
-                return -1;
+                return AVERROR_INVALIDDATA;
             }
 
             if (ccp & 8)
@@ -213,15 +213,15 @@ static int decode_frame(AVCodecContext *avctx,
     int buf_size          = avpkt->size;
     AVFrame *picture      = data;
     AVFrame * const p     = &a->picture;
-    int mb_x, mb_y;
+    int mb_x, mb_y, ret;
 
     if (p->data[0])
         avctx->release_buffer(avctx, p);
 
     p->reference = 0;
-    if (ff_get_buffer(avctx, p) < 0) {
+    if ((ret = ff_get_buffer(avctx, p)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
+        return ret;
     }
     p->pict_type = AV_PICTURE_TYPE_I;
     p->key_frame = 1;
@@ -243,8 +243,8 @@ static int decode_frame(AVCodecContext *avctx,
 
     for (mb_y = 0; mb_y < a->mb_height2; mb_y++) {
         for (mb_x = 0; mb_x < a->mb_width2; mb_x++) {
-            if (decode_mb(a, a->block) < 0)
-                return -1;
+            if ((ret = decode_mb(a, a->block)) < 0)
+                return ret;
 
             idct_put(a, mb_x, mb_y);
         }
@@ -253,8 +253,8 @@ static int decode_frame(AVCodecContext *avctx,
     if (a->mb_width2 != a->mb_width) {
         mb_x = a->mb_width2;
         for (mb_y = 0; mb_y < a->mb_height2; mb_y++) {
-            if (decode_mb(a, a->block) < 0)
-                return -1;
+            if ((ret = decode_mb(a, a->block)) < 0)
+                return ret;
 
             idct_put(a, mb_x, mb_y);
         }
@@ -263,8 +263,8 @@ static int decode_frame(AVCodecContext *avctx,
     if (a->mb_height2 != a->mb_height) {
         mb_y = a->mb_height2;
         for (mb_x = 0; mb_x < a->mb_width; mb_x++) {
-            if (decode_mb(a, a->block) < 0)
-                return -1;
+            if ((ret = decode_mb(a, a->block)) < 0)
+                return ret;
 
             idct_put(a, mb_x, mb_y);
         }



More information about the ffmpeg-cvslog mailing list