lagarith: return more meaningful error codes

Signed-off-by: Paul B Mahol <onemda@gmail.com>
pull/28/head^2
Paul B Mahol 12 years ago
parent 5b10c5e7e4
commit c4274d118b
  1. 19
      libavcodec/lagarith.c

@ -518,6 +518,7 @@ static int lag_decode_frame(AVCodecContext *avctx,
uint32_t offs[4];
uint8_t *srcs[4], *dst;
int i, j, planes = 3;
int ret;
AVFrame *picture = data;
@ -544,9 +545,9 @@ static int lag_decode_frame(AVCodecContext *avctx,
planes = 4;
}
if (ff_thread_get_buffer(avctx, p) < 0) {
if ((ret = ff_thread_get_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
return ret;
}
dst = p->data[0];
@ -573,9 +574,9 @@ static int lag_decode_frame(AVCodecContext *avctx,
if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24)
avctx->pix_fmt = AV_PIX_FMT_RGB24;
if (ff_thread_get_buffer(avctx, p) < 0) {
if ((ret = ff_thread_get_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
return ret;
}
offs[0] = offset_bv;
@ -632,9 +633,9 @@ static int lag_decode_frame(AVCodecContext *avctx,
case FRAME_ARITH_YUY2:
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
if (ff_thread_get_buffer(avctx, p) < 0) {
if ((ret = ff_thread_get_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
return ret;
}
if (offset_ry >= buf_size ||
@ -658,9 +659,9 @@ static int lag_decode_frame(AVCodecContext *avctx,
case FRAME_ARITH_YV12:
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
if (ff_thread_get_buffer(avctx, p) < 0) {
if ((ret = ff_thread_get_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
return ret;
}
if (buf_size <= offset_ry || buf_size <= offset_gu || buf_size <= offset_bv) {
return AVERROR_INVALIDDATA;
@ -687,7 +688,7 @@ static int lag_decode_frame(AVCodecContext *avctx,
default:
av_log(avctx, AV_LOG_ERROR,
"Unsupported Lagarith frame type: %#x\n", frametype);
return -1;
return AVERROR_PATCHWELCOME;
}
*picture = *p;

Loading…
Cancel
Save