aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/fraps.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-07 00:38:25 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-07 00:41:06 +0100
commit07f22d0b49332d9616ce5ff94679da5a01c19b0d (patch)
tree00e7f5f81436ddf1e54339661383e8fc6105cfca /libavcodec/fraps.c
parent7b018e5c8d182b0272477322377b8daafa1c970f (diff)
parent57d11e5e28bfe0bc445ad78fc033aafa73068bb4 (diff)
downloadffmpeg-07f22d0b49332d9616ce5ff94679da5a01c19b0d.tar.gz
Merge commit '57d11e5e28bfe0bc445ad78fc033aafa73068bb4'
* commit '57d11e5e28bfe0bc445ad78fc033aafa73068bb4': fraps: return meaningful error codes. kgv1dec: return meaningful error codes. kmvc: return meaningful error codes. wnv1: return meaningful error codes. dpx: return meaningful error codes. truemotion1: return meaningful error codes pnm: return meaningful error codes. Conflicts: libavcodec/dpx.c libavcodec/fraps.c libavcodec/kmvc.c libavcodec/pnm.c libavcodec/pnmdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/fraps.c')
-rw-r--r--libavcodec/fraps.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
index 6500c853e2..6cdb0d99a3 100644
--- a/libavcodec/fraps.c
+++ b/libavcodec/fraps.c
@@ -88,7 +88,7 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
int h, const uint8_t *src, int size, int Uoff,
const int step)
{
- int i, j;
+ int i, j, ret;
GetBitContext gb;
VLC vlc;
Node nodes[512];
@@ -96,9 +96,9 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
for(i = 0; i < 256; i++)
nodes[i].count = bytestream_get_le32(&src);
size -= 1024;
- if (ff_huff_build_tree(s->avctx, &vlc, 256, nodes, huff_cmp,
- FF_HUFFMAN_FLAG_ZERO_COUNT) < 0)
- return -1;
+ if ((ret = ff_huff_build_tree(s->avctx, &vlc, 256, nodes, huff_cmp,
+ FF_HUFFMAN_FLAG_ZERO_COUNT)) < 0)
+ return ret;
/* we have built Huffman table and are ready to decode plane */
/* convert bits so they may be used by standard bitreader */
@@ -139,11 +139,10 @@ static int decode_frame(AVCodecContext *avctx,
const uint32_t *buf32;
uint32_t *luma1,*luma2,*cb,*cr;
uint32_t offs[4];
- int i, j, is_chroma;
+ int i, j, ret, is_chroma;
const int planes = 3;
uint8_t *out;
enum AVPixelFormat pix_fmt;
- int ret;
header = AV_RL32(buf);
version = header & 0xff;
@@ -249,6 +248,7 @@ static int decode_frame(AVCodecContext *avctx,
memcpy(&f->data[0][ (avctx->height-y)*f->linesize[0] ],
&buf[y*avctx->width*3],
3*avctx->width);
+
break;
case 2:
@@ -259,10 +259,13 @@ static int decode_frame(AVCodecContext *avctx,
*/
for(i = 0; i < planes; i++){
is_chroma = !!i;
- if(fraps2_decode_plane(s, f->data[i], f->linesize[i], avctx->width >> is_chroma,
- avctx->height >> is_chroma, buf + offs[i], offs[i + 1] - offs[i], is_chroma, 1) < 0) {
+ if ((ret = fraps2_decode_plane(s, f->data[i], f->linesize[i],
+ avctx->width >> is_chroma,
+ avctx->height >> is_chroma,
+ buf + offs[i], offs[i + 1] - offs[i],
+ is_chroma, 1)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
- return AVERROR_INVALIDDATA;
+ return ret;
}
}
break;
@@ -270,10 +273,11 @@ static int decode_frame(AVCodecContext *avctx,
case 5:
/* Virtually the same as version 4, but is for RGB24 */
for(i = 0; i < planes; i++){
- if(fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)), -f->linesize[0],
- avctx->width, avctx->height, buf + offs[i], offs[i + 1] - offs[i], 0, 3) < 0) {
+ if ((ret = fraps2_decode_plane(s, f->data[0] + i + (f->linesize[0] * (avctx->height - 1)),
+ -f->linesize[0], avctx->width, avctx->height,
+ buf + offs[i], offs[i + 1] - offs[i], 0, 3)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error decoding plane %i\n", i);
- return AVERROR_INVALIDDATA;
+ return ret;
}
}
out = f->data[0];