diff options
author | Peter Ross <pross@xvid.org> | 2012-03-12 23:42:53 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2012-03-12 16:44:39 -0700 |
commit | 015da6e394192c9fde7929fc38d5d5acb805c26c (patch) | |
tree | 17687bc9088017dd6633bd3d90bb49c327a4d246 /libavcodec/anm.c | |
parent | 3aa661ec561d7a20812b84b353b0d7855ac346c8 (diff) | |
download | ffmpeg-015da6e394192c9fde7929fc38d5d5acb805c26c.tar.gz |
anm decoder: move buffer allocation from decode_init() to decode_frame()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/anm.c')
-rw-r--r-- | libavcodec/anm.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/anm.c b/libavcodec/anm.c index 59de984301..46002f80fc 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -29,6 +29,7 @@ typedef struct AnmContext { AVFrame frame; + int palette[AVPALETTE_COUNT]; int x; ///< x coordinate position } AnmContext; @@ -44,14 +45,10 @@ static av_cold int decode_init(AVCodecContext *avctx) return -1; s->frame.reference = 1; - if (avctx->get_buffer(avctx, &s->frame) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } buf = avctx->extradata + 16*8; for (i = 0; i < 256; i++) - ((uint32_t*)s->frame.data[1])[i] = bytestream_get_le32(&buf); + s->palette[i] = bytestream_get_le32(&buf); return 0; } @@ -172,6 +169,8 @@ static int decode_frame(AVCodecContext *avctx, } } while (buf + 1 < buf_end); + memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); + *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; return buf_size; |