diff options
author | Peter Ross <pross@xvid.org> | 2011-04-16 00:59:19 +1000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-18 20:40:14 +0200 |
commit | 62931e11d6b74386eeb377d1f677f55aca13ab3e (patch) | |
tree | 7db1034569d66ebede106c86306cf54c1443901b /libavcodec | |
parent | dc8e1b75e721ee10a8ba34311ee622e7a6aa74c6 (diff) | |
download | ffmpeg-62931e11d6b74386eeb377d1f677f55aca13ab3e.tar.gz |
anm decoder: move buffer allocation from decode_init() to decode_frame()
This permits playback in ffplay when libavfilter is enabled.
Resolves ticket #60
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-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 5b2b9df8ea..e216c08441 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; } @@ -170,6 +167,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; |