]> git.sesse.net Git - vlc/commitdiff
XCB: grey scale output support
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Mon, 26 Jan 2009 20:57:29 +0000 (22:57 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Mon, 26 Jan 2009 20:58:31 +0000 (22:58 +0200)
There is a problem with blending GREY on GREY though.
Use `Xephyr -grayscale` to test.

modules/video_output/xcb/xcb.c

index f4f982b06c5a170e049834b13d7d6602bfa84cbb..2cd95fb2a5352158dc4080ff71728d3214f6b082 100644 (file)
@@ -82,6 +82,7 @@ struct vout_sys_t
     xcb_window_t window; /* drawable X window */
     xcb_gcontext_t gc; /* context to put images */
     bool shm; /* whether to use MIT-SHM */
+    bool gray; /* whether display is grayscale */
     uint8_t bpp; /* bits per pixel */
 };
 
@@ -147,6 +148,7 @@ static int Open (vlc_object_t *obj)
 
     /* Determine the visual (color depth and palette) */
     xcb_visualtype_t *vt = NULL;
+    p_sys->gray = false;
     if ((vt = xcb_aux_find_visual_by_attrs (scr, XCB_VISUAL_CLASS_TRUE_COLOR,
                                             scr->root_depth)) != NULL)
         msg_Dbg (vout, "using TrueColor visual ID %d", (int)vt->visual_id);
@@ -155,6 +157,14 @@ static int Open (vlc_object_t *obj)
                                             scr->root_depth)) != NULL)
         msg_Dbg (vout, "using static color visual ID %d", (int)vt->visual_id);
     else
+    if ((scr->root_depth == 8)
+     && (vt = xcb_aux_find_visual_by_attrs (scr, XCB_VISUAL_CLASS_STATIC_GRAY,
+                                            scr->root_depth)) != NULL)
+    {
+        msg_Dbg (vout, "using static gray visual ID %d", (int)vt->visual_id);
+        p_sys->gray = true;
+    }
+    else
     {
         vt = xcb_aux_find_visual_by_id (scr, scr->root_visual);
         assert (vt);
@@ -388,7 +398,9 @@ static int Init (vout_thread_t *vout)
             break;
 
         case 8: /* FIXME: VLC cannot convert */
-            vout->output.i_chroma = VLC_FOURCC ('R', 'G', 'B', '2');
+            vout->output.i_chroma =
+                p_sys->gray ? VLC_FOURCC ('G', 'R', 'E', 'Y')
+                            : VLC_FOURCC ('R', 'G', 'B', '2');
             break;
 
         default: