diff options
author | Mike Melanson <mike@multimedia.cx> | 2003-10-30 05:40:58 +0000 |
---|---|---|
committer | Mike Melanson <mike@multimedia.cx> | 2003-10-30 05:40:58 +0000 |
commit | 2a2bbcb05fde486eef76d070f26eecddd4de0ace (patch) | |
tree | 781c3c83552a80cb71014d3ff66ff05df14f5f7e /libavformat/wc3movie.c | |
parent | 9df1d2490d61c273a3ac9573c49cf4d20b4d750e (diff) | |
download | ffmpeg-streaming-2a2bbcb05fde486eef76d070f26eecddd4de0ace.zip ffmpeg-streaming-2a2bbcb05fde486eef76d070f26eecddd4de0ace.tar.gz |
revised palette API, courtesy of Roberto Togni (rtogni at freemail.it)
Originally committed as revision 2451 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/wc3movie.c')
-rw-r--r-- | libavformat/wc3movie.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 16e4412..cedb904 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -258,8 +258,7 @@ static int wc3_read_header(AVFormatContext *s, st->codec.height = wc3->height; /* palette considerations */ - st->codec.extradata_size = sizeof(AVPaletteControl); - st->codec.extradata = &wc3->palette_control; + st->codec.palctrl = &wc3->palette_control; st = av_new_stream(s, 0); if (!st) @@ -294,6 +293,9 @@ static int wc3_read_packet(AVFormatContext *s, unsigned char preamble[WC3_PREAMBLE_SIZE]; unsigned char text[1024]; unsigned int palette_number; + int i; + unsigned char r, g, b; + int base_palette_index; while (!packet_read) { @@ -319,9 +321,13 @@ static int wc3_read_packet(AVFormatContext *s, palette_number = LE_32(&preamble[0]); if (palette_number >= wc3->palette_count) return AVERROR_INVALIDDATA; - memcpy(wc3->palette_control.palette, - &wc3->palettes[palette_number * PALETTE_COUNT * 3], - PALETTE_COUNT * 3); + base_palette_index = palette_number * PALETTE_COUNT * 3; + for (i = 0; i < PALETTE_COUNT; i++) { + r = wc3->palettes[base_palette_index + i * 3 + 0]; + g = wc3->palettes[base_palette_index + i * 3 + 1]; + b = wc3->palettes[base_palette_index + i * 3 + 2]; + wc3->palette_control.palette[i] = (r << 16) | (g << 8) | (b); + } wc3->palette_control.palette_changed = 1; break; |