From dd873fce451e4b7d7cc69056a62e107aae7c8e7a Mon Sep 17 00:00:00 2001 From: Eddie James Date: Mon, 18 Jun 2018 16:17:41 -0500 Subject: Tight: export SendCompressedData and SendTightHeader functions These functions can be used to send already compressed jpegs to a client, circumventing the usual rect/region update methods which operate on a raw rgb framebuffer. Rename the functions with the usual rfb prefix and add the prototypes in rfb.h. Signed-off-by: Eddie James --- libvncserver/tight.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'libvncserver/tight.c') diff --git a/libvncserver/tight.c b/libvncserver/tight.c index bca374d..1081c8f 100644 --- a/libvncserver/tight.c +++ b/libvncserver/tight.c @@ -191,7 +191,6 @@ static rfbBool CheckSolidTile32 (rfbClientPtr cl, int x, int y, int w, int h, static rfbBool SendRectSimple (rfbClientPtr cl, int x, int y, int w, int h); static rfbBool SendSubrect (rfbClientPtr cl, int x, int y, int w, int h); -static rfbBool SendTightHeader (rfbClientPtr cl, int x, int y, int w, int h); static rfbBool SendSolidRect (rfbClientPtr cl); static rfbBool SendMonoRect (rfbClientPtr cl, int x, int y, int w, int h); @@ -200,8 +199,6 @@ static rfbBool SendFullColorRect (rfbClientPtr cl, int x, int y, int w, int h); static rfbBool CompressData (rfbClientPtr cl, int streamId, int dataLen, int zlibLevel, int zlibStrategy); -static rfbBool SendCompressedData (rfbClientPtr cl, char *buf, - int compressedLen); static void FillPalette8 (int count); static void FillPalette16 (int count); @@ -430,7 +427,7 @@ SendRectEncodingTight(rfbClientPtr cl, /* Send solid-color rectangle. */ - if (!SendTightHeader(cl, x_best, y_best, w_best, h_best)) + if (!rfbSendTightHeader(cl, x_best, y_best, w_best, h_best)) return FALSE; fbptr = (cl->scaledScreen->frameBuffer + @@ -683,7 +680,7 @@ SendSubrect(rfbClientPtr cl, return FALSE; } - if (!SendTightHeader(cl, x, y, w, h)) + if (!rfbSendTightHeader(cl, x, y, w, h)) return FALSE; fbptr = (cl->scaledScreen->frameBuffer @@ -767,8 +764,8 @@ SendSubrect(rfbClientPtr cl, return success; } -static rfbBool -SendTightHeader(rfbClientPtr cl, +rfbBool +rfbSendTightHeader(rfbClientPtr cl, int x, int y, int w, @@ -1044,7 +1041,7 @@ CompressData(rfbClientPtr cl, } if (zlibLevel == 0) - return SendCompressedData (cl, tightBeforeBuf, dataLen); + return rfbSendCompressedDataTight(cl, tightBeforeBuf, dataLen); pz = &cl->zsStruct[streamId]; @@ -1083,12 +1080,12 @@ CompressData(rfbClientPtr cl, return FALSE; } - return SendCompressedData(cl, tightAfterBuf, - tightAfterBufSize - pz->avail_out); + return rfbSendCompressedDataTight(cl, tightAfterBuf, + tightAfterBufSize - pz->avail_out); } -static rfbBool SendCompressedData(rfbClientPtr cl, char *buf, - int compressedLen) +rfbBool rfbSendCompressedDataTight(rfbClientPtr cl, char *buf, + int compressedLen) { int i, portionLen; @@ -1665,7 +1662,7 @@ SendJpegRect(rfbClientPtr cl, int x, int y, int w, int h, int quality) cl->updateBuf[cl->ublen++] = (char)(rfbTightJpeg << 4); rfbStatRecordEncodingSentAdd(cl, cl->tightEncoding, 1); - return SendCompressedData(cl, tightAfterBuf, (int)size); + return rfbSendCompressedDataTight(cl, tightAfterBuf, (int)size); } static void @@ -1899,6 +1896,6 @@ static rfbBool SendPngRect(rfbClientPtr cl, int x, int y, int w, int h) { rfbStatRecordEncodingSentAdd(cl, cl->tightEncoding, 1); /* rfbLog("<< SendPngRect\n"); */ - return SendCompressedData(cl, tightAfterBuf, pngDstDataLen); + return rfbSendCompressedDataTight(cl, tightAfterBuf, pngDstDataLen); } #endif -- cgit v1.2.3 From 2411769962b1c95015bfc2d0c817a34213afbbc9 Mon Sep 17 00:00:00 2001 From: Tobias Junghans Date: Wed, 7 Nov 2018 13:03:16 +0100 Subject: LibVNCServer: properly use thread-local storage The TLS macro never has been defined due to the missing LIBVNCSERVER_HAVE_TLS macro. This revises the macro logic to also cover Win32 builds with MSVC. --- libvncserver/tight.c | 7 ++++--- libvncserver/zlib.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'libvncserver/tight.c') diff --git a/libvncserver/tight.c b/libvncserver/tight.c index 1081c8f..d6f4749 100644 --- a/libvncserver/tight.c +++ b/libvncserver/tight.c @@ -57,10 +57,11 @@ * that we resort to using thread local storage instead of having * per-client data. */ -#if LIBVNCSERVER_HAVE_LIBPTHREAD && LIBVNCSERVER_HAVE_TLS && !defined(TLS) && defined(__linux__) +#if defined(__GNUC__) #define TLS __thread -#endif -#ifndef TLS +#elif defined(_MSC_VER) +#define TLS __declspec(thread) +#else #define TLS #endif diff --git a/libvncserver/zlib.c b/libvncserver/zlib.c index 45a1314..6fee4df 100644 --- a/libvncserver/zlib.c +++ b/libvncserver/zlib.c @@ -45,10 +45,11 @@ * tight. N.B. ZRLE does it the traditional way with per-client storage * (and so at least ZRLE will work threaded on older systems.) */ -#if LIBVNCSERVER_HAVE_LIBPTHREAD && LIBVNCSERVER_HAVE_TLS && !defined(TLS) && defined(__linux__) +#if defined(__GNUC__) #define TLS __thread -#endif -#ifndef TLS +#elif defined(_MSC_VER) +#define TLS __declspec(thread) +#else #define TLS #endif -- cgit v1.2.3