[vlc-commits] vnc: hard code likable RGB format

Rémi Denis-Courmont git at videolan.org
Mon Dec 17 18:46:09 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 17 18:06:31 2018 +0200| [5823da2f0a4f3a20b145027563a7304d20b24920] | committer: Rémi Denis-Courmont

vnc: hard code likable RGB format

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

 modules/access/vnc.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/modules/access/vnc.c b/modules/access/vnc.c
index 42dfcc2323..5013573fe1 100644
--- a/modules/access/vnc.c
+++ b/modules/access/vnc.c
@@ -166,19 +166,25 @@ static rfbBool mallocFrameBufferHandler( rfbClient* p_client )
             break;
     }
 
-    if ( i_chroma != VLC_CODEC_RGB8 ) /* Palette based, no mask */
+    switch( i_chroma )
     {
-        video_format_t videofmt;
-        video_format_Init( &videofmt, i_chroma );
-        video_format_FixRgb( &videofmt );
-
-        p_client->format.redShift = videofmt.i_lrshift;
-        p_client->format.greenShift = videofmt.i_lgshift;
-        p_client->format.blueShift = videofmt.i_lbshift;
-        p_client->format.redMax = videofmt.i_rmask >> videofmt.i_lrshift;
-        p_client->format.greenMax = videofmt.i_gmask >> videofmt.i_lgshift;
-        p_client->format.blueMax = videofmt.i_bmask >> videofmt.i_lbshift;
-        video_format_Clean( &videofmt );
+        case VLC_CODEC_RGB16:
+            p_client->format.redShift   = 11;
+            p_client->format.greenShift =  5;
+            p_client->format.blueShift  =  0;
+            p_client->format.redMax     = 0x1f;
+            p_client->format.greenMax   = 0x3f;
+            p_client->format.blueMax    = 0x1f;
+            break;
+        case VLC_CODEC_RGB24:
+        case VLC_CODEC_RGB32:
+            p_client->format.redShift   = 16;
+            p_client->format.greenShift =  8;
+            p_client->format.blueShift  =  0;
+            p_client->format.redMax     = 0xff;
+            p_client->format.greenMax   = 0xff;
+            p_client->format.blueMax    = 0xff;
+            break;
     }
 
     /* Set up framebuffer */



More information about the vlc-commits mailing list