[vlc-commits] XCB/XVideo: match the color bits for RGB formats

Rémi Denis-Courmont git at videolan.org
Tue Feb 15 18:20:44 CET 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb 15 19:12:28 2011 +0200| [eaa868f862ba73524d3f102edc0aae7c361cee99] | committer: Rémi Denis-Courmont

XCB/XVideo: match the color bits for RGB formats

AV16 (RGBA 4-bits per channel) was mistaken for RV16 otherwise. Pixels
occupy 16 bits, of which all 16 bits are useful, for both formats.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eaa868f862ba73524d3f102edc0aae7c361cee99
---

 modules/video_output/xcb/xvideo.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 91bc0eb..139a0bc 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -143,26 +143,26 @@ static vlc_fourcc_t ParseFormat (vout_display_t *vd,
         switch (f->num_planes)
         {
           case 1:
-            switch (f->bpp)
+            switch (popcount (f->red_mask | f->green_mask | f->blue_mask))
             {
-              case 32:
-                if (f->depth == 24)
-                    return VLC_CODEC_RGB32;
-                if (f->depth == 32)
-                    return 0; /* ARGB -> VLC cannot do that currently */
-                break;
               case 24:
-                if (f->depth == 24)
+                if (f->bpp == 32 && f->depth == 32)
+                    return 0; /* ARGB -> VLC cannot do that currently */
+                if (f->bpp == 32 && f->depth == 24)
+                    return VLC_CODEC_RGB32;
+                if (f->bpp == 24 && f->depth == 24)
                     return VLC_CODEC_RGB24;
                 break;
               case 16:
-                if (f->depth == 16)
+                if (f->bpp == 16 && f->depth == 16)
                     return VLC_CODEC_RGB16;
-                if (f->depth == 15)
+                break;
+              case 15:
+                if (f->bpp == 16 && f->depth == 15)
                     return VLC_CODEC_RGB15;
                 break;
               case 8:
-                if (f->depth == 8)
+                if (f->bpp == 8 && f->depth == 8)
                     return VLC_CODEC_RGB8;
                 break;
             }



More information about the vlc-commits mailing list