summaryrefslogtreecommitdiff
path: root/libavcodec/iff.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-05-16 22:39:03 +0200
committerPaul B Mahol <onemda@gmail.com>2016-05-16 22:39:03 +0200
commit72e33eec3a5e6d04d891e89ef0ab9d42054a6271 (patch)
treeeafdee7ed87043a0bda6c0bfc967cef10e8838ec /libavcodec/iff.c
parent8767470fb572f394104d24acffb70eea9ce48ad3 (diff)
avcodec/iff: add support for ANIMs with keyframes and concatenated ANIMs
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/iff.c')
-rw-r--r--libavcodec/iff.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index 85fae1589e..9d7dce5596 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -63,7 +63,6 @@ typedef struct IffContext {
uint8_t *video[2];
unsigned video_size;
uint32_t *pal[2];
- int first;
} IffContext;
#define LUT8_PART(plane, v) \
@@ -422,7 +421,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->pal[1] = av_calloc(256, sizeof(*s->pal[1]));
if (!s->video[0] || !s->video[1] || !s->pal[0] || !s->pal[1])
return AVERROR(ENOMEM);
- s->first = 1;
}
if ((err = extract_header(avctx, NULL)) < 0)
@@ -1322,17 +1320,11 @@ static int decode_frame(AVCodecContext *avctx,
}
s->init = 1;
- if (s->compression <= 0xff && avctx->codec_tag == MKTAG('A', 'N', 'I', 'M')) {
+ if (s->compression <= 0xff && (avctx->codec_tag == MKTAG('A', 'N', 'I', 'M'))) {
if (avctx->pix_fmt == AV_PIX_FMT_PAL8)
memcpy(s->pal[0], s->frame->data[1], 256 * 4);
}
- if (s->compression > 0xff && s->first) {
- memcpy(s->video[1], s->video[0], s->video_size);
- memcpy(s->pal[1], s->pal[0], 256 * 4);
- s->first = 0;
- }
-
switch (s->compression) {
case 0x0:
if (avctx->codec_tag == MKTAG('A', 'C', 'B', 'M')) {
@@ -1549,6 +1541,11 @@ static int decode_frame(AVCodecContext *avctx,
return unsupported(avctx);
}
+ if (s->compression <= 0xff && (avctx->codec_tag == MKTAG('A', 'N', 'I', 'M'))) {
+ memcpy(s->pal[1], s->pal[0], 256 * 4);
+ memcpy(s->video[1], s->video[0], s->video_size);
+ }
+
if (s->compression > 0xff) {
if (avctx->pix_fmt == AV_PIX_FMT_PAL8 || avctx->pix_fmt == AV_PIX_FMT_GRAY8) {
buf = s->video[0];