Browse Source

loco: return meaningful error codes.

tags/n1.2
Anton Khirnov 12 years ago
parent
commit
1a31dff937
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      libavcodec/loco.c

+ 5
- 5
libavcodec/loco.c View File

@@ -165,15 +165,15 @@ static int decode_frame(AVCodecContext *avctx,
int buf_size = avpkt->size; int buf_size = avpkt->size;
LOCOContext * const l = avctx->priv_data; LOCOContext * const l = avctx->priv_data;
AVFrame * const p = &l->pic; AVFrame * const p = &l->pic;
int decoded;
int decoded, ret;


if(p->data[0]) if(p->data[0])
avctx->release_buffer(avctx, p); avctx->release_buffer(avctx, p);


p->reference = 0; p->reference = 0;
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"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
return ret;
} }
p->key_frame = 1; p->key_frame = 1;


@@ -237,7 +237,7 @@ static av_cold int decode_init(AVCodecContext *avctx){
if (avctx->extradata_size < 12) { if (avctx->extradata_size < 12) {
av_log(avctx, AV_LOG_ERROR, "Extradata size must be >= 12 instead of %i\n", av_log(avctx, AV_LOG_ERROR, "Extradata size must be >= 12 instead of %i\n",
avctx->extradata_size); avctx->extradata_size);
return -1;
return AVERROR_INVALIDDATA;
} }
version = AV_RL32(avctx->extradata); version = AV_RL32(avctx->extradata);
switch(version) { switch(version) {
@@ -268,7 +268,7 @@ static av_cold int decode_init(AVCodecContext *avctx){
break; break;
default: default:
av_log(avctx, AV_LOG_INFO, "Unknown colorspace, index = %i\n", l->mode); av_log(avctx, AV_LOG_INFO, "Unknown colorspace, index = %i\n", l->mode);
return -1;
return AVERROR_INVALIDDATA;
} }
if(avctx->debug & FF_DEBUG_PICT_INFO) if(avctx->debug & FF_DEBUG_PICT_INFO)
av_log(avctx, AV_LOG_INFO, "lossy:%i, version:%i, mode: %i\n", l->lossy, version, l->mode); av_log(avctx, AV_LOG_INFO, "lossy:%i, version:%i, mode: %i\n", l->lossy, version, l->mode);


Loading…
Cancel
Save