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/idcin.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/idcin.c')
-rw-r--r-- | libavformat/idcin.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libavformat/idcin.c b/libavformat/idcin.c index e6883c7d94..04ae687c6c 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -86,8 +86,6 @@ typedef struct IdcinDemuxContext { int audio_present; int64_t pts; - - AVPaletteControl palctrl; } IdcinDemuxContext; static int idcin_probe(AVProbeData *p) @@ -172,8 +170,6 @@ static int idcin_read_header(AVFormatContext *s, if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) return AVERROR(EIO); - /* save a reference in order to transport the palette */ - st->codec->palctrl = &idcin->palctrl; /* if sample rate is 0, assume no audio */ if (sample_rate) { @@ -226,6 +222,7 @@ static int idcin_read_packet(AVFormatContext *s, int palette_scale; unsigned char r, g, b; unsigned char palette_buffer[768]; + uint32_t palette[256]; if (s->pb->eof_reached) return AVERROR(EIO); @@ -236,7 +233,6 @@ static int idcin_read_packet(AVFormatContext *s, return AVERROR(EIO); } else if (command == 1) { /* trigger a palette change */ - idcin->palctrl.palette_changed = 1; if (avio_read(pb, palette_buffer, 768) != 768) return AVERROR(EIO); /* scale the palette as necessary */ @@ -251,7 +247,7 @@ static int idcin_read_packet(AVFormatContext *s, r = palette_buffer[i * 3 ] << palette_scale; g = palette_buffer[i * 3 + 1] << palette_scale; b = palette_buffer[i * 3 + 2] << palette_scale; - idcin->palctrl.palette[i] = (r << 16) | (g << 8) | (b); + palette[i] = (r << 16) | (g << 8) | (b); } } @@ -262,6 +258,15 @@ static int idcin_read_packet(AVFormatContext *s, ret= av_get_packet(pb, pkt, chunk_size); if (ret < 0) return ret; + if (command == 1) { + uint8_t *pal; + + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, + AVPALETTE_SIZE); + if (ret < 0) + return ret; + memcpy(pal, palette, AVPALETTE_SIZE); + } pkt->stream_index = idcin->video_stream_index; pkt->pts = idcin->pts; } else { |