summaryrefslogtreecommitdiff
path: root/libavcodec/cscd.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-17 15:45:41 +0100
committerAnton Khirnov <anton@khirnov.net>2013-01-14 11:34:08 +0100
commit8fd4d1f9b925f3b978756926b40315440c448696 (patch)
treeabcc60366e42b15e8590ff38e71a350492aa2c3f /libavcodec/cscd.c
parent67360ccd51f37a6a4f31363f1c9fc46f43a22cb8 (diff)
cscd: return meaningful error codes.
Diffstat (limited to 'libavcodec/cscd.c')
-rw-r--r--libavcodec/cscd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c
index 2c1b2e7858..b982f5029c 100644
--- a/libavcodec/cscd.c
+++ b/libavcodec/cscd.c
@@ -143,10 +143,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int buf_size = avpkt->size;
CamStudioContext *c = avctx->priv_data;
AVFrame *picture = data;
+ int ret;
if (buf_size < 2) {
av_log(avctx, AV_LOG_ERROR, "coded frame too small\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
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.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE |
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");
- return -1;
+ return ret;
}
// decompress data
@@ -175,12 +176,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
break;
#else
av_log(avctx, AV_LOG_ERROR, "compiled without zlib support\n");
- return -1;
+ return AVERROR(ENOSYS);
#endif
}
default:
av_log(avctx, AV_LOG_ERROR, "unknown compression\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
// flip upside down, add difference frame