summaryrefslogtreecommitdiff
path: root/libavcodec/sunrast.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-12 01:02:55 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-12 01:06:13 +0100
commitcd1c12b5c5b79195140a93d59cbf990d034f61d8 (patch)
tree1a1ab570f0dddd706a1b995e255272c1c6f9f453 /libavcodec/sunrast.c
parent289520fd97395ffd5bf933ac80487e858bc4039d (diff)
parentb498867d6691b5f1f107afd81aff403f66b434aa (diff)
downloadffmpeg-cd1c12b5c5b79195140a93d59cbf990d034f61d8.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: FATE: update reference for seek-alac_mp4 sunrast: Return AVERROR values instead of -1. sunrast: Add support for gray8 decoding. swscale: enforce a minimum filtersize. alacenc: use AVCodec.encode2() alacenc: cosmetics: indentation alacenc: consolidate bitstream writing into a single function. alacenc: only encode frame size in header for a final smaller frame alacenc: store current frame size in AlacEncodeContext. alacenc: return AVERROR codes in alac_encode_frame() alacenc: calculate a new max frame size for the final small frame alacenc: pretty-printing and other cosmetics alacenc: fix error handling and potential memleaks in alac_encode_init() alacenc: do not set coded_frame->key_frame alacenc: do not set bits_per_coded_sample alacenc: remove unneeded frame_size check in alac_encode_frame() tta: error out if samplerate is zero. ttadec: fix invalid free when an error occurs while decoding 24-bit tta wavpack: add needed braces for 2 statements inside an if block Conflicts: tests/ref/acodec/alac Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/sunrast.c')
-rw-r--r--libavcodec/sunrast.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
index 8562e11ac4..aab6435cdd 100644
--- a/libavcodec/sunrast.c
+++ b/libavcodec/sunrast.c
@@ -72,13 +72,14 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
unsigned int w, h, depth, type, maptype, maplength, stride, x, y, len, alen;
uint8_t *ptr, *ptr2 = NULL;
const uint8_t *bufstart = buf;
+ int ret;
if (avpkt->size < 32)
return AVERROR_INVALIDDATA;
if (AV_RB32(buf) != RAS_MAGIC) {
av_log(avctx, AV_LOG_ERROR, "this is not sunras encoded data\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
w = AV_RB32(buf + 4);
@@ -95,15 +96,15 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
}
if (type > RT_FORMAT_IFF) {
av_log(avctx, AV_LOG_ERROR, "invalid (compression) type\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (av_image_check_size(w, h, 0, avctx)) {
av_log(avctx, AV_LOG_ERROR, "invalid image size\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (maptype & ~1) {
av_log(avctx, AV_LOG_ERROR, "invalid colormap type\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (type == RT_FORMAT_TIFF || type == RT_FORMAT_IFF) {
@@ -129,7 +130,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
break;
default:
av_log(avctx, AV_LOG_ERROR, "invalid depth\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
if (p->data[0])
@@ -137,9 +138,9 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
if (w != avctx->width || h != avctx->height)
avcodec_set_dimensions(avctx, w, h);
- if (avctx->get_buffer(avctx, p) < 0) {
+ if ((ret = avctx->get_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
p->pict_type = AV_PICTURE_TYPE_I;
@@ -155,7 +156,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
if (maplength % 3 || maplength > 768) {
av_log(avctx, AV_LOG_WARNING, "invalid colormap length\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
ptr = p->data[1];