Commit 413ca0df authored by Christian Beier's avatar Christian Beier

Merge branch 'turbovnc'

Conflicts, resolved manually:
	AUTHORS
parents 25245736 1df6bffd
...@@ -35,7 +35,7 @@ Noriaki Yamazaki, Ben Klopfenstein, Vic Lee, Christian Beier, ...@@ -35,7 +35,7 @@ Noriaki Yamazaki, Ben Klopfenstein, Vic Lee, Christian Beier,
Alexander Dorokhine, Corentin Chary, Wouter Van Meir, George Kiagiadakis, Alexander Dorokhine, Corentin Chary, Wouter Van Meir, George Kiagiadakis,
Joel Martin, Gernot Tenchio, William Roberts, Cristian Rodríguez, Joel Martin, Gernot Tenchio, William Roberts, Cristian Rodríguez,
George Fleury, Kan-Ru Chen, Steve Guo, Luca Stauble, Peter Watkins, George Fleury, Kan-Ru Chen, Steve Guo, Luca Stauble, Peter Watkins,
Kyle J. McKay, Mateus Cesar Groess and Philip Van Hoof. Kyle J. McKay, Mateus Cesar Groess, Philip Van Hoof and D. R. Commander.
Probably I forgot quite a few people sending a patch here and there, which Probably I forgot quite a few people sending a patch here and there, which
really made a difference. Without those, some obscure bugs still would really made a difference. Without those, some obscure bugs still would
......
...@@ -5,6 +5,9 @@ include(CheckFunctionExists) ...@@ -5,6 +5,9 @@ include(CheckFunctionExists)
include(CheckIncludeFile) include(CheckIncludeFile)
include(CheckTypeSize) include(CheckTypeSize)
include(TestBigEndian) include(TestBigEndian)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(CheckCSourceRuns)
set(PACKAGE_NAME "LibVNCServer") set(PACKAGE_NAME "LibVNCServer")
set(FULL_PACKAGE_NAME "LibVNCServer") set(FULL_PACKAGE_NAME "LibVNCServer")
...@@ -30,6 +33,40 @@ find_package(X11) ...@@ -30,6 +33,40 @@ find_package(X11)
find_package(OpenSSL) find_package(OpenSSL)
find_library(LIBGCRYPT_LIBRARIES gcrypt) find_library(LIBGCRYPT_LIBRARIES gcrypt)
# Check whether the version of libjpeg we found was libjpeg-turbo and print a
# warning if not.
set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES})
set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR})
set(JPEG_TEST_SOURCE "\n
#include <stdio.h>\n
#include <jpeglib.h>\n
int main(void) {\n
struct jpeg_compress_struct cinfo;\n
struct jpeg_error_mgr jerr;\n
cinfo.err=jpeg_std_error(&jerr);\n
jpeg_create_compress(&cinfo);\n
cinfo.input_components = 3;\n
jpeg_set_defaults(&cinfo);\n
cinfo.in_color_space = JCS_EXT_RGB;\n
jpeg_default_colorspace(&cinfo);\n
return 0;\n
}")
if(CMAKE_CROSSCOMPILING)
check_c_source_compiles("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
else()
check_c_source_runs("${JPEG_TEST_SOURCE}" FOUND_LIBJPEG_TURBO)
endif()
set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_DEFINITIONS)
if(NOT FOUND_LIBJPEG_TURBO)
message(WARNING "*** The libjpeg library you are building against is not libjpeg-turbo. Performance will be reduced. You can obtain libjpeg-turbo from: https://sourceforge.net/projects/libjpeg-turbo/files/ ***")
endif()
set(CMAKE_REQUIRED_LIBRARIES resolv) set(CMAKE_REQUIRED_LIBRARIES resolv)
check_function_exists(__b64_ntop HAVE_B64) check_function_exists(__b64_ntop HAVE_B64)
...@@ -166,13 +203,13 @@ endif(ZLIB_FOUND) ...@@ -166,13 +203,13 @@ endif(ZLIB_FOUND)
if(JPEG_FOUND) if(JPEG_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LIBJPEG) add_definitions(-DLIBVNCSERVER_HAVE_LIBJPEG)
include_directories(${JPEG_INCLUDE_DIR}) include_directories(${JPEG_INCLUDE_DIR})
set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c) set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c ${COMMON_DIR}/turbojpeg.c)
endif(JPEG_FOUND) endif(JPEG_FOUND)
if(PNG_FOUND) if(PNG_FOUND)
add_definitions(-DLIBVNCSERVER_HAVE_LIBPNG) add_definitions(-DLIBVNCSERVER_HAVE_LIBPNG)
include_directories(${PNG_INCLUDE_DIR}) include_directories(${PNG_INCLUDE_DIR})
set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c) set(TIGHT_C ${LIBVNCSERVER_DIR}/tight.c ${COMMON_DIR}/turbojpeg.c)
endif(PNG_FOUND) endif(PNG_FOUND)
set(LIBVNCSERVER_SOURCES set(LIBVNCSERVER_SOURCES
......
This diff is collapsed.
This diff is collapsed.
...@@ -528,7 +528,11 @@ AC_ARG_WITH(jpeg, ...@@ -528,7 +528,11 @@ AC_ARG_WITH(jpeg,
# -without-jpeg with_jpeg="no" # -without-jpeg with_jpeg="no"
# -with-jpeg=/foo/dir with_jpeg="/foo/dir" # -with-jpeg=/foo/dir with_jpeg="/foo/dir"
HAVE_LIBJPEG_TURBO="false"
if test "x$with_jpeg" != "xno"; then if test "x$with_jpeg" != "xno"; then
AC_ARG_VAR(JPEG_LDFLAGS,
[Linker flags to use when linking with libjpeg, e.g. -L/foo/dir/lib -Wl,-static -ljpeg -Wl,-shared. This overrides the linker flags set by --with-jpeg.])
if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then
# add user supplied directory to flags: # add user supplied directory to flags:
saved_CPPFLAGS="$CPPFLAGS" saved_CPPFLAGS="$CPPFLAGS"
...@@ -544,9 +548,19 @@ if test "x$with_jpeg" != "xno"; then ...@@ -544,9 +548,19 @@ if test "x$with_jpeg" != "xno"; then
LDFLAGS="$LDFLAGS -R$with_jpeg/lib" LDFLAGS="$LDFLAGS -R$with_jpeg/lib"
fi fi
fi fi
if test "x$JPEG_LDFLAGS" != "x"; then
LDFLAGS="$saved_LDFLAGS"
LIBS="$LIBS $JPEG_LDFLAGS"
else
LIBS="-ljpeg"
fi
AC_CHECK_HEADER(jpeglib.h, HAVE_JPEGLIB_H="true") AC_CHECK_HEADER(jpeglib.h, HAVE_JPEGLIB_H="true")
AC_MSG_CHECKING(for jpeg_CreateCompress in libjpeg)
if test "x$HAVE_JPEGLIB_H" = "xtrue"; then if test "x$HAVE_JPEGLIB_H" = "xtrue"; then
AC_CHECK_LIB(jpeg, jpeg_CreateCompress, , HAVE_JPEGLIB_H="") AC_LINK_IFELSE([AC_LANG_CALL([], [jpeg_CreateCompress])],
[AC_MSG_RESULT(yes);
AC_DEFINE(HAVE_LIBJPEG, 1, libjpeg support enabled)],
[AC_MSG_RESULT(no); HAVE_JPEGLIB_H=""])
fi fi
if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then if test ! -z "$with_jpeg" -a "x$with_jpeg" != "xyes"; then
if test "x$HAVE_JPEGLIB_H" != "xtrue"; then if test "x$HAVE_JPEGLIB_H" != "xtrue"; then
...@@ -563,13 +577,52 @@ if test "x$with_jpeg" != "xno"; then ...@@ -563,13 +577,52 @@ if test "x$with_jpeg" != "xno"; then
This may lead to reduced performance, especially over slow links. This may lead to reduced performance, especially over slow links.
If libjpeg is in a non-standard location use --with-jpeg=DIR to If libjpeg is in a non-standard location use --with-jpeg=DIR to
indicate the header file is in DIR/include/jpeglib.h and the library indicate the header file is in DIR/include/jpeglib.h and the library
in DIR/lib/libjpeg.a. A copy of libjpeg may be obtained from: in DIR/lib/libjpeg.a. You can also set the JPEG_LDFLAGS variable to
ftp://ftp.uu.net/graphics/jpeg/ specify more detailed linker flags. A copy of libjpeg-turbo may be
obtained from: https://sourceforge.net/projects/libjpeg-turbo/files/
A copy of libjpeg may be obtained from: http://ijg.org/files/
========================================================================== ==========================================================================
]) ])
sleep 5 sleep 5
fi fi
fi fi
if test "x$HAVE_JPEGLIB_H" = "xtrue"; then
AC_MSG_CHECKING(whether JPEG library is libjpeg-turbo)
m4_define([LJT_TEST],
[AC_LANG_PROGRAM([#include <stdio.h>
#include <jpeglib.h>],
[struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
cinfo.err=jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
cinfo.input_components = 3;
jpeg_set_defaults(&cinfo);
cinfo.in_color_space = JCS_EXT_RGB;
jpeg_default_colorspace(&cinfo);
return 0;])]
)
if test "x$cross_compiling" != "xyes"; then
AC_RUN_IFELSE([LJT_TEST],
[HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
else
AC_LINK_IFELSE([LJT_TEST],
[HAVE_LIBJPEG_TURBO="true"; AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
fi
fi
if test "x$HAVE_LIBJPEG_TURBO" != "xtrue"; then
AC_MSG_WARN([
==========================================================================
*** The libjpeg library you are building against is not libjpeg-turbo.
Performance will be reduced. You can obtain libjpeg-turbo from:
https://sourceforge.net/projects/libjpeg-turbo/files/ ***
==========================================================================
])
fi
fi fi
AC_ARG_WITH(png, AC_ARG_WITH(png,
......
...@@ -46,7 +46,7 @@ EXTRA_DIST=tableinit24.c tableinittctemplate.c tabletranstemplate.c \ ...@@ -46,7 +46,7 @@ EXTRA_DIST=tableinit24.c tableinittctemplate.c tabletranstemplate.c \
if HAVE_LIBZ if HAVE_LIBZ
ZLIBSRCS = zlib.c zrle.c zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c ZLIBSRCS = zlib.c zrle.c zrleoutstream.c zrlepalettehelper.c ../common/zywrletemplate.c
if HAVE_LIBJPEG if HAVE_LIBJPEG
TIGHTSRCS = tight.c TIGHTSRCS = tight.c ../common/turbojpeg.c
endif endif
endif endif
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
/* /*
* Copyright (C) 2011-2012 D. R. Commander
* Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin * Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
* Copyright (C) 2002 RealVNC Ltd. * Copyright (C) 2002 RealVNC Ltd.
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>. * OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
...@@ -86,6 +87,21 @@ static int compat_mkdir(const char *path, int mode) ...@@ -86,6 +87,21 @@ static int compat_mkdir(const char *path, int mode)
#define mkdir compat_mkdir #define mkdir compat_mkdir
#endif #endif
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
/*
* Map of quality levels to provide compatibility with TightVNC/TigerVNC
* clients. This emulates the behavior of the TigerVNC Server.
*/
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 rfbProcessClientProtocolVersion(rfbClientPtr cl);
static void rfbProcessClientNormalMessage(rfbClientPtr cl); static void rfbProcessClientNormalMessage(rfbClientPtr cl);
static void rfbProcessClientInitMessage(rfbClientPtr cl); static void rfbProcessClientInitMessage(rfbClientPtr cl);
...@@ -383,6 +399,7 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen, ...@@ -383,6 +399,7 @@ rfbNewTCPOrUDPClient(rfbScreenInfoPtr rfbScreen,
cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION; cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION;
#endif #endif
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #ifdef LIBVNCSERVER_HAVE_LIBJPEG
cl->turboSubsampLevel = TURBO_DEFAULT_SUBSAMP;
{ {
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
...@@ -1963,6 +1980,16 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) ...@@ -1963,6 +1980,16 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
cl->enableSupportedMessages = FALSE; cl->enableSupportedMessages = FALSE;
cl->enableSupportedEncodings = FALSE; cl->enableSupportedEncodings = FALSE;
cl->enableServerIdentity = FALSE; cl->enableServerIdentity = FALSE;
#if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
cl->tightQualityLevel = -1;
#if defined(LIBVNCSERVER_HAVE_LIBJPEG) || defined(LIBVNCSERVER_HAVE_LIBPNG)
cl->tightCompressLevel = TIGHT_DEFAULT_COMPRESSION;
#endif
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
cl->turboSubsampLevel = TURBO_DEFAULT_SUBSAMP;
cl->turboQualityLevel = -1;
#endif
#endif
for (i = 0; i < msg.se.nEncodings; i++) { for (i = 0; i < msg.se.nEncodings; i++) {
...@@ -2097,6 +2124,22 @@ rfbProcessClientNormalMessage(rfbClientPtr cl) ...@@ -2097,6 +2124,22 @@ rfbProcessClientNormalMessage(rfbClientPtr cl)
cl->tightQualityLevel = enc & 0x0F; cl->tightQualityLevel = enc & 0x0F;
rfbLog("Using image quality level %d for client %s\n", rfbLog("Using image quality level %d for client %s\n",
cl->tightQualityLevel, cl->host); cl->tightQualityLevel, cl->host);
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
cl->turboQualityLevel = tight2turbo_qual[enc & 0x0F];
cl->turboSubsampLevel = tight2turbo_subsamp[enc & 0x0F];
rfbLog("Using JPEG subsampling %d, Q%d for client %s\n",
cl->turboSubsampLevel, cl->turboQualityLevel, cl->host);
} else if ( enc >= (uint32_t)rfbEncodingFineQualityLevel0 + 1 &&
enc <= (uint32_t)rfbEncodingFineQualityLevel100 ) {
cl->turboQualityLevel = enc & 0xFF;
rfbLog("Using fine quality level %d for client %s\n",
cl->turboQualityLevel, cl->host);
} else if ( enc >= (uint32_t)rfbEncodingSubsamp1X &&
enc <= (uint32_t)rfbEncodingSubsampGray ) {
cl->turboSubsampLevel = enc & 0xFF;
rfbLog("Using subsampling level %d for client %s\n",
cl->turboSubsampLevel, cl->host);
#endif
} else } else
#endif #endif
{ {
......
This diff is collapsed.
...@@ -681,6 +681,11 @@ typedef struct _rfbClientRec { ...@@ -681,6 +681,11 @@ typedef struct _rfbClientRec {
int afterEncBufLen; int afterEncBufLen;
#if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG) #if defined(LIBVNCSERVER_HAVE_LIBZ) || defined(LIBVNCSERVER_HAVE_LIBPNG)
uint32_t tightEncoding; /* rfbEncodingTight or rfbEncodingTightPng */ uint32_t tightEncoding; /* rfbEncodingTight or rfbEncodingTightPng */
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
/* TurboVNC Encoding support (extends TightVNC) */
int turboSubsampLevel;
int turboQualityLevel; // 1-100 scale
#endif
#endif #endif
#ifdef LIBVNCSERVER_WITH_WEBSOCKETS #ifdef LIBVNCSERVER_WITH_WEBSOCKETS
...@@ -880,6 +885,10 @@ extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w, ...@@ -880,6 +885,10 @@ extern rfbBool rfbSendRectEncodingZlib(rfbClientPtr cl, int x, int y, int w,
#define TIGHT_DEFAULT_COMPRESSION 6 #define TIGHT_DEFAULT_COMPRESSION 6
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
#define TURBO_DEFAULT_SUBSAMP 0
#endif
extern rfbBool rfbTightDisableGradient; extern rfbBool rfbTightDisableGradient;
extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h); extern int rfbNumCodedRectsTight(rfbClientPtr cl, int x,int y,int w,int h);
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
*/ */
/* /*
* Copyright (C) 2009-2010 D. R. Commander. All Rights Reserved.
* Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin * Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
* Copyright (C) 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (C) 2000-2002 Constantin Kaplinsky. All Rights Reserved. * Copyright (C) 2000-2002 Constantin Kaplinsky. All Rights Reserved.
* Copyright (C) 2000 Tridia Corporation. All Rights Reserved. * Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved. * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
...@@ -457,6 +459,8 @@ typedef struct { ...@@ -457,6 +459,8 @@ typedef struct {
/* /*
* Special encoding numbers: * Special encoding numbers:
* 0xFFFFFD00 .. 0xFFFFFD05 -- subsampling level
* 0xFFFFFE00 .. 0xFFFFFE64 -- fine-grained quality level (0-100 scale)
* 0xFFFFFF00 .. 0xFFFFFF0F -- encoding-specific compression levels; * 0xFFFFFF00 .. 0xFFFFFF0F -- encoding-specific compression levels;
* 0xFFFFFF10 .. 0xFFFFFF1F -- mouse cursor shape data; * 0xFFFFFF10 .. 0xFFFFFF1F -- mouse cursor shape data;
* 0xFFFFFF20 .. 0xFFFFFF2F -- various protocol extensions; * 0xFFFFFF20 .. 0xFFFFFF2F -- various protocol extensions;
...@@ -465,6 +469,15 @@ typedef struct { ...@@ -465,6 +469,15 @@ typedef struct {
* 0xFFFFFFF0 .. 0xFFFFFFFF -- cross-encoding compression levels. * 0xFFFFFFF0 .. 0xFFFFFFFF -- cross-encoding compression levels.
*/ */
#define rfbEncodingFineQualityLevel0 0xFFFFFE00
#define rfbEncodingFineQualityLevel100 0xFFFFFE64
#define rfbEncodingSubsamp1X 0xFFFFFD00
#define rfbEncodingSubsamp4X 0xFFFFFD01
#define rfbEncodingSubsamp2X 0xFFFFFD02
#define rfbEncodingSubsampGray 0xFFFFFD03
#define rfbEncodingSubsamp8X 0xFFFFFD04
#define rfbEncodingSubsamp16X 0xFFFFFD05
#define rfbEncodingCompressLevel0 0xFFFFFF00 #define rfbEncodingCompressLevel0 0xFFFFFF00
#define rfbEncodingCompressLevel1 0xFFFFFF01 #define rfbEncodingCompressLevel1 0xFFFFFF01
#define rfbEncodingCompressLevel2 0xFFFFFF02 #define rfbEncodingCompressLevel2 0xFFFFFF02
...@@ -719,12 +732,20 @@ typedef struct { ...@@ -719,12 +732,20 @@ typedef struct {
* bit 3: if 1, then compression stream 3 should be reset; * bit 3: if 1, then compression stream 3 should be reset;
* bits 7-4: if 1000 (0x08), then the compression type is "fill", * bits 7-4: if 1000 (0x08), then the compression type is "fill",
* if 1001 (0x09), then the compression type is "jpeg", * if 1001 (0x09), then the compression type is "jpeg",
* if 1001 (0x0A), then the compression type is "png", * (Tight only) if 1010 (0x0A), then the compression type is
* if 0xxx, then the compression type is "basic", * "basic" and no Zlib compression was used,
* (Tight only) if 1110 (0x0E), then the compression type is
* "basic", no Zlib compression was used, and a "filter id" byte
* follows this byte,
* (TightPng only) if 1010 (0x0A), then the compression type is
* "png",
* if 0xxx, then the compression type is "basic" and Zlib
* compression was used,
* values greater than 1010 are not valid. * values greater than 1010 are not valid.
* *
* If the compression type is "basic", then bits 6..4 of the * If the compression type is "basic" and Zlib compression was used, then bits
* compression control byte (those xxx in 0xxx) specify the following: * 6..4 of the compression control byte (those xxx in 0xxx) specify the
* following:
* *
* bits 5-4: decimal representation is the index of a particular zlib * bits 5-4: decimal representation is the index of a particular zlib
* stream which should be used for decompressing the data; * stream which should be used for decompressing the data;
...@@ -836,6 +857,7 @@ typedef struct { ...@@ -836,6 +857,7 @@ typedef struct {
#define rfbTightExplicitFilter 0x04 #define rfbTightExplicitFilter 0x04
#define rfbTightFill 0x08 #define rfbTightFill 0x08
#define rfbTightJpeg 0x09 #define rfbTightJpeg 0x09
#define rfbTightNoZlib 0x0A
#define rfbTightPng 0x0A #define rfbTightPng 0x0A
#define rfbTightMaxSubencoding 0x0A #define rfbTightMaxSubencoding 0x0A
......
INCLUDES = -I$(top_srcdir) # TurboJPEG wrapper tests
noinst_PROGRAMS=tjunittest tjbench
tjunittest_SOURCES=tjunittest.c ../common/turbojpeg.c ../common/turbojpeg.h \
tjutil.c tjutil.h
tjbench_SOURCES=tjbench.c ../common/turbojpeg.c ../common/turbojpeg.h \
tjutil.c tjutil.h bmp.c bmp.h
tjbench_LDADD=$(LDADD) -lm
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/common
LDADD = ../libvncserver/libvncserver.la ../libvncclient/libvncclient.la @WSOCKLIB@ LDADD = ../libvncserver/libvncserver.la ../libvncclient/libvncclient.la @WSOCKLIB@
if HAVE_LIBPTHREAD if HAVE_LIBPTHREAD
......
This diff is collapsed.
/* Copyright (C)2004 Landmark Graphics Corporation
* Copyright (C)2005 Sun Microsystems, Inc.
* Copyright (C)2011 D. R. Commander
*
* This library is free software and may be redistributed and/or modified under
* the terms of the wxWindows Library License, Version 3.1 or (at your option)
* any later version. The full license is in the LICENSE.txt file included
* with this distribution.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* wxWindows Library License for more details.
*/
// This provides rudimentary facilities for loading and saving true color
// BMP and PPM files
#ifndef __BMP_H__
#define __BMP_H__
#define BMPPIXELFORMATS 6
enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBX, BMP_BGR, BMP_BGRX, BMP_XBGR, BMP_XRGB};
#ifdef __cplusplus
extern "C" {
#endif
// This will load a Windows bitmap from a file and return a buffer with the
// specified pixel format, scanline alignment, and orientation. The width and
// height are returned in w and h.
int loadbmp(char *filename, unsigned char **buf, int *w, int *h,
enum BMPPIXELFORMAT f, int align, int dstbottomup);
// This will save a buffer with the specified pixel format, pitch, orientation,
// width, and height as a 24-bit Windows bitmap or PPM (the filename determines
// which format to use)
int savebmp(char *filename, unsigned char *buf, int w, int h,
enum BMPPIXELFORMAT f, int srcpitch, int srcbottomup);
const char *bmpgeterr(void);
#ifdef __cplusplus
}
#endif
#endif
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the libjpeg-turbo Project nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef _WIN32
#include <windows.h>
static double getfreq(void)
{
LARGE_INTEGER freq;
if(!QueryPerformanceFrequency(&freq)) return 0.0;
return (double)freq.QuadPart;
}
static double f=-1.0;
double gettime(void)
{
LARGE_INTEGER t;
if(f<0.0) f=getfreq();
if(f==0.0) return (double)GetTickCount()/1000.;
else
{
QueryPerformanceCounter(&t);
return (double)t.QuadPart/f;
}
}
#else
#include <stdlib.h>
#include <sys/time.h>
double gettime(void)
{
struct timeval tv;
if(gettimeofday(&tv, NULL)<0) return 0.0;
else return (double)tv.tv_sec+((double)tv.tv_usec/1000000.);
}
#endif
/*
* Copyright (C)2011 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the libjpeg-turbo Project nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef _WIN32
#ifndef __MINGW32__
#include <stdio.h>
#define snprintf(str, n, format, ...) \
_snprintf_s(str, n, _TRUNCATE, format, __VA_ARGS__)
#endif
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef max
#define max(a,b) ((a)>(b)?(a):(b))
#endif
extern double gettime(void);
...@@ -36,7 +36,7 @@ x11vnc_SOURCES = 8to24.c appshare.c avahi.c cleanup.c connections.c cursor.c gui ...@@ -36,7 +36,7 @@ x11vnc_SOURCES = 8to24.c appshare.c avahi.c cleanup.c connections.c cursor.c gui
if HAVE_SYSTEM_LIBVNCSERVER if HAVE_SYSTEM_LIBVNCSERVER
INCLUDES_LIBVNCSERVER = @SYSTEM_LIBVNCSERVER_CFLAGS@ INCLUDES_LIBVNCSERVER = @SYSTEM_LIBVNCSERVER_CFLAGS@
else else
INCLUDES_LIBVNCSERVER = INCLUDES_LIBVNCSERVER = -I${top_srcdir}
endif endif
INCLUDES = $(INCLUDES_LIBVNCSERVER) @X_CFLAGS@ @AVAHI_CFLAGS@ INCLUDES = $(INCLUDES_LIBVNCSERVER) @X_CFLAGS@ @AVAHI_CFLAGS@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment