aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-11-11 11:00:11 +0000
committerPaul B Mahol <onemda@gmail.com>2012-11-12 11:46:12 +0000
commit0baec57d09ebe7e6e2c701cce5e4346cc9b516fa (patch)
tree39ff45be61cc2732a4e7810d0d5daba86af4f4a0
parent4d60e5051e66c6e79645efec1376b98caf41ad03 (diff)
downloadffmpeg-0baec57d09ebe7e6e2c701cce5e4346cc9b516fa.tar.gz
anm: return meaningful error codes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavcodec/anm.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/anm.c b/libavcodec/anm.c
index 22c274b429..7cac095255 100644
--- a/libavcodec/anm.c
+++ b/libavcodec/anm.c
@@ -45,7 +45,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->frame.reference = 3;
bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size);
if (bytestream2_get_bytes_left(&s->gb) < 16 * 8 + 4 * 256)
- return -1;
+ return AVERROR_INVALIDDATA;
bytestream2_skipu(&s->gb, 16 * 8);
for (i = 0; i < 256; i++)
@@ -112,11 +112,11 @@ static int decode_frame(AVCodecContext *avctx,
AnmContext *s = avctx->priv_data;
const int buf_size = avpkt->size;
uint8_t *dst, *dst_end;
- int count;
+ int count, ret;
- if(avctx->reget_buffer(avctx, &s->frame) < 0){
+ if ((ret = avctx->reget_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
dst = s->frame.data[0];
dst_end = s->frame.data[0] + s->frame.linesize[0]*avctx->height;
@@ -125,11 +125,11 @@ static int decode_frame(AVCodecContext *avctx,
if (bytestream2_get_byte(&s->gb) != 0x42) {
av_log_ask_for_sample(avctx, "unknown record type\n");
- return buf_size;
+ return AVERROR_INVALIDDATA;
}
if (bytestream2_get_byte(&s->gb)) {
av_log_ask_for_sample(avctx, "padding bytes not supported\n");
- return buf_size;
+ return AVERROR_PATCHWELCOME;
}
bytestream2_skip(&s->gb, 2);