Browse Source

cscd: return meaningful error codes.

tags/n1.2
Anton Khirnov 13 years ago
parent
commit
8fd4d1f9b9
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      libavcodec/cscd.c

+ 6
- 5
libavcodec/cscd.c View File

@@ -143,10 +143,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int buf_size = avpkt->size; int buf_size = avpkt->size;
CamStudioContext *c = avctx->priv_data; CamStudioContext *c = avctx->priv_data;
AVFrame *picture = data; AVFrame *picture = data;
int ret;


if (buf_size < 2) { if (buf_size < 2) {
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n"); av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
return -1;
return AVERROR_INVALIDDATA;
} }


if (c->pic.data[0]) if (c->pic.data[0])
@@ -154,9 +155,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
c->pic.reference = 1; c->pic.reference = 1;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE | c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
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"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
return ret;
} }


// decompress data // decompress data
@@ -175,12 +176,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break; break;
#else #else
av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n"); av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n");
return -1;
return AVERROR(ENOSYS);
#endif #endif
} }
default: default:
av_log(avctx, AV_LOG_ERROR, "unknown compression\n"); av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
return -1;
return AVERROR_INVALIDDATA;
} }


// flip upside down, add difference frame // flip upside down, add difference frame


Loading…
Cancel
Save