diff options
Diffstat (limited to 'libvncserver/rfbserver.c')
-rw-r--r-- | libvncserver/rfbserver.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c index 9be255f..04231f2 100644 --- a/libvncserver/rfbserver.c +++ b/libvncserver/rfbserver.c @@ -3,6 +3,7 @@ */ /* + * Copyright (C) 2011 D. R. Commander * Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin * Copyright (C) 2002 RealVNC Ltd. * OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>. @@ -85,6 +86,21 @@ static int compat_mkdir(const char *path, int mode) #define mkdir compat_mkdir #endif +#ifdef LIBVNCSERVER_HAVE_TURBOVNC +/* + * Map of quality levels to provide compatibility with TightVNC/TigerVNC + * clients + */ + +static const int tight2turbo_qual[10] = { + 15, 29, 41, 42, 62, 77, 79, 86, 92, 100 +}; + +static const int tight2turbo_subsamp[10] = { + 1, 1, 1, 2, 2, 2, 0, 0, 0, 0 +}; +#endif + static void rfbProcessClientProtocolVersion(rfbClientPtr cl); static void rfbProcessClientNormalMessage(rfbClientPtr cl); static void rfbProcessClientInitMessage(rfbClientPtr cl); @@ -367,6 +383,9 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen, #if defined(LIBVNCSERVER_HAVE_LIBJPEG) || defined(LIBVNCSERVER_HAVE_LIBPNG) cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION; #endif +#ifdef LIBVNCSERVER_HAVE_TURBOVNC + cl->tightSubsampLevel = TIGHT_DEFAULT_SUBSAMP; +#endif #ifdef LIBVNCSERVER_HAVE_LIBJPEG { int i; @@ -2077,11 +2096,30 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) rfbLog("Using compression level %d for client %s\n", cl->tightCompressLevel, cl->host); #endif +#ifdef LIBVNCSERVER_HAVE_TURBOVNC + } else if ( enc >= (uint32_t)rfbEncodingSubsamp1X && + enc <= (uint32_t)rfbEncodingSubsampGray ) { + cl->tightSubsampLevel = enc & 0xFF; + rfbLog("Using JPEG subsampling %d for client %s\n", + cl->tightSubsampLevel, cl->host); + } else if ( enc >= (uint32_t)rfbEncodingQualityLevel0 && + enc <= (uint32_t)rfbEncodingQualityLevel9 ) { + cl->tightQualityLevel = tight2turbo_qual[enc & 0x0F]; + cl->tightSubsampLevel = tight2turbo_subsamp[enc & 0x0F]; + rfbLog("Using JPEG subsampling %d, Q%d for client %s\n", + cl->tightSubsampLevel, cl->tightQualityLevel, cl->host); + } else if ( enc >= (uint32_t)rfbEncodingFineQualityLevel0 + 1 && + enc <= (uint32_t)rfbEncodingFineQualityLevel100 ) { + cl->tightQualityLevel = enc & 0xFF; + rfbLog("Using image quality level %d for client %s\n", + cl->tightQualityLevel, cl->host); +#else } else if ( enc >= (uint32_t)rfbEncodingQualityLevel0 && enc <= (uint32_t)rfbEncodingQualityLevel9 ) { cl->tightQualityLevel = enc & 0x0F; rfbLog("Using image quality level %d for client %s\n", cl->tightQualityLevel, cl->host); +#endif } else #endif { |