summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/cyuv.c9
-rw-r--r--libavcodec/eatgv.c20
-rw-r--r--libavcodec/txd.c15
3 files changed, 23 insertions, 21 deletions
diff --git a/libavcodec/cyuv.c b/libavcodec/cyuv.c
index 3bc6ba4981..9648799f09 100644
--- a/libavcodec/cyuv.c
+++ b/libavcodec/cyuv.c
@@ -52,7 +52,7 @@ static av_cold int cyuv_decode_init(AVCodecContext *avctx)
s->width = avctx->width;
/* width needs to be divisible by 4 for this codec to work */
if (s->width & 0x3)
- return -1;
+ return AVERROR_INVALIDDATA;
s->height = avctx->height;
avcodec_get_frame_defaults(&s->frame);
@@ -84,6 +84,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
unsigned char cur_byte;
int pixel_groups;
int rawsize = s->height * FFALIGN(s->width,2) * 2;
+ int ret;
if (avctx->codec_id == AV_CODEC_ID_AURA) {
y_table = u_table;
@@ -100,7 +101,7 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
} else {
av_log(avctx, AV_LOG_ERROR, "got a buffer with %d bytes when %d were expected\n",
buf_size, 48 + s->height * (s->width * 3 / 4));
- return -1;
+ return AVERROR_INVALIDDATA;
}
/* pixel data starts 48 bytes in, after 3x16-byte tables */
@@ -111,9 +112,9 @@ static int cyuv_decode_frame(AVCodecContext *avctx,
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
s->frame.reference = 0;
- if (ff_get_buffer(avctx, &s->frame) < 0) {
+ if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
y_plane = s->frame.data[0];
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index b105ea539c..9dca2399b9 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -75,7 +75,7 @@ static int unpack(const uint8_t *src, const uint8_t *src_end, unsigned char *dst
src += 2;
if (src_end - src < 3)
- return -1;
+ return AVERROR_INVALIDDATA;
size = AV_RB24(src);
src += 3;
@@ -148,7 +148,7 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *b
const unsigned char *blocks_raw;
if(buf_end - buf < 12)
- return -1;
+ return AVERROR_INVALIDDATA;
num_mvs = AV_RL16(&buf[0]);
num_blocks_raw = AV_RL16(&buf[2]);
@@ -177,7 +177,7 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *b
mvbits = (num_mvs*2*10+31) & ~31;
if (buf_end - buf < (mvbits>>3)+16*num_blocks_raw+8*num_blocks_packed)
- return -1;
+ return AVERROR_INVALIDDATA;
init_get_bits(&gb, buf, mvbits);
for (i=0; i<num_mvs; i++) {
@@ -202,7 +202,7 @@ static int tgv_decode_inter(TgvContext * s, const uint8_t *buf, const uint8_t *b
if (get_bits_left(&gb) < vector_bits *
(s->avctx->height/4) * (s->avctx->width/4))
- return -1;
+ return AVERROR_INVALIDDATA;
/* read vectors and build frame */
for(y=0; y<s->avctx->height/4; y++)
@@ -260,7 +260,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
int buf_size = avpkt->size;
TgvContext *s = avctx->priv_data;
const uint8_t *buf_end = buf + buf_size;
- int chunk_type;
+ int chunk_type, ret;
if (buf_end - buf < EA_PREAMBLE_SIZE)
return AVERROR_INVALIDDATA;
@@ -272,7 +272,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
int pal_count, i;
if(buf_end - buf < 12) {
av_log(avctx, AV_LOG_WARNING, "truncated header\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
s->width = AV_RL16(&buf[0]);
@@ -291,8 +291,8 @@ static int tgv_decode_frame(AVCodecContext *avctx,
}
}
- if (av_image_check_size(s->width, s->height, 0, avctx))
- return -1;
+ if ((ret = av_image_check_size(s->width, s->height, 0, avctx)) < 0)
+ return ret;
/* shuffle */
FFSWAP(AVFrame, s->frame, s->last_frame);
@@ -317,7 +317,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
s->frame.pict_type = AV_PICTURE_TYPE_I;
if (unpack(buf, buf_end, s->frame.data[0], s->avctx->width, s->avctx->height)<0) {
av_log(avctx, AV_LOG_WARNING, "truncated intra frame\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
}else{
if (!s->last_frame.data[0]) {
@@ -328,7 +328,7 @@ static int tgv_decode_frame(AVCodecContext *avctx,
s->frame.pict_type = AV_PICTURE_TYPE_P;
if (tgv_decode_inter(s, buf, buf_end)<0) {
av_log(avctx, AV_LOG_WARNING, "truncated inter frame\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
}
diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index 2dd82598a4..b5b34acf3c 100644
--- a/libavcodec/txd.c
+++ b/libavcodec/txd.c
@@ -51,6 +51,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
unsigned int y, v;
uint8_t *ptr;
uint32_t *pal;
+ int ret;
bytestream2_init(&gb, avpkt->data, avpkt->size);
version = bytestream2_get_le32(&gb);
@@ -65,7 +66,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (version < 8 || version > 9) {
av_log(avctx, AV_LOG_ERROR, "texture data version %i is unsupported\n",
version);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
if (depth == 8) {
@@ -74,19 +75,19 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
avctx->pix_fmt = AV_PIX_FMT_RGB32;
} else {
av_log(avctx, AV_LOG_ERROR, "depth of %i is unsupported\n", depth);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
if (p->data[0])
avctx->release_buffer(avctx, p);
- if (av_image_check_size(w, h, 0, avctx))
- return -1;
+ if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
+ return ret;
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- 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;
@@ -149,7 +150,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
unsupported:
av_log(avctx, AV_LOG_ERROR, "unsupported d3d format (%08x)\n", d3d_format);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
static av_cold int txd_end(AVCodecContext *avctx) {