aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/svq1dec.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-10-14 09:12:19 +0000
committerPaul B Mahol <onemda@gmail.com>2012-10-14 09:12:19 +0000
commite2bf1082cc0dafe21be1a7dac6cf9900e7e162ba (patch)
tree2aaed838e92b5207cec05e677d70c1222dc5caef /libavcodec/svq1dec.c
parentd31098113fab78531b43ca1d019335e835149cf1 (diff)
downloadffmpeg-e2bf1082cc0dafe21be1a7dac6cf9900e7e162ba.tar.gz
svq1dec: return more meaningful error codes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/svq1dec.c')
-rw-r--r--libavcodec/svq1dec.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index 66afdcba0e..b5999d4a0a 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -206,7 +206,7 @@ static int svq1_decode_block_intra(GetBitContext *bitbuf, uint8_t *pixels,
av_dlog(NULL,
"Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",
stages, level);
- return -1; /* invalid vector */
+ return AVERROR_INVALIDDATA; /* invalid vector */
}
mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
@@ -258,7 +258,7 @@ static int svq1_decode_block_non_intra(GetBitContext *bitbuf, uint8_t *pixels,
av_dlog(NULL,
"Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",
stages, level);
- return -1; /* invalid vector */
+ return AVERROR_INVALIDDATA; /* invalid vector */
}
mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
@@ -279,7 +279,7 @@ static int svq1_decode_motion_vector(GetBitContext *bitbuf, svq1_pmv *mv,
/* get motion code */
diff = get_vlc2(bitbuf, svq1_motion_component.table, 7, 2);
if (diff < 0)
- return -1;
+ return AVERROR_INVALIDDATA;
else if (diff) {
if (get_bits1(bitbuf))
diff = -diff;
@@ -518,7 +518,7 @@ static int svq1_decode_frame_header(GetBitContext *bitbuf, MpegEncContext *s)
/* frame type */
s->pict_type = get_bits(bitbuf, 2) + 1;
if (s->pict_type == 4)
- return -1;
+ return AVERROR_INVALIDDATA;
if (s->pict_type == AV_PICTURE_TYPE_I) {
/* unknown fields */
@@ -555,7 +555,7 @@ static int svq1_decode_frame_header(GetBitContext *bitbuf, MpegEncContext *s)
s->height = get_bits(bitbuf, 12);
if (!s->width || !s->height)
- return -1;
+ return AVERROR_INVALIDDATA;
} else {
/* get width, height from table */
s->width = ff_svq1_frame_size_table[frame_size_code].width;
@@ -569,7 +569,7 @@ static int svq1_decode_frame_header(GetBitContext *bitbuf, MpegEncContext *s)
skip_bits1(bitbuf); /* component checksums after image data if (1) */
if (get_bits(bitbuf, 2) != 0)
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (get_bits1(bitbuf) == 1) {
@@ -603,7 +603,7 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
s->f_code = get_bits(&s->gb, 22);
if ((s->f_code & ~0x70) || !(s->f_code & 0x60))
- return -1;
+ return AVERROR_INVALIDDATA;
/* swap some header bytes (why?) */
if (s->f_code != 0x20) {
@@ -637,12 +637,12 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
avctx->skip_frame >= AVDISCARD_ALL)
return buf_size;
- if (ff_MPV_frame_start(s, avctx) < 0)
- return -1;
+ if ((result = ff_MPV_frame_start(s, avctx)) < 0)
+ return result;
pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv));
if (!pmv)
- return -1;
+ return AVERROR(ENOMEM);
/* decode y, u and v components */
for (i = 0; i < 3; i++) {