summaryrefslogtreecommitdiff
path: root/libavcodec/zmbv.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-02-01 00:35:29 +0000
committerDiego Biurrun <diego@biurrun.de>2012-02-01 14:24:25 +0100
commit8ca8e4a8461b6617d365954155e41f818287b181 (patch)
tree68c40177d02fb99a707b22aaa8eb5c80b3f06b70 /libavcodec/zmbv.c
parent013a677fb62058161ca5cd31a85cf77a89cc1a9d (diff)
zmbv: Employ more meaningful return values.
Also use av_log_ask_for_sample() where it makes sense. Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec/zmbv.c')
-rw-r--r--libavcodec/zmbv.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index a4546356ec..a160553c09 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -403,7 +403,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
ZmbvContext * const c = avctx->priv_data;
int zret = Z_OK; // Zlib return code
int len = buf_size;
- int hi_ver, lo_ver;
+ int hi_ver, lo_ver, ret;
uint8_t *tmp;
if (c->pic.data[0])
@@ -411,9 +411,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
c->pic.reference = 1;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if (avctx->get_buffer(avctx, &c->pic) < 0) {
+ if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
/* parse header */
@@ -433,19 +433,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
"Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);
if (hi_ver != 0 || lo_ver != 1) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported version %i.%i\n",
- hi_ver, lo_ver);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported version %i.%i\n",
+ hi_ver, lo_ver);
+ return AVERROR_PATCHWELCOME;
}
if (c->bw == 0 || c->bh == 0) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported block size %ix%i\n",
- c->bw, c->bh);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported block size %ix%i\n",
+ c->bw, c->bh);
+ return AVERROR_PATCHWELCOME;
}
if (c->comp != 0 && c->comp != 1) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported compression type %i\n",
- c->comp);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported compression type %i\n",
+ c->comp);
+ return AVERROR_PATCHWELCOME;
}
switch (c->fmt) {
@@ -475,9 +475,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
default:
c->decode_intra = NULL;
c->decode_xor = NULL;
- av_log(avctx, AV_LOG_ERROR,
- "Unsupported (for now) format %i\n", c->fmt);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported (for now) format %i\n",
+ c->fmt);
+ return AVERROR_PATCHWELCOME;
}
zret = inflateReset(&c->zstream);
@@ -500,7 +500,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
if (c->decode_intra == NULL) {
av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (c->comp == 0) { //Uncompressed data
@@ -630,7 +630,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR,
"Can't allocate decompression buffer.\n");
- return 1;
+ return AVERROR(ENOMEM);
}
}
@@ -640,7 +640,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
zret = inflateInit(&c->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
- return 1;
+ return -1;
}
return 0;