diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2011-04-09 15:49:51 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2011-04-15 18:02:05 +0200 |
commit | 2d8591c27e2dc582a7020e2580e16278dbfbddff (patch) | |
tree | 5e251cc6e974c0b9e2c99b3f6e622b4983e4941a /libavformat/ipmovie.c | |
parent | 4de339e219908ff44cbb1d823edeeead3b8facda (diff) | |
download | ffmpeg-2d8591c27e2dc582a7020e2580e16278dbfbddff.tar.gz |
make containers pass palette change in AVPacket
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/ipmovie.c')
-rw-r--r-- | libavformat/ipmovie.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index e1d08df1f3..e3215d3b79 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -97,6 +97,8 @@ typedef struct IPMVEContext { unsigned int video_width; unsigned int video_height; int64_t video_pts; + uint32_t palette[256]; + int has_palette; unsigned int audio_bits; unsigned int audio_channels; @@ -116,8 +118,6 @@ typedef struct IPMVEContext { int64_t next_chunk_offset; - AVPaletteControl palette_control; - } IPMVEContext; static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, @@ -162,6 +162,17 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size)) return CHUNK_NOMEM; + if (s->has_palette) { + uint8_t *pal; + + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, + AVPALETTE_SIZE); + if (pal) { + memcpy(pal, s->palette, AVPALETTE_SIZE); + s->has_palette = 0; + } + } + pkt->pos= s->decode_map_chunk_offset; avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; @@ -456,10 +467,9 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, r = scratch[j++] * 4; g = scratch[j++] * 4; b = scratch[j++] * 4; - s->palette_control.palette[i] = (r << 16) | (g << 8) | (b); + s->palette[i] = (r << 16) | (g << 8) | (b); } - /* indicate a palette change */ - s->palette_control.palette_changed = 1; + s->has_palette = 1; break; case OPCODE_SET_PALETTE_COMPRESSED: @@ -573,9 +583,6 @@ static int ipmovie_read_header(AVFormatContext *s, st->codec->height = ipmovie->video_height; st->codec->bits_per_coded_sample = ipmovie->video_bpp; - /* palette considerations */ - st->codec->palctrl = &ipmovie->palette_control; - if (ipmovie->audio_type) { st = av_new_stream(s, 0); if (!st) |