mirror of https://git.ffmpeg.org/ffmpeg.git
msrle: return meaningful error codes.
This commit is contained in:
parent
8fd4d1f9b9
commit
9e6764900a
|
@ -63,7 +63,7 @@ static av_cold int msrle_decode_init(AVCodecContext *avctx)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");
|
av_log(avctx, AV_LOG_ERROR, "unsupported bits per sample\n");
|
||||||
return -1;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->frame.data[0] = NULL;
|
s->frame.data[0] = NULL;
|
||||||
|
@ -79,15 +79,16 @@ static int msrle_decode_frame(AVCodecContext *avctx,
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
MsrleContext *s = avctx->priv_data;
|
MsrleContext *s = avctx->priv_data;
|
||||||
int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8;
|
int istride = FFALIGN(avctx->width*avctx->bits_per_coded_sample, 32) / 8;
|
||||||
|
int ret;
|
||||||
|
|
||||||
s->buf = buf;
|
s->buf = buf;
|
||||||
s->size = buf_size;
|
s->size = buf_size;
|
||||||
|
|
||||||
s->frame.reference = 1;
|
s->frame.reference = 1;
|
||||||
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
|
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
|
||||||
if (avctx->reget_buffer(avctx, &s->frame)) {
|
if ((ret = avctx->reget_buffer(avctx, &s->frame)) < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
|
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
|
||||||
return -1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avctx->bits_per_coded_sample <= 8) {
|
if (avctx->bits_per_coded_sample <= 8) {
|
||||||
|
|
Loading…
Reference in New Issue