Browse code

eatgq: return meaningful error codes.

Anton Khirnov authored on 2012/11/22 03:20:21
Showing 1 changed files
... ...
@@ -189,12 +189,12 @@ static int tgq_decode_frame(AVCodecContext *avctx,
189 189
     const uint8_t *buf = avpkt->data;
190 190
     int buf_size = avpkt->size;
191 191
     TgqContext *s = avctx->priv_data;
192
-    int x,y;
192
+    int x, y, ret;
193 193
     int big_endian = AV_RL32(&buf[4]) > 0x000FFFFF;
194 194
 
195 195
     if (buf_size < 16) {
196 196
         av_log(avctx, AV_LOG_WARNING, "truncated header\n");
197
-        return -1;
197
+        return AVERROR_INVALIDDATA;
198 198
     }
199 199
     bytestream2_init(&s->gb, buf + 8, buf_size - 8);
200 200
     if (big_endian) {
... ...
@@ -217,9 +217,9 @@ static int tgq_decode_frame(AVCodecContext *avctx,
217 217
         s->frame.key_frame = 1;
218 218
         s->frame.pict_type = AV_PICTURE_TYPE_I;
219 219
         s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
220
-        if (ff_get_buffer(avctx, &s->frame)) {
220
+        if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
221 221
             av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
222
-            return -1;
222
+            return ret;
223 223
         }
224 224
     }
225 225