mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lcldec: return meaningful error codes.
This commit is contained in:
parent
01cbc6f6ad
commit
14cf33e957
@ -132,7 +132,7 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
|
||||
int zret = inflateReset(&c->zstream);
|
||||
if (zret != Z_OK) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
|
||||
return -1;
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
c->zstream.next_in = src;
|
||||
c->zstream.avail_in = src_len;
|
||||
@ -141,12 +141,12 @@ static int zlib_decomp(AVCodecContext *avctx, const uint8_t *src, int src_len, i
|
||||
zret = inflate(&c->zstream, Z_FINISH);
|
||||
if (zret != Z_OK && zret != Z_STREAM_END) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", zret);
|
||||
return -1;
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
if (expected != (unsigned int)c->zstream.total_out) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %lu)\n",
|
||||
expected, c->zstream.total_out);
|
||||
return -1;
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
return c->zstream.total_out;
|
||||
}
|
||||
@ -172,7 +172,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
unsigned int height = avctx->height; // Real image height
|
||||
unsigned int mszh_dlen;
|
||||
unsigned char yq, y1q, uq, vq;
|
||||
int uqvq;
|
||||
int uqvq, ret;
|
||||
unsigned int mthread_inlen, mthread_outlen;
|
||||
unsigned int len = buf_size;
|
||||
|
||||
@ -181,9 +181,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
|
||||
c->pic.reference = 0;
|
||||
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
|
||||
if(ff_get_buffer(avctx, &c->pic) < 0){
|
||||
if ((ret = ff_get_buffer(avctx, &c->pic)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
outptr = c->pic.data[0]; // Output image pointer
|
||||
@ -202,14 +202,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
if (mthread_outlen != mszh_dlen) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n",
|
||||
mthread_outlen, mszh_dlen);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
mszh_dlen = mszh_decomp(encoded + 8 + mthread_inlen, len - 8 - mthread_inlen,
|
||||
c->decomp_buf + mthread_outlen, c->decomp_size - mthread_outlen);
|
||||
if (mthread_outlen != mszh_dlen) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n",
|
||||
mthread_outlen, mszh_dlen);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
encoded = c->decomp_buf;
|
||||
len = c->decomp_size;
|
||||
@ -218,7 +218,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
if (c->decomp_size != mszh_dlen) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n",
|
||||
c->decomp_size, mszh_dlen);
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
encoded = c->decomp_buf;
|
||||
len = mszh_dlen;
|
||||
@ -249,7 +249,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
}
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
#if CONFIG_ZLIB_DECODER
|
||||
@ -266,7 +266,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
break;
|
||||
}
|
||||
} else if (c->flags & FLAG_MULTITHREAD) {
|
||||
int ret;
|
||||
mthread_inlen = AV_RL32(encoded);
|
||||
mthread_inlen = FFMIN(mthread_inlen, len - 8);
|
||||
mthread_outlen = AV_RL32(encoded+4);
|
||||
@ -286,7 +285,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
#endif
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in frame decoder compression switch.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
@ -370,7 +369,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in pngfilter switch.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,7 +457,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in image decoder.\n");
|
||||
return -1;
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
*got_frame = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user