[MPlayer-dev-eng] [PATCH] Fix all-black palette
Nick Andrew
nick at nick-andrew.net
Mon Feb 1 14:23:03 CET 2010
If global_palette is all-black before reading the idx file then
leave auto_palette set to 1, so palette colours are computed on
the fly. Prevents black-on-black subtitles.
---
spudec.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/spudec.c b/spudec.c
index 3824f12..6925061 100644
--- a/spudec.c
+++ b/spudec.c
@@ -1170,11 +1170,21 @@ void *spudec_new_scaled(unsigned int *palette, unsigned int frame_width, unsigne
spudec_handle_t *this = calloc(1, sizeof(spudec_handle_t));
if (this){
this->orig_frame_height = frame_height;
+ this->auto_palette = 1;
// set up palette:
- if (palette)
+ if (palette) {
+ int i;
memcpy(this->global_palette, palette, sizeof(this->global_palette));
- else
- this->auto_palette = 1;
+ /* If palette is all zeroes, we probably don't have one at all,
+ so leave auto_palette set to 1 */
+ for (i = 0; i < 16; ++i) {
+ if (palette[i]) {
+ this->auto_palette = 0;
+ break;
+ }
+ }
+ }
+
if (extradata)
spudec_parse_extradata(this, extradata, extradata_len);
/* XXX Although the video frame is some size, the SPU frame is
--
1.6.2.4
More information about the MPlayer-dev-eng
mailing list