Mercurial > mplayer.hg
comparison libmpdemux/demux_mov.c @ 4332:ae889abf93cd
QT demuxer now supports the default QT palettes
author | melanson |
---|---|
date | Thu, 24 Jan 2002 05:20:19 +0000 |
parents | 31cd2e0bb961 |
children | 2330366f9255 |
comparison
equal
deleted
inserted
replaced
4331:ce1e3668fa2b | 4332:ae889abf93cd |
---|---|
15 #include "stream.h" | 15 #include "stream.h" |
16 #include "demuxer.h" | 16 #include "demuxer.h" |
17 #include "stheader.h" | 17 #include "stheader.h" |
18 | 18 |
19 #include "bswap.h" | 19 #include "bswap.h" |
20 | |
21 #include "qtpalette.h" | |
20 | 22 |
21 #ifdef HAVE_ZLIB | 23 #ifdef HAVE_ZLIB |
22 #include <zlib.h> | 24 #include <zlib.h> |
23 #endif | 25 #endif |
24 | 26 |
598 count_flag = BE_16(&trak->stdata[hdr_ptr]); | 600 count_flag = BE_16(&trak->stdata[hdr_ptr]); |
599 hdr_ptr += 2; | 601 hdr_ptr += 2; |
600 end = BE_16(&trak->stdata[hdr_ptr]); | 602 end = BE_16(&trak->stdata[hdr_ptr]); |
601 hdr_ptr += 2; | 603 hdr_ptr += 2; |
602 palette_map = (unsigned char *)sh->bih + 40; | 604 palette_map = (unsigned char *)sh->bih + 40; |
603 for (i = start; i <= end; i++) | 605 |
606 // load default palette | |
607 if (flag & 0x08) | |
604 { | 608 { |
605 entry = BE_16(&trak->stdata[hdr_ptr]); | 609 if (palette_count == 4) |
606 hdr_ptr += 2; | 610 memcpy(palette_map, qt_default_palette_4, 4 * 4); |
607 // apparently, if count_flag is set, entry is same as i | 611 else if (palette_count == 16) |
608 if (count_flag & 0x8000) | 612 memcpy(palette_map, qt_default_palette_16, 16 * 4); |
609 entry = i; | 613 if (palette_count == 256) |
610 // only care about top 8 bits of 16-bit R, G, or B value | 614 memcpy(palette_map, qt_default_palette_256, 256 * 4); |
611 palette_map[entry * 4 + 0] = trak->stdata[hdr_ptr + 0]; | 615 } |
612 palette_map[entry * 4 + 1] = trak->stdata[hdr_ptr + 2]; | 616 // load palette from file |
613 palette_map[entry * 4 + 2] = trak->stdata[hdr_ptr + 4]; | 617 else |
614 hdr_ptr += 6; | 618 { |
619 for (i = start; i <= end; i++) | |
620 { | |
621 entry = BE_16(&trak->stdata[hdr_ptr]); | |
622 hdr_ptr += 2; | |
623 // apparently, if count_flag is set, entry is same as i | |
624 if (count_flag & 0x8000) | |
625 entry = i; | |
626 // only care about top 8 bits of 16-bit R, G, or B value | |
627 palette_map[entry * 4 + 0] = trak->stdata[hdr_ptr + 0]; | |
628 palette_map[entry * 4 + 1] = trak->stdata[hdr_ptr + 2]; | |
629 palette_map[entry * 4 + 2] = trak->stdata[hdr_ptr + 4]; | |
630 hdr_ptr += 6; | |
631 } | |
615 } | 632 } |
616 } | 633 } |
617 else | 634 else |
618 { | 635 { |
619 sh->bih=malloc(sizeof(BITMAPINFOHEADER)); | 636 sh->bih=malloc(sizeof(BITMAPINFOHEADER)); |