summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xine/video_overlay.h12
-rw-r--r--src/spu_dec/spudvb_decoder.c2
-rw-r--r--src/spu_dec/spuhdmv_decoder.c3
-rw-r--r--src/xine-engine/video_overlay.c14
4 files changed, 27 insertions, 4 deletions
diff --git a/include/xine/video_overlay.h b/include/xine/video_overlay.h
index a33cb8beb..65e914a3a 100644
--- a/include/xine/video_overlay.h
+++ b/include/xine/video_overlay.h
@@ -61,7 +61,17 @@ typedef struct video_overlay_event_s {
video_overlay_manager_t *_x_video_overlay_new_manager(xine_t *) XINE_MALLOC XINE_PROTECTED;
-void _x_overlay_clut_yuv2rgb(vo_overlay_t *overlay, int color_matrix) XINE_PROTECTED;
+/* Transport color matrix setting inside those unused "foo" fields.
+ Guard against uninitialized values. */
+#define _X_SET_CLUT_CM(clut,color_matrix) { \
+ uint8_t *q = (uint8_t *)clut; \
+ q[3] = 'X'; \
+ q[7] = 'C'; \
+ q[11] = 'M'; \
+ q[15] = color_matrix; \
+}
+
+void _x_overlay_clut_yuv2rgb(vo_overlay_t *overlay, int video_color_matrix) XINE_PROTECTED;
void _x_overlay_to_argb32(const vo_overlay_t *overlay, uint32_t *rgba, int stride, const char *format) XINE_PROTECTED;
#endif
diff --git a/src/spu_dec/spudvb_decoder.c b/src/spu_dec/spudvb_decoder.c
index 553431ae5..1c58c0c97 100644
--- a/src/spu_dec/spudvb_decoder.c
+++ b/src/spu_dec/spudvb_decoder.c
@@ -1051,6 +1051,8 @@ static void draw_subtitles (dvb_spu_decoder_t * this)
reg = this->dvbsub->regions[r].img;
reg_width = this->dvbsub->regions[r].width;
}
+ /* All DVB subs I have seen so far use same color matrix as main video. */
+ _X_SET_CLUT_CM (&this->dvbsub->colours[this->dvbsub->regions[r].CLUT_id*256].u32, 4);
this->stream->osd_renderer->set_palette( this->dvbsub->regions[r].osd,
&this->dvbsub->colours[this->dvbsub->regions[r].CLUT_id*256].u32,
&this->dvbsub->trans[this->dvbsub->regions[r].CLUT_id*256]);
diff --git a/src/spu_dec/spuhdmv_decoder.c b/src/spu_dec/spuhdmv_decoder.c
index 9ad912e14..2d457b85a 100644
--- a/src/spu_dec/spuhdmv_decoder.c
+++ b/src/spu_dec/spuhdmv_decoder.c
@@ -378,6 +378,9 @@ static subtitle_clut_t *segbuf_decode_palette(segment_buffer_t *buf)
clut->trans[index] = alpha >> 4;
}
+ /* HDMV subs always use same color matrix as main video. */
+ _X_SET_CLUT_CM (clut->color, 4);
+
return clut;
}
diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c
index eb5abf201..ec749054b 100644
--- a/src/xine-engine/video_overlay.c
+++ b/src/xine-engine/video_overlay.c
@@ -494,15 +494,23 @@ static int video_overlay_event( video_overlay_t *this, int64_t vpts ) {
return processed;
}
-void _x_overlay_clut_yuv2rgb(vo_overlay_t *overlay, int color_matrix)
+void _x_overlay_clut_yuv2rgb(vo_overlay_t *overlay, int video_color_matrix)
{
+ int cm = 10; /* ITU-R 601 (SD) */
+
if (!overlay->rgb_clut) {
- _x_clut_yuv2rgb(overlay->color, sizeof(overlay->color) / sizeof (overlay->color[0]), color_matrix);
+ uint8_t *p = (uint8_t *)overlay->color;
+ if ((p[3] == 'X') && (p[7] == 'C') && (p[11] == 'M')) {
+ cm = p[15];
+ if ((cm >> 1) == 2) /* undefined */
+ cm = video_color_matrix;
+ }
+ _x_clut_yuv2rgb(overlay->color, sizeof(overlay->color) / sizeof (overlay->color[0]), cm);
overlay->rgb_clut++;
}
if (!overlay->hili_rgb_clut) {
- _x_clut_yuv2rgb(overlay->hili_color, sizeof (overlay->color) / sizeof (overlay->color[0]), color_matrix);
+ _x_clut_yuv2rgb(overlay->hili_color, sizeof (overlay->color) / sizeof (overlay->color[0]), cm);
overlay->hili_rgb_clut++;
}
}