Browse code

v210dec: return meaningful error codes

Anton Khirnov authored on 2012/11/17 16:14:34
Showing 1 changed files
... ...
@@ -31,7 +31,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
31 31
 {
32 32
     if (avctx->width & 1) {
33 33
         av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
34
-        return -1;
34
+        return AVERROR_INVALIDDATA;
35 35
     }
36 36
     avctx->pix_fmt             = AV_PIX_FMT_YUV422P10;
37 37
     avctx->bits_per_raw_sample = 10;
... ...
@@ -46,7 +46,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
46 46
 static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
47 47
                         AVPacket *avpkt)
48 48
 {
49
-    int h, w;
49
+    int h, w, ret;
50 50
     AVFrame *pic = avctx->coded_frame;
51 51
     const uint8_t *psrc = avpkt->data;
52 52
     uint16_t *y, *u, *v;
... ...
@@ -58,12 +58,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
58 58
 
59 59
     if (avpkt->size < stride * avctx->height) {
60 60
         av_log(avctx, AV_LOG_ERROR, "packet too small\n");
61
-        return -1;
61
+        return AVERROR_INVALIDDATA;
62 62
     }
63 63
 
64 64
     pic->reference = 0;
65
-    if (ff_get_buffer(avctx, pic) < 0)
66
-        return -1;
65
+    if ((ret = ff_get_buffer(avctx, pic)) < 0)
66
+        return ret;
67 67
 
68 68
     y = (uint16_t*)pic->data[0];
69 69
     u = (uint16_t*)pic->data[1];