Milestone 5: deliver embedded RDP sessions and lifecycle hardening
This commit is contained in:
244
third_party/FreeRDP/include/freerdp/codec/audio.h
vendored
Normal file
244
third_party/FreeRDP/include/freerdp/codec/audio.h
vendored
Normal file
@@ -0,0 +1,244 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Audio Formats
|
||||
*
|
||||
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_AUDIO_H
|
||||
#define FREERDP_CODEC_AUDIO_H
|
||||
|
||||
#include <winpr/wlog.h>
|
||||
#include <winpr/wtypes.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct AUDIO_FORMAT
|
||||
{
|
||||
UINT16 wFormatTag;
|
||||
UINT16 nChannels;
|
||||
UINT32 nSamplesPerSec;
|
||||
UINT32 nAvgBytesPerSec;
|
||||
UINT16 nBlockAlign;
|
||||
UINT16 wBitsPerSample;
|
||||
UINT16 cbSize;
|
||||
BYTE* data;
|
||||
};
|
||||
typedef struct AUDIO_FORMAT AUDIO_FORMAT;
|
||||
|
||||
#define SNDC_CLOSE 1
|
||||
#define SNDC_WAVE 2
|
||||
#define SNDC_SETVOLUME 3
|
||||
#define SNDC_SETPITCH 4
|
||||
#define SNDC_WAVECONFIRM 5
|
||||
#define SNDC_TRAINING 6
|
||||
#define SNDC_FORMATS 7
|
||||
#define SNDC_CRYPTKEY 8
|
||||
#define SNDC_WAVEENCRYPT 9
|
||||
#define SNDC_UDPWAVE 10
|
||||
#define SNDC_UDPWAVELAST 11
|
||||
#define SNDC_QUALITYMODE 12
|
||||
#define SNDC_WAVE2 13
|
||||
|
||||
#define TSSNDCAPS_ALIVE 1
|
||||
#define TSSNDCAPS_VOLUME 2
|
||||
#define TSSNDCAPS_PITCH 4
|
||||
|
||||
#define DYNAMIC_QUALITY 0x0000
|
||||
#define MEDIUM_QUALITY 0x0001
|
||||
#define HIGH_QUALITY 0x0002
|
||||
|
||||
/*
|
||||
* Format Tags:
|
||||
* http://tools.ietf.org/html/rfc2361
|
||||
*/
|
||||
|
||||
#ifndef WAVE_FORMAT_UNKNOWN
|
||||
#define WAVE_FORMAT_UNKNOWN 0x0000
|
||||
#endif /* !WAVE_FORMAT_UNKNOWN */
|
||||
|
||||
#ifndef WAVE_FORMAT_PCM
|
||||
#define WAVE_FORMAT_PCM 0x0001
|
||||
#endif /* !WAVE_FORMAT_PCM */
|
||||
|
||||
#ifndef WAVE_FORMAT_ADPCM
|
||||
#define WAVE_FORMAT_ADPCM 0x0002
|
||||
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
|
||||
#define WAVE_FORMAT_VSELP 0x0004
|
||||
#define WAVE_FORMAT_IBM_CVSD 0x0005
|
||||
#define WAVE_FORMAT_ALAW 0x0006
|
||||
#define WAVE_FORMAT_MULAW 0x0007
|
||||
#define WAVE_FORMAT_OKI_ADPCM 0x0010
|
||||
#define WAVE_FORMAT_DVI_ADPCM 0x0011
|
||||
#define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012
|
||||
#define WAVE_FORMAT_SIERRA_ADPCM 0x0013
|
||||
#define WAVE_FORMAT_G723_ADPCM 0x0014
|
||||
#define WAVE_FORMAT_DIGISTD 0x0015
|
||||
#define WAVE_FORMAT_DIGIFIX 0x0016
|
||||
#define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017
|
||||
#define WAVE_FORMAT_MEDIAVISION_ADPCM 0x0018
|
||||
#define WAVE_FORMAT_CU_CODEC 0x0019
|
||||
#define WAVE_FORMAT_YAMAHA_ADPCM 0x0020
|
||||
#define WAVE_FORMAT_SONARC 0x0021
|
||||
#define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022
|
||||
#define WAVE_FORMAT_ECHOSC1 0x0023
|
||||
#define WAVE_FORMAT_AUDIOFILE_AF36 0x0024
|
||||
#define WAVE_FORMAT_APTX 0x0025
|
||||
#define WAVE_FORMAT_AUDIOFILE_AF10 0x0026
|
||||
#define WAVE_FORMAT_PROSODY_1612 0x0027
|
||||
#define WAVE_FORMAT_LRC 0x0028
|
||||
#define WAVE_FORMAT_DOLBY_AC2 0x0030
|
||||
#define WAVE_FORMAT_GSM610 0x0031
|
||||
#define WAVE_FORMAT_MSNAUDIO 0x0032
|
||||
#define WAVE_FORMAT_ANTEX_ADPCME 0x0033
|
||||
#define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034
|
||||
#define WAVE_FORMAT_DIGIREAL 0x0035
|
||||
#define WAVE_FORMAT_DIGIADPCM 0x0036
|
||||
#define WAVE_FORMAT_CONTROL_RES_CR10 0x0037
|
||||
#define WAVE_FORMAT_NMS_VBXADPCM 0x0038
|
||||
#define WAVE_FORMAT_ROLAND_RDAC 0x0039
|
||||
#define WAVE_FORMAT_ECHOSC3 0x003A
|
||||
#define WAVE_FORMAT_ROCKWELL_ADPCM 0x003B
|
||||
#define WAVE_FORMAT_ROCKWELL_DIGITALK 0x003C
|
||||
#define WAVE_FORMAT_XEBEC 0x003D
|
||||
#define WAVE_FORMAT_G721_ADPCM 0x0040
|
||||
#define WAVE_FORMAT_G728_CELP 0x0041
|
||||
#define WAVE_FORMAT_MSG723 0x0042
|
||||
#define WAVE_FORMAT_MPEG 0x0050
|
||||
#define WAVE_FORMAT_RT24 0x0052
|
||||
#define WAVE_FORMAT_PAC 0x0053
|
||||
#endif /* !WAVE_FORMAT_ADPCM */
|
||||
|
||||
#ifndef WAVE_FORMAT_MPEGLAYER3
|
||||
#define WAVE_FORMAT_MPEGLAYER3 0x0055
|
||||
#endif
|
||||
|
||||
#ifndef WAVE_FORMAT_LUCENT_G723
|
||||
#define WAVE_FORMAT_LUCENT_G723 0x0059
|
||||
#define WAVE_FORMAT_CIRRUS 0x0060
|
||||
#define WAVE_FORMAT_ESPCM 0x0061
|
||||
#define WAVE_FORMAT_VOXWARE 0x0062
|
||||
#define WAVE_FORMAT_CANOPUS_ATRAC 0x0063
|
||||
#define WAVE_FORMAT_G726_ADPCM 0x0064
|
||||
#define WAVE_FORMAT_G722_ADPCM 0x0065
|
||||
#define WAVE_FORMAT_DSAT 0x0066
|
||||
#define WAVE_FORMAT_DSAT_DISPLAY 0x0067
|
||||
#define WAVE_FORMAT_VOXWARE_BYTE_ALIGNED 0x0069
|
||||
#define WAVE_FORMAT_VOXWARE_AC8 0x0070
|
||||
#define WAVE_FORMAT_VOXWARE_AC10 0x0071
|
||||
#define WAVE_FORMAT_VOXWARE_AC16 0x0072
|
||||
#define WAVE_FORMAT_VOXWARE_AC20 0x0073
|
||||
#define WAVE_FORMAT_VOXWARE_RT24 0x0074
|
||||
#define WAVE_FORMAT_VOXWARE_RT29 0x0075
|
||||
#define WAVE_FORMAT_VOXWARE_RT29HW 0x0076
|
||||
#define WAVE_FORMAT_VOXWARE_VR12 0x0077
|
||||
#define WAVE_FORMAT_VOXWARE_VR18 0x0078
|
||||
#define WAVE_FORMAT_VOXWARE_TQ40 0x0079
|
||||
#define WAVE_FORMAT_SOFTSOUND 0x0080
|
||||
#define WAVE_FORMAT_VOXWARE_TQ60 0x0081
|
||||
#define WAVE_FORMAT_MSRT24 0x0082
|
||||
#define WAVE_FORMAT_G729A 0x0083
|
||||
#define WAVE_FORMAT_MVI_MV12 0x0084
|
||||
#define WAVE_FORMAT_DF_G726 0x0085
|
||||
#define WAVE_FORMAT_DF_GSM610 0x0086
|
||||
#define WAVE_FORMAT_ISIAUDIO 0x0088
|
||||
#define WAVE_FORMAT_ONLIVE 0x0089
|
||||
#define WAVE_FORMAT_SBC24 0x0091
|
||||
#define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092
|
||||
#define WAVE_FORMAT_ZYXEL_ADPCM 0x0097
|
||||
#define WAVE_FORMAT_PHILIPS_LPCBB 0x0098
|
||||
#define WAVE_FORMAT_PACKED 0x0099
|
||||
#define WAVE_FORMAT_RHETOREX_ADPCM 0x0100
|
||||
#define WAVE_FORMAT_IRAT 0x0101
|
||||
#define WAVE_FORMAT_VIVO_G723 0x0111
|
||||
#define WAVE_FORMAT_VIVO_SIREN 0x0112
|
||||
#define WAVE_FORMAT_DIGITAL_G723 0x0123
|
||||
#define WAVE_FORMAT_WMAUDIO2 0x0161
|
||||
#define WAVE_FORMAT_WMAUDIO3 0x0162
|
||||
#define WAVE_FORMAT_WMAUDIO_LOSSLESS 0x0163
|
||||
#define WAVE_FORMAT_CREATIVE_ADPCM 0x0200
|
||||
#define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202
|
||||
#define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203
|
||||
#define WAVE_FORMAT_QUARTERDECK 0x0220
|
||||
#define WAVE_FORMAT_FM_TOWNS_SND 0x0300
|
||||
#define WAVE_FORMAT_BTV_DIGITAL 0x0400
|
||||
#define WAVE_FORMAT_VME_VMPCM 0x0680
|
||||
#define WAVE_FORMAT_OLIGSM 0x1000
|
||||
#define WAVE_FORMAT_OLIADPCM 0x1001
|
||||
#define WAVE_FORMAT_OLICELP 0x1002
|
||||
#define WAVE_FORMAT_OLISBC 0x1003
|
||||
#define WAVE_FORMAT_OLIOPR 0x1004
|
||||
#define WAVE_FORMAT_LH_CODEC 0x1100
|
||||
#define WAVE_FORMAT_NORRIS 0x1400
|
||||
#define WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS 0x1500
|
||||
#define WAVE_FORMAT_DVM 0x2000
|
||||
#endif /* !WAVE_FORMAT_LUCENT_G723 */
|
||||
|
||||
/** Opus format identifier
|
||||
* \since version 3.0.0
|
||||
*/
|
||||
#define WAVE_FORMAT_OPUS 0x704F
|
||||
#define WAVE_FORMAT_AAC_MS 0xA106
|
||||
|
||||
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE
|
||||
|
||||
/**
|
||||
* Audio Format Functions
|
||||
*/
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT32 audio_format_compute_time_length(const AUDIO_FORMAT* format, size_t size);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const char* audio_format_get_tag_string(UINT16 wFormatTag);
|
||||
|
||||
FREERDP_API void audio_format_print(wLog* log, DWORD level, const AUDIO_FORMAT* format);
|
||||
FREERDP_API void audio_formats_print(wLog* log, DWORD level, const AUDIO_FORMAT* formats,
|
||||
UINT16 count);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL audio_format_read(wStream* s, AUDIO_FORMAT* format);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL audio_format_write(wStream* s, const AUDIO_FORMAT* format);
|
||||
|
||||
FREERDP_API BOOL audio_format_copy(const AUDIO_FORMAT* WINPR_RESTRICT srcFormat,
|
||||
AUDIO_FORMAT* WINPR_RESTRICT dstFormat);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL audio_format_compatible(const AUDIO_FORMAT* with, const AUDIO_FORMAT* what);
|
||||
|
||||
FREERDP_API void audio_format_free(AUDIO_FORMAT* format);
|
||||
FREERDP_API void audio_formats_free(AUDIO_FORMAT* formats, size_t count);
|
||||
|
||||
WINPR_ATTR_MALLOC(audio_formats_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API AUDIO_FORMAT* audio_format_new(void);
|
||||
|
||||
WINPR_ATTR_MALLOC(audio_formats_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API AUDIO_FORMAT* audio_formats_new(size_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_AUDIO_H */
|
||||
46
third_party/FreeRDP/include/freerdp/codec/bitmap.h
vendored
Normal file
46
third_party/FreeRDP/include/freerdp/codec/bitmap.h
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Compressed Bitmap
|
||||
*
|
||||
* Copyright 2011 Jay Sorg <jay.sorg@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_BITMAP_H
|
||||
#define FREERDP_CODEC_BITMAP_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#include <freerdp/codec/color.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/stream.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API SSIZE_T freerdp_bitmap_compress(const void* WINPR_RESTRICT srcData, UINT32 width,
|
||||
UINT32 height, wStream* WINPR_RESTRICT s,
|
||||
UINT32 bpp, UINT32 byte_limit, UINT32 start_line,
|
||||
wStream* WINPR_RESTRICT temp_s, UINT32 e);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_BITMAP_H */
|
||||
39
third_party/FreeRDP/include/freerdp/codec/bulk.h
vendored
Normal file
39
third_party/FreeRDP/include/freerdp/codec/bulk.h
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Bulk Data Compression
|
||||
*
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_BULK_H
|
||||
#define FREERDP_CODEC_BULK_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
/* Level-2 Compression Flags */
|
||||
|
||||
#define PACKET_COMPRESSED 0x20
|
||||
#define PACKET_AT_FRONT 0x40
|
||||
#define PACKET_FLUSHED 0x80
|
||||
|
||||
/* Level-1 Compression Flags */
|
||||
|
||||
#define L1_PACKET_AT_FRONT 0x04
|
||||
#define L1_NO_COMPRESSION 0x02
|
||||
#define L1_COMPRESSED 0x01
|
||||
#define L1_INNER_COMPRESSION 0x10
|
||||
|
||||
#endif /* FREERDP_CODEC_BULK_H */
|
||||
63
third_party/FreeRDP/include/freerdp/codec/clear.h
vendored
Normal file
63
third_party/FreeRDP/include/freerdp/codec/clear.h
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* ClearCodec Bitmap Compression
|
||||
*
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_CLEAR_H
|
||||
#define FREERDP_CODEC_CLEAR_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#include <freerdp/codec/nsc.h>
|
||||
#include <freerdp/codec/color.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_CLEAR_CONTEXT CLEAR_CONTEXT;
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API int clear_compress(CLEAR_CONTEXT* WINPR_RESTRICT clear,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
BYTE** WINPR_RESTRICT ppDstData,
|
||||
UINT32* WINPR_RESTRICT pDstSize);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32 clear_decompress(CLEAR_CONTEXT* WINPR_RESTRICT clear,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
UINT32 nWidth, UINT32 nHeight, BYTE* WINPR_RESTRICT pDstData,
|
||||
UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
|
||||
UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight,
|
||||
const gdiPalette* WINPR_RESTRICT palette);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL clear_context_reset(CLEAR_CONTEXT* WINPR_RESTRICT clear);
|
||||
|
||||
FREERDP_API void clear_context_free(CLEAR_CONTEXT* WINPR_RESTRICT clear);
|
||||
|
||||
WINPR_ATTR_MALLOC(clear_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API CLEAR_CONTEXT* clear_context_new(BOOL Compressor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_CLEAR_H */
|
||||
527
third_party/FreeRDP/include/freerdp/codec/color.h
vendored
Normal file
527
third_party/FreeRDP/include/freerdp/codec/color.h
vendored
Normal file
@@ -0,0 +1,527 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Color Conversion Routines
|
||||
*
|
||||
* Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
|
||||
* Copyright 2016 Thincast Technologies GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_COLOR_H
|
||||
#define FREERDP_CODEC_COLOR_H
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <freerdp/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_A 0
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_ARGB 1
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_ABGR 2
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_RGBA 3
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE_BGRA 4
|
||||
|
||||
#define FREERDP_PIXEL_FORMAT_IS_ABGR(_format) \
|
||||
(FREERDP_PIXEL_FORMAT_TYPE(_format) == FREERDP_PIXEL_FORMAT_TYPE_ABGR)
|
||||
|
||||
/** @brief Flags for image copy operations */
|
||||
enum FREERDP_IMAGE_FLAGS
|
||||
{
|
||||
FREERDP_FLIP_NONE = 0,
|
||||
FREERDP_FLIP_VERTICAL = 1,
|
||||
FREERDP_FLIP_HORIZONTAL = 2,
|
||||
FREERDP_KEEP_DST_ALPHA = 4
|
||||
};
|
||||
|
||||
#define FREERDP_PIXEL_FORMAT(_bpp, _type, _a, _r, _g, _b) \
|
||||
((_bpp << 24) | (_type << 16) | (_a << 12) | (_r << 8) | (_g << 4) | (_b))
|
||||
|
||||
#define FREERDP_PIXEL_FORMAT_TYPE(_format) (((_format) >> 16) & 0x07)
|
||||
|
||||
/*** Design considerations
|
||||
*
|
||||
* The format naming scheme is based on byte position in memory.
|
||||
* RGBA for example names a byte array with red on position 0, green on 1 etc.
|
||||
*
|
||||
* To read and write the appropriate format from / to memory use FreeRDPReadColor and
|
||||
* FreeRDPWriteColor.
|
||||
*
|
||||
* The single pixel manipulation functions use an intermediate integer representation
|
||||
* that must not be interpreted outside the functions as it is platform dependent.
|
||||
*
|
||||
* X for alpha channel denotes unused (but existing) alpha channel data.
|
||||
*/
|
||||
|
||||
/** @defgroup PIXEL_FORMAT Pixel formats
|
||||
* @brief PIXEL color ordering formats known
|
||||
* @{
|
||||
*/
|
||||
/* 32bpp formats */
|
||||
#define PIXEL_FORMAT_ARGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 8, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_XRGB32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_ABGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 8, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_XBGR32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_BGRA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 8, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_BGRX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_RGBA32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 8, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_RGBX32 FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_BGRX32_DEPTH30 \
|
||||
FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_BGRA, 0, 10, 10, 10)
|
||||
#define PIXEL_FORMAT_RGBX32_DEPTH30 \
|
||||
FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_RGBA, 0, 10, 10, 10)
|
||||
|
||||
/* 24bpp formats */
|
||||
#define PIXEL_FORMAT_RGB24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 8, 8, 8)
|
||||
#define PIXEL_FORMAT_BGR24 FREERDP_PIXEL_FORMAT(24, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 8, 8, 8)
|
||||
|
||||
/* 16bpp formats */
|
||||
#define PIXEL_FORMAT_RGB16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 6, 5)
|
||||
#define PIXEL_FORMAT_BGR16 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 6, 5)
|
||||
#define PIXEL_FORMAT_ARGB15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 1, 5, 5, 5)
|
||||
#define PIXEL_FORMAT_RGB15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ARGB, 0, 5, 5, 5)
|
||||
#define PIXEL_FORMAT_ABGR15 FREERDP_PIXEL_FORMAT(16, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 1, 5, 5, 5)
|
||||
#define PIXEL_FORMAT_BGR15 FREERDP_PIXEL_FORMAT(15, FREERDP_PIXEL_FORMAT_TYPE_ABGR, 0, 5, 5, 5)
|
||||
|
||||
/* 8bpp formats */
|
||||
#define PIXEL_FORMAT_RGB8 FREERDP_PIXEL_FORMAT(8, FREERDP_PIXEL_FORMAT_TYPE_A, 8, 0, 0, 0)
|
||||
|
||||
/* 4 bpp formats */
|
||||
#define PIXEL_FORMAT_A4 FREERDP_PIXEL_FORMAT(4, FREERDP_PIXEL_FORMAT_TYPE_A, 4, 0, 0, 0)
|
||||
|
||||
/* 1bpp formats */
|
||||
#define PIXEL_FORMAT_MONO FREERDP_PIXEL_FORMAT(1, FREERDP_PIXEL_FORMAT_TYPE_A, 1, 0, 0, 0)
|
||||
|
||||
/** @} */
|
||||
|
||||
struct gdi_palette
|
||||
{
|
||||
UINT32 format;
|
||||
UINT32 palette[256];
|
||||
};
|
||||
typedef struct gdi_palette gdiPalette;
|
||||
|
||||
/* Compare two color formats but ignore differences in alpha channel.
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API DWORD FreeRDPAreColorFormatsEqualNoAlpha(DWORD first, DWORD second);
|
||||
|
||||
/* Color Space Conversions: http://msdn.microsoft.com/en-us/library/ff566496/ */
|
||||
|
||||
/***
|
||||
*
|
||||
* Get a string representation of a color
|
||||
*
|
||||
* @param format The pixel color format
|
||||
*
|
||||
* @return A string representation of format
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define GetColorFormatName(...) FreeRDPGetColorFormatName(__VA_ARGS__)
|
||||
#endif
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const char* FreeRDPGetColorFormatName(UINT32 format);
|
||||
|
||||
/** @brief convert a string to a \ref PIXEL_FORMAT
|
||||
*
|
||||
* @param name The string representing the format
|
||||
*
|
||||
* @return the \ref PIXEL_FORMAT value or \b 0 for failure
|
||||
* @since version 3.18.0
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API uint32_t FreeRDPGetColorFromatFromName(const char* name);
|
||||
|
||||
/***
|
||||
*
|
||||
* Converts a pixel color in internal representation to its red, green, blue
|
||||
* and alpha components.
|
||||
*
|
||||
* @param color The color in format internal representation
|
||||
* @param format one of PIXEL_FORMAT_* color format defines
|
||||
* @param _r red color value
|
||||
* @param _g green color value
|
||||
* @param _b blue color value
|
||||
* @param _a alpha color value
|
||||
* @param palette palette to use (only used for 8 bit color!)
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define SplitColor(...) FreeRDPSplitColor(__VA_ARGS__)
|
||||
#endif
|
||||
FREERDP_API void FreeRDPSplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g, BYTE* _b,
|
||||
BYTE* _a, const gdiPalette* palette);
|
||||
|
||||
/***
|
||||
*
|
||||
* Converts red, green, blue and alpha values to internal representation.
|
||||
*
|
||||
* @param format one of PIXEL_FORMAT_* color format defines
|
||||
* @param r red color value
|
||||
* @param g green color value
|
||||
* @param b blue color value
|
||||
* @param a alpha color value
|
||||
*
|
||||
* @return The pixel color in the desired format. Value is in internal
|
||||
* representation.
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define GetColor(...) FreeRDPGetColor(__VA_ARGS__)
|
||||
#endif
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT32 FreeRDPGetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a);
|
||||
|
||||
/***
|
||||
*
|
||||
* Returns the number of bits the format format uses.
|
||||
*
|
||||
* @param format One of PIXEL_FORMAT_* defines
|
||||
*
|
||||
* @return The number of bits the format requires per pixel.
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define GetBitsPerPixel(...) FreeRDPGetBitsPerPixel(__VA_ARGS__)
|
||||
#endif
|
||||
WINPR_ATTR_NODISCARD
|
||||
static inline UINT32 FreeRDPGetBitsPerPixel(UINT32 format)
|
||||
{
|
||||
return (((format) >> 24) & 0x3F);
|
||||
}
|
||||
|
||||
/***
|
||||
* @param format one of PIXEL_FORMAT_* color format defines
|
||||
*
|
||||
* @return TRUE if the format has an alpha channel, FALSE otherwise.
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define ColorHasAlpha(...) FreeRDPColorHasAlpha(__VA_ARGS__)
|
||||
#endif
|
||||
WINPR_ATTR_NODISCARD
|
||||
static inline BOOL FreeRDPColorHasAlpha(UINT32 format)
|
||||
{
|
||||
UINT32 alpha = (((format) >> 12) & 0x0F);
|
||||
|
||||
return (alpha != 0);
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* Read a pixel from memory to internal representation
|
||||
*
|
||||
* @param src The source buffer
|
||||
* @param format The PIXEL_FORMAT_* define the source buffer uses for encoding
|
||||
*
|
||||
* @return The pixel color in internal representation
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define ReadColor(...) FreeRDPReadColor(__VA_ARGS__)
|
||||
#endif
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT32 FreeRDPReadColor(const BYTE* WINPR_RESTRICT src, UINT32 format);
|
||||
|
||||
/***
|
||||
*
|
||||
* Write a pixel from internal representation to memory
|
||||
*
|
||||
* @param dst The destination buffer
|
||||
* @param format The PIXEL_FORMAT_* define for encoding
|
||||
* @param color The pixel color in internal representation
|
||||
*
|
||||
* @return TRUE if successful, FALSE otherwise
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define WriteColor(...) FreeRDPWriteColor(__VA_ARGS__)
|
||||
#define WriteColorIgnoreAlpha(...) FreeRDPWriteColorIgnoreAlpha(__VA_ARGS__)
|
||||
#endif
|
||||
FREERDP_API BOOL FreeRDPWriteColor(BYTE* WINPR_RESTRICT dst, UINT32 format, UINT32 color);
|
||||
|
||||
FREERDP_API BOOL FreeRDPWriteColorIgnoreAlpha(BYTE* WINPR_RESTRICT dst, UINT32 format,
|
||||
UINT32 color);
|
||||
|
||||
/***
|
||||
*
|
||||
* Converts a pixel in internal representation format srcFormat to internal
|
||||
* representation format dstFormat
|
||||
*
|
||||
* @param color The pixel color in srcFormat representation
|
||||
* @param srcFormat The PIXEL_FORMAT_* of color
|
||||
* @param dstFormat The PIXEL_FORMAT_* of the return.
|
||||
* @param palette palette to use (only used for 8 bit color!)
|
||||
*
|
||||
* @return The converted pixel color in dstFormat representation
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define ConvertColor(...) FreeRDPConvertColor(__VA_ARGS__)
|
||||
#endif
|
||||
WINPR_ATTR_NODISCARD
|
||||
static inline UINT32 FreeRDPConvertColor(UINT32 color, UINT32 srcFormat, UINT32 dstFormat,
|
||||
const gdiPalette* palette)
|
||||
{
|
||||
BYTE r = 0;
|
||||
BYTE g = 0;
|
||||
BYTE b = 0;
|
||||
BYTE a = 0;
|
||||
FreeRDPSplitColor(color, srcFormat, &r, &g, &b, &a, palette);
|
||||
return FreeRDPGetColor(dstFormat, r, g, b, a);
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* Returns the number of bytes the format format uses.
|
||||
*
|
||||
* @param format One of PIXEL_FORMAT_* defines
|
||||
*
|
||||
* @return The number of bytes the format requires per pixel.
|
||||
*/
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
#define GetBytesPerPixel(...) FreeRDPGetBytesPerPixel(__VA_ARGS__)
|
||||
#endif
|
||||
WINPR_ATTR_NODISCARD
|
||||
static inline UINT32 FreeRDPGetBytesPerPixel(UINT32 format)
|
||||
{
|
||||
return (FreeRDPGetBitsPerPixel(format) + 7) / 8;
|
||||
}
|
||||
|
||||
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
|
||||
/***
|
||||
*
|
||||
* @param width width to copy in pixels
|
||||
* @param height height to copy in pixels
|
||||
* @param data source buffer, must be (nWidth + 7) / 8 bytes long
|
||||
*
|
||||
* @return A buffer allocated with winpr_aligned_malloc(width * height, 16)
|
||||
* if successful, nullptr otherwise.
|
||||
*/
|
||||
|
||||
WINPR_DEPRECATED_VAR("[since 3.21.0] use freerdp_glyph_convert_ex instead",
|
||||
WINPR_ATTR_MALLOC(winpr_aligned_free, 1)
|
||||
WINPR_ATTR_NODISCARD FREERDP_API BYTE* freerdp_glyph_convert(
|
||||
UINT32 width, UINT32 height, const BYTE* WINPR_RESTRICT data));
|
||||
#endif
|
||||
|
||||
/***
|
||||
*
|
||||
* @param width width to copy in pixels
|
||||
* @param height height to copy in pixels
|
||||
* @param data source buffer, must be (nWidth + 7) / 8 bytes long
|
||||
* @param len the length of \ref data in bytes
|
||||
*
|
||||
* @return A buffer allocated with winpr_aligned_malloc(width * height, 16)
|
||||
* if successful, nullptr otherwise.
|
||||
* @since version 3.21.0
|
||||
*/
|
||||
WINPR_ATTR_MALLOC(winpr_aligned_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BYTE* freerdp_glyph_convert_ex(UINT32 width, UINT32 height,
|
||||
const BYTE* WINPR_RESTRICT data, size_t len);
|
||||
|
||||
/***
|
||||
*
|
||||
* @param pDstData destination buffer
|
||||
* @param DstFormat destination buffer format
|
||||
* @param nDstStep destination buffer stride (line in bytes) 0 for default
|
||||
* @param nXDst destination buffer offset x
|
||||
* @param nYDst destination buffer offset y
|
||||
* @param nWidth width to copy in pixels
|
||||
* @param nHeight height to copy in pixels
|
||||
* @param pSrcData source buffer, must be (nWidth + 7) / 8 bytes long
|
||||
* @param backColor The background color in internal representation format
|
||||
* @param foreColor The foreground color in internal representation format
|
||||
* @param palette palette to use (only used for 8 bit color!)
|
||||
*
|
||||
* @return TRUE if success, FALSE otherwise
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_copy_from_monochrome(
|
||||
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
|
||||
UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData,
|
||||
UINT32 backColor, UINT32 foreColor, const gdiPalette* WINPR_RESTRICT palette);
|
||||
|
||||
/***
|
||||
*
|
||||
* @param pDstData destination buffer
|
||||
* @param DstFormat destination buffer format
|
||||
* @param nDstStep destination buffer stride (line in bytes) 0 for default
|
||||
* @param nXDst destination buffer offset x
|
||||
* @param nYDst destination buffer offset y
|
||||
* @param nWidth width to copy in pixels
|
||||
* @param nHeight height to copy in pixels
|
||||
* @param bitsColor icon's image data buffer
|
||||
* @param cbBitsColor length of the image data buffer in bytes
|
||||
* @param bitsMask icon's 1bpp image mask buffer
|
||||
* @param cbBitsMask length of the image mask buffer in bytes
|
||||
* @param colorTable icon's image color table
|
||||
* @param cbColorTable length of the image color table buffer in bytes
|
||||
* @param bpp color image data bits per pixel
|
||||
*
|
||||
* @return TRUE if success, FALSE otherwise
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_copy_from_icon_data(
|
||||
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
|
||||
UINT32 nYDst, UINT16 nWidth, UINT16 nHeight, const BYTE* WINPR_RESTRICT bitsColor,
|
||||
UINT16 cbBitsColor, const BYTE* WINPR_RESTRICT bitsMask, UINT16 cbBitsMask,
|
||||
const BYTE* WINPR_RESTRICT colorTable, UINT16 cbColorTable, UINT32 bpp);
|
||||
|
||||
/***
|
||||
*
|
||||
* @param pDstData destination buffer
|
||||
* @param DstFormat destination buffer format
|
||||
* @param nDstStep destination buffer stride (line in bytes) 0 for default
|
||||
* @param nXDst destination buffer offset x
|
||||
* @param nYDst destination buffer offset y
|
||||
* @param nWidth width to copy in pixels
|
||||
* @param nHeight height to copy in pixels
|
||||
* @param xorMask XOR mask buffer
|
||||
* @param xorMaskLength XOR mask length in bytes
|
||||
* @param andMask AND mask buffer
|
||||
* @param andMaskLength AND mask length in bytes
|
||||
* @param xorBpp XOR bits per pixel
|
||||
* @param palette palette to use (only used for 8 bit color!)
|
||||
*
|
||||
* @return TRUE if success, FALSE otherwise
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_copy_from_pointer_data(
|
||||
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
|
||||
UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT xorMask,
|
||||
UINT32 xorMaskLength, const BYTE* WINPR_RESTRICT andMask, UINT32 andMaskLength,
|
||||
UINT32 xorBpp, const gdiPalette* WINPR_RESTRICT palette);
|
||||
|
||||
/*** Copies an image from source to destination, converting if necessary.
|
||||
* Source and destination may overlap.
|
||||
*
|
||||
* @param pDstData destination buffer
|
||||
* @param DstFormat destination buffer format
|
||||
* @param nDstStep destination buffer stride (line in bytes) 0 for default
|
||||
* @param nXDst destination buffer offset x
|
||||
* @param nYDst destination buffer offset y
|
||||
* @param nWidth width to copy in pixels
|
||||
* @param nHeight height to copy in pixels
|
||||
* @param pSrcData source buffer
|
||||
* @param SrcFormat source buffer format
|
||||
* @param nSrcStep source buffer stride (line in bytes) 0 for default
|
||||
* @param nXSrc source buffer x offset in pixels
|
||||
* @param nYSrc source buffer y offset in pixels
|
||||
* @param palette palette to use (only used for 8 bit color!)
|
||||
* @param flags Image flipping flags FREERDP_FLIP_NONE et al
|
||||
*
|
||||
* @return TRUE if success, FALSE otherwise
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep,
|
||||
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep,
|
||||
UINT32 nXSrc, UINT32 nYSrc,
|
||||
const gdiPalette* WINPR_RESTRICT palette, UINT32 flags);
|
||||
|
||||
/**
|
||||
* @brief Same as @ref freerdp_image_copy but only for overlapping source and destination
|
||||
* @since version 3.6.0
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_copy_overlap(
|
||||
BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
|
||||
UINT32 nHeight, const BYTE* pSrcData, DWORD SrcFormat, UINT32 nSrcStep, UINT32 nXSrc,
|
||||
UINT32 nYSrc, const gdiPalette* WINPR_RESTRICT palette, UINT32 flags);
|
||||
|
||||
/*** Same as @ref freerdp_image_copy but only for non overlapping source and destination
|
||||
* @since version 3.6.0
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_copy_no_overlap(
|
||||
BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData, DWORD SrcFormat,
|
||||
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* WINPR_RESTRICT palette,
|
||||
UINT32 flags);
|
||||
|
||||
/*** Scale an image to destination
|
||||
*
|
||||
* @param pDstData destination buffer
|
||||
* @param DstFormat destination buffer format
|
||||
* @param nDstStep destination buffer stride (line in bytes) 0 for default
|
||||
* @param nXDst destination buffer offset x
|
||||
* @param nYDst destination buffer offset y
|
||||
* @param nDstWidth width of destination in pixels
|
||||
* @param nDstHeight height of destination in pixels
|
||||
* @param pSrcData source buffer
|
||||
* @param SrcFormat source buffer format
|
||||
* @param nSrcStep source buffer stride (line in bytes) 0 for default
|
||||
* @param nXSrc source buffer x offset in pixels
|
||||
* @param nYSrc source buffer y offset in pixels
|
||||
* @param nSrcWidth width of source in pixels
|
||||
* @param nSrcHeight height of source in pixels
|
||||
*
|
||||
* @return TRUE if success, FALSE otherwise
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_scale(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nDstWidth, UINT32 nDstHeight,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, DWORD SrcFormat,
|
||||
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||
UINT32 nSrcWidth, UINT32 nSrcHeight);
|
||||
|
||||
/** @brief fill an area with the color provided.
|
||||
*
|
||||
* @param pDstData destination buffer
|
||||
* @param DstFormat destination buffer format
|
||||
* @param nDstStep destination buffer stride (line in bytes) 0 for default
|
||||
* @param nXDst destination buffer offset x
|
||||
* @param nYDst destination buffer offset y
|
||||
* @param nWidth width to copy in pixels
|
||||
* @param nHeight height to copy in pixels
|
||||
* @param color Pixel color in DstFormat (internal representation format,
|
||||
* use FreeRDPGetColor to create)
|
||||
*
|
||||
* @return TRUE if success, FALSE otherwise
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_fill(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
|
||||
UINT32 nHeight, UINT32 color);
|
||||
|
||||
#define FREERDP_IMAGE_FILL_IGNORE_ALPHA 1 /** @since version 3.13.0 */
|
||||
|
||||
/** @brief fill an area with the color provided. If flag \b FREERDP_IMAGE_FILL_IGNORE_ALPHA is
|
||||
* set the destination alpha value will be kept.
|
||||
*
|
||||
* @param pDstData destination buffer
|
||||
* @param DstFormat destination buffer format
|
||||
* @param nDstStep destination buffer stride (line in bytes) 0 for default
|
||||
* @param nXDst destination buffer offset x
|
||||
* @param nYDst destination buffer offset y
|
||||
* @param nWidth width to copy in pixels
|
||||
* @param nHeight height to copy in pixels
|
||||
* @param color Pixel color in DstFormat (internal representation format,
|
||||
* use FreeRDPGetColor to create)
|
||||
* @param flags \b FREERDP_IMAGE_FILL_* flags
|
||||
*
|
||||
* @return TRUE if success, FALSE otherwise
|
||||
*
|
||||
* @since version 3.13.0
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_image_fill_ex(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, UINT32 color,
|
||||
UINT32 flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_COLOR_H */
|
||||
66
third_party/FreeRDP/include/freerdp/codec/dsp.h
vendored
Normal file
66
third_party/FreeRDP/include/freerdp/codec/dsp.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Digital Sound Processing
|
||||
*
|
||||
* Copyright 2010-2011 Vic Lee
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_DSP_H
|
||||
#define FREERDP_CODEC_DSP_H
|
||||
|
||||
#include <winpr/stream.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/codec/audio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_FREERDP_DSP_CONTEXT FREERDP_DSP_CONTEXT;
|
||||
|
||||
FREERDP_API void freerdp_dsp_context_free(FREERDP_DSP_CONTEXT* context);
|
||||
|
||||
WINPR_ATTR_MALLOC(freerdp_dsp_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API FREERDP_DSP_CONTEXT* freerdp_dsp_context_new(BOOL encoder);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_dsp_supports_format(const AUDIO_FORMAT* WINPR_RESTRICT format,
|
||||
BOOL encode);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_dsp_encode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
const AUDIO_FORMAT* WINPR_RESTRICT srcFormat,
|
||||
const BYTE* WINPR_RESTRICT data, size_t length,
|
||||
wStream* WINPR_RESTRICT out);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_dsp_decode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
const AUDIO_FORMAT* WINPR_RESTRICT srcFormat,
|
||||
const BYTE* WINPR_RESTRICT data, size_t length,
|
||||
wStream* WINPR_RESTRICT out);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_dsp_context_reset(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
const AUDIO_FORMAT* WINPR_RESTRICT targetFormat,
|
||||
UINT32 FramesPerPacket);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_DSP_H */
|
||||
146
third_party/FreeRDP/include/freerdp/codec/h264.h
vendored
Normal file
146
third_party/FreeRDP/include/freerdp/codec/h264.h
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* H.264 Bitmap Compression
|
||||
*
|
||||
* Copyright 2014 Mike McDonald <Mike.McDonald@software.dell.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_H264_H
|
||||
#define FREERDP_CODEC_H264_H
|
||||
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/channels/rdpgfx.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_H264_CONTEXT_SUBSYSTEM H264_CONTEXT_SUBSYSTEM;
|
||||
typedef struct S_H264_CONTEXT H264_CONTEXT;
|
||||
typedef struct S_YUV_CONTEXT YUV_CONTEXT;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
H264_RATECONTROL_VBR = 0,
|
||||
H264_RATECONTROL_CQP
|
||||
} H264_RATECONTROL_MODE;
|
||||
|
||||
/**
|
||||
* @brief The usage types for H264 encoding
|
||||
* @since version 3.6.0
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
H264_SCREEN_CONTENT_REAL_TIME = 0,
|
||||
H264_SCREEN_CONTENT_NON_REAL_TIME,
|
||||
H264_CAMERA_VIDEO_REAL_TIME,
|
||||
H264_CAMERA_VIDEO_NON_REAL_TIME,
|
||||
|
||||
} H264_USAGETYPE;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
H264_CONTEXT_OPTION_RATECONTROL,
|
||||
H264_CONTEXT_OPTION_BITRATE,
|
||||
H264_CONTEXT_OPTION_FRAMERATE,
|
||||
H264_CONTEXT_OPTION_QP,
|
||||
H264_CONTEXT_OPTION_USAGETYPE, /** @since version 3.6.0 */
|
||||
H264_CONTEXT_OPTION_HW_ACCEL, /** set to request hw accel, get to check if hw accel is on,
|
||||
@since version 3.11.0 */
|
||||
} H264_CONTEXT_OPTION;
|
||||
|
||||
FREERDP_API void free_h264_metablock(RDPGFX_H264_METABLOCK* meta);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL h264_context_set_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option,
|
||||
UINT32 value);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT32 h264_context_get_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32 avc420_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
|
||||
UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
const RECTANGLE_16* regionRect, BYTE** ppDstData,
|
||||
UINT32* pDstSize, RDPGFX_H264_METABLOCK* meta);
|
||||
|
||||
/** @brief API for user to fill YUV I420 buffer before encoding
|
||||
*
|
||||
* @param h264 The h264 context to query
|
||||
* @param nSrcStride The size of a line in bytes of the source image
|
||||
* @param nSrcWidth The width of the source image in pixels
|
||||
* @param nSrcHeight The height of the source image
|
||||
* @param YUVData A pointer to hold the current YUV buffers
|
||||
* @param stride A pointer to hold the byte length of a line in the YUV buffers
|
||||
* @return \b >= 0 for success, \b <0 for an error
|
||||
* @since version 3.6.0
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32 h264_get_yuv_buffer(H264_CONTEXT* h264, UINT32 nSrcStride, UINT32 nSrcWidth,
|
||||
UINT32 nSrcHeight, BYTE* YUVData[3], UINT32 stride[3]);
|
||||
|
||||
/**
|
||||
* @brief Compress currently filled image data to H264 stream
|
||||
*
|
||||
* @param h264 The H264 context to use for compression
|
||||
* @param ppDstData A pointer that will hold the allocated result buffer
|
||||
* @param pDstSize A pointer for the destination buffer size in bytes
|
||||
* @return \b >= 0 for success, \b <0 for an error
|
||||
* @since version 3.6.0
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32 h264_compress(H264_CONTEXT* h264, BYTE** ppDstData, UINT32* pDstSize);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32 avc420_decompress(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize,
|
||||
BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep,
|
||||
UINT32 nDstWidth, UINT32 nDstHeight,
|
||||
const RECTANGLE_16* regionRects, UINT32 numRegionRect);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32 avc444_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
|
||||
UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
BYTE version, const RECTANGLE_16* regionRect, BYTE* op,
|
||||
BYTE** pDstData, UINT32* pDstSize, BYTE** pAuxDstData,
|
||||
UINT32* pAuxDstSize, RDPGFX_H264_METABLOCK* meta,
|
||||
RDPGFX_H264_METABLOCK* auxMeta);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op,
|
||||
const RECTANGLE_16* regionRects, UINT32 numRegionRect,
|
||||
const BYTE* pSrcData, UINT32 SrcSize,
|
||||
const RECTANGLE_16* auxRegionRects, UINT32 numAuxRegionRect,
|
||||
const BYTE* pAuxSrcData, UINT32 AuxSrcSize, BYTE* pDstData,
|
||||
DWORD DstFormat, UINT32 nDstStep, UINT32 nDstWidth,
|
||||
UINT32 nDstHeight, UINT32 codecId);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL h264_context_reset(H264_CONTEXT* h264, UINT32 width, UINT32 height);
|
||||
|
||||
FREERDP_API void h264_context_free(H264_CONTEXT* h264);
|
||||
|
||||
WINPR_ATTR_MALLOC(h264_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API H264_CONTEXT* h264_context_new(BOOL Compressor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_H264_H */
|
||||
69
third_party/FreeRDP/include/freerdp/codec/interleaved.h
vendored
Normal file
69
third_party/FreeRDP/include/freerdp/codec/interleaved.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Interleaved RLE Bitmap Codec
|
||||
*
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_INTERLEAVED_H
|
||||
#define FREERDP_CODEC_INTERLEAVED_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#include <freerdp/codec/color.h>
|
||||
#include <freerdp/codec/bitmap.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_BITMAP_INTERLEAVED_CONTEXT BITMAP_INTERLEAVED_CONTEXT;
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
UINT32 nSrcWidth, UINT32 nSrcHeight, UINT32 bpp,
|
||||
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nDstWidth, UINT32 nDstHeight,
|
||||
const gdiPalette* WINPR_RESTRICT palette);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved,
|
||||
BYTE* WINPR_RESTRICT pDstData,
|
||||
UINT32* WINPR_RESTRICT pDstSize, UINT32 nWidth,
|
||||
UINT32 nHeight, const BYTE* WINPR_RESTRICT pSrcData,
|
||||
UINT32 SrcFormat, UINT32 nSrcStep, UINT32 nXSrc,
|
||||
UINT32 nYSrc, const gdiPalette* WINPR_RESTRICT palette,
|
||||
UINT32 bpp);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL
|
||||
bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved);
|
||||
|
||||
FREERDP_API void
|
||||
bitmap_interleaved_context_free(BITMAP_INTERLEAVED_CONTEXT* WINPR_RESTRICT interleaved);
|
||||
|
||||
WINPR_ATTR_MALLOC(bitmap_interleaved_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BITMAP_INTERLEAVED_CONTEXT* bitmap_interleaved_context_new(BOOL Compressor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_INTERLEAVED_H */
|
||||
39
third_party/FreeRDP/include/freerdp/codec/jpeg.h
vendored
Normal file
39
third_party/FreeRDP/include/freerdp/codec/jpeg.h
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Compressed Bitmap
|
||||
*
|
||||
* Copyright 2012 Jay Sorg <jay.sorg@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_JPEG_H
|
||||
#define FREERDP_CODEC_JPEG_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL jpeg_decompress(const BYTE* input, BYTE* output, int width, int height,
|
||||
int size, int bpp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_JPEG_H */
|
||||
145
third_party/FreeRDP/include/freerdp/codec/nsc.h
vendored
Normal file
145
third_party/FreeRDP/include/freerdp/codec/nsc.h
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* NSCodec Codec
|
||||
*
|
||||
* Copyright 2011 Samsung, Author Jiten Pathy
|
||||
* Copyright 2012 Vic Lee
|
||||
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
|
||||
* Copyright 2016 Thincast Technologies GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_NSCODEC_H
|
||||
#define FREERDP_CODEC_NSCODEC_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
|
||||
#include <winpr/stream.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/// parameter types available to change in a \ref NSC_CONTEXT See [MS-RDPNSC] 2.2.1 NSCodec
|
||||
/// Capability Set (TS_NSCODEC_CAPABILITYSET) for details
|
||||
typedef enum
|
||||
{
|
||||
NSC_COLOR_LOSS_LEVEL, /**< \b colorLossLevel */
|
||||
NSC_ALLOW_SUBSAMPLING, /**< \b fAllowSubsampling */
|
||||
NSC_DYNAMIC_COLOR_FIDELITY, /**< \b fAllowDynamicFidelity */
|
||||
NSC_COLOR_FORMAT /**< \ref PIXEL_FORMAT color format used for internal bitmap buffer */
|
||||
} NSC_PARAMETER;
|
||||
|
||||
typedef struct S_NSC_CONTEXT NSC_CONTEXT;
|
||||
|
||||
#if defined(WITH_FREERDP_DEPRECATED)
|
||||
WINPR_DEPRECATED_VAR("Use nsc_context_set_parameters(NSC_COLOR_FORMAT)",
|
||||
WINPR_ATTR_NODISCARD FREERDP_API BOOL nsc_context_set_pixel_format(
|
||||
NSC_CONTEXT* context, UINT32 pixel_format));
|
||||
#endif
|
||||
|
||||
/** @brief Set a \ref NSC_PARAMETER for a \ref NSC_CONTEXT
|
||||
*
|
||||
* @param context The \ref NSC_CONTEXT context to work on. Must not be \b nullptr
|
||||
* @param what A \ref NSC_PARAMETER to identify what to change
|
||||
* @param value The value to set
|
||||
*
|
||||
* @return \b TRUE if successful, \b FALSE otherwise
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL nsc_context_set_parameters(NSC_CONTEXT* WINPR_RESTRICT context,
|
||||
NSC_PARAMETER what, UINT32 value);
|
||||
|
||||
/** @brief decode a NSC message
|
||||
*
|
||||
* @param context The \ref NSC_CONTEXT context to work on. Must not be \b nullptr
|
||||
* @param bpp The bit depth of the data
|
||||
* @param width The width in pixels of the NSC surface
|
||||
* @param height The height in pixels of the NSC surface
|
||||
* @param data The data to decode
|
||||
* @param length The length of \ref data in bytes
|
||||
* @param pDstData The destination buffer. Must be at least \n nDstStride * nHeight in size.
|
||||
* @param DstFormat The color format of the destination
|
||||
* @param nDstStride The number of bytes per destination buffer line. Must be larger than
|
||||
* bytes(DstFormat) * nWidth or \0 (in which case it is set to former minimum bound)
|
||||
* @param nXDst The X offset in the destination buffer in pixels
|
||||
* @param nYDst The Y offset in the destination buffer in pixels
|
||||
* @param nWidth The width of the destination buffer in pixels
|
||||
* @param nHeight The height of the destination buffer in pixels
|
||||
* @param flip Image flipping flags FREERDP_FLIP_NONE et al passed on to \ref
|
||||
* freerdp_image_copy
|
||||
*
|
||||
* @return \b TRUE in case of success, \b FALSE for any error. Check WLog for details.
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL nsc_process_message(NSC_CONTEXT* WINPR_RESTRICT context, UINT16 bpp,
|
||||
UINT32 width, UINT32 height, const BYTE* data,
|
||||
UINT32 length, BYTE* WINPR_RESTRICT pDstData,
|
||||
UINT32 DstFormat, UINT32 nDstStride, UINT32 nXDst,
|
||||
UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, UINT32 flip);
|
||||
|
||||
/** @brief Encode a bitmap with \b NSC
|
||||
*
|
||||
* @param context The \ref NSC_CONTEXT context to work on. Must not be \b nullptr
|
||||
* @param s a \ref wStream used to write \b NSC encoded data to. Must not be \b nullptr
|
||||
* @param bmpdata A pointer to the bitmap to encode. Format must match \b NSC_COLOR_FORMAT
|
||||
* @param width The width of the bitmap in pixels
|
||||
* @param height The height of the bitmap in pixels
|
||||
* @param scanline The stride of a bitmap line in bytes. If \b 0 the value of \b width * bytes
|
||||
* \b NSC_COLOR_FORMAT is used.
|
||||
*
|
||||
* @bug Versions < 3.23.0 do not support \b 0 for scanlines and abort.
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL nsc_compose_message(NSC_CONTEXT* WINPR_RESTRICT context,
|
||||
wStream* WINPR_RESTRICT s,
|
||||
const BYTE* WINPR_RESTRICT bmpdata, UINT32 width,
|
||||
UINT32 height, UINT32 scanline);
|
||||
|
||||
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
|
||||
|
||||
WINPR_DEPRECATED_VAR(
|
||||
"[since 3.23.0] deprecated, insecure! missing length checks. use nsc_process_message",
|
||||
WINPR_ATTR_NODISCARD FREERDP_API BOOL
|
||||
nsc_decompose_message(NSC_CONTEXT* WINPR_RESTRICT context, wStream* WINPR_RESTRICT s,
|
||||
BYTE* WINPR_RESTRICT bmpdata, UINT32 x, UINT32 y, UINT32 width,
|
||||
UINT32 height, UINT32 rowstride, UINT32 format, UINT32 flip));
|
||||
#endif
|
||||
|
||||
/** @brief This function resets a \ref NSC_CONTEXT to a new resolution
|
||||
*
|
||||
* @param context The \ref NSC_CONTEXT context to work on. Must not be \b nullptr
|
||||
* @param width The width of the context in pixels
|
||||
* @param height The height of the context in pixels
|
||||
*
|
||||
* @return \b TRUE if successful, \b FALSE otherwise
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL nsc_context_reset(NSC_CONTEXT* WINPR_RESTRICT context, UINT32 width,
|
||||
UINT32 height);
|
||||
|
||||
FREERDP_API void nsc_context_free(NSC_CONTEXT* context);
|
||||
|
||||
WINPR_ATTR_MALLOC(nsc_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API NSC_CONTEXT* nsc_context_new(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_NSCODEC_H */
|
||||
88
third_party/FreeRDP/include/freerdp/codec/planar.h
vendored
Normal file
88
third_party/FreeRDP/include/freerdp/codec/planar.h
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* RDP6 Planar Codec
|
||||
*
|
||||
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
|
||||
* Copyright 2016 Thincast Technologies GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_PLANAR_H
|
||||
#define FREERDP_CODEC_PLANAR_H
|
||||
|
||||
#include <winpr/cast.h>
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/config.h>
|
||||
#include <freerdp/codec/color.h>
|
||||
#include <freerdp/codec/bitmap.h>
|
||||
|
||||
#define PLANAR_FORMAT_HEADER_CS (1 << 3)
|
||||
#define PLANAR_FORMAT_HEADER_RLE (1 << 4)
|
||||
#define PLANAR_FORMAT_HEADER_NA (1 << 5)
|
||||
#define PLANAR_FORMAT_HEADER_CLL_MASK 0x07
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_BITMAP_PLANAR_CONTEXT BITMAP_PLANAR_CONTEXT;
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT context,
|
||||
const BYTE* WINPR_RESTRICT data, UINT32 format,
|
||||
UINT32 width, UINT32 height, UINT32 scanline,
|
||||
BYTE* WINPR_RESTRICT dstData,
|
||||
UINT32* WINPR_RESTRICT pDstSize);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_bitmap_planar_context_reset(
|
||||
BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT context, UINT32 width, UINT32 height);
|
||||
|
||||
FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context);
|
||||
|
||||
WINPR_ATTR_MALLOC(freerdp_bitmap_planar_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, UINT32 width,
|
||||
UINT32 height);
|
||||
|
||||
FREERDP_API void freerdp_planar_switch_bgr(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
|
||||
BOOL bgr);
|
||||
FREERDP_API void freerdp_planar_topdown_image(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
|
||||
BOOL topdown);
|
||||
|
||||
#if !defined(WITHOUT_FREERDP_3x_DEPRECATED)
|
||||
WINPR_DEPRECATED_VAR("use freerdp_bitmap_decompress_planar instead",
|
||||
WINPR_ATTR_NODISCARD FREERDP_API BOOL planar_decompress(
|
||||
BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize, UINT32 nSrcWidth,
|
||||
UINT32 nSrcHeight, BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
|
||||
UINT32 nDstHeight, BOOL vFlip));
|
||||
#endif
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL freerdp_bitmap_decompress_planar(
|
||||
BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar, const BYTE* WINPR_RESTRICT pSrcData,
|
||||
UINT32 SrcSize, UINT32 nSrcWidth, UINT32 nSrcHeight, BYTE* WINPR_RESTRICT pDstData,
|
||||
UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
|
||||
UINT32 nDstHeight, BOOL vFlip);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_PLANAR_H */
|
||||
98
third_party/FreeRDP/include/freerdp/codec/progressive.h
vendored
Normal file
98
third_party/FreeRDP/include/freerdp/codec/progressive.h
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Progressive Codec Bitmap Compression
|
||||
*
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_PROGRESSIVE_H
|
||||
#define FREERDP_CODEC_PROGRESSIVE_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#include <winpr/wlog.h>
|
||||
#include <winpr/collections.h>
|
||||
|
||||
#include <freerdp/codec/rfx.h>
|
||||
#include <freerdp/codec/color.h>
|
||||
#include <freerdp/codec/region.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_PROGRESSIVE_CONTEXT PROGRESSIVE_CONTEXT;
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API int progressive_compress(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
UINT32 SrcFormat, UINT32 Width, UINT32 Height,
|
||||
UINT32 ScanLine,
|
||||
const REGION16* WINPR_RESTRICT invalidRegion,
|
||||
BYTE** WINPR_RESTRICT ppDstData,
|
||||
UINT32* WINPR_RESTRICT pDstSize);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32 progressive_decompress(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
REGION16* WINPR_RESTRICT invalidRegion,
|
||||
UINT16 surfaceId, UINT32 frameId);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API INT32
|
||||
progressive_create_surface_context(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
|
||||
UINT16 surfaceId, UINT32 width, UINT32 height);
|
||||
|
||||
FREERDP_API int
|
||||
progressive_delete_surface_context(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive,
|
||||
UINT16 surfaceId);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL progressive_context_reset(PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive);
|
||||
|
||||
FREERDP_API void progressive_context_free(PROGRESSIVE_CONTEXT* progressive);
|
||||
|
||||
WINPR_ATTR_MALLOC(progressive_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API PROGRESSIVE_CONTEXT* progressive_context_new(BOOL Compressor);
|
||||
|
||||
WINPR_ATTR_MALLOC(progressive_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API PROGRESSIVE_CONTEXT* progressive_context_new_ex(BOOL Compressor,
|
||||
UINT32 ThreadingFlags);
|
||||
|
||||
/** Write a RFX message as simple progressive message to a stream.
|
||||
* Forward wrapper for \link rfx_write_message_progressive_simple
|
||||
* @param progressive The progressive codec context
|
||||
* @param s The stream to write to
|
||||
* @param msg The message to encode
|
||||
*
|
||||
* @since version 3.0.0
|
||||
* @return \b TRUE in case of success, \b FALSE for any error
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL progressive_rfx_write_message_progressive_simple(
|
||||
PROGRESSIVE_CONTEXT* WINPR_RESTRICT progressive, wStream* WINPR_RESTRICT s,
|
||||
const RFX_MESSAGE* WINPR_RESTRICT msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_PROGRESSIVE_H */
|
||||
160
third_party/FreeRDP/include/freerdp/codec/region.h
vendored
Normal file
160
third_party/FreeRDP/include/freerdp/codec/region.h
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* Copyright © 2014 Thincast Technologies GmbH
|
||||
* Copyright © 2014 Hardening <contact@hardening-consulting.com>
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of the copyright holders not be used in
|
||||
* advertising or publicity pertaining to distribution of the software
|
||||
* without specific, written prior permission. The copyright holders make
|
||||
* no representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_REGION_H
|
||||
#define FREERDP_CODEC_REGION_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_REGION16_DATA REGION16_DATA;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RECTANGLE_16 extents;
|
||||
REGION16_DATA* data;
|
||||
} REGION16;
|
||||
|
||||
/** computes if two rectangles are equal
|
||||
* @param r1 first rectangle
|
||||
* @param r2 second rectangle
|
||||
* @return if the two rectangles are equal
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rectangles_equal(const RECTANGLE_16* r1, const RECTANGLE_16* r2);
|
||||
|
||||
/** computes if two rectangles intersect
|
||||
* @param r1 first rectangle
|
||||
* @param r2 second rectangle
|
||||
* @return if the two rectangles intersect
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rectangles_intersects(const RECTANGLE_16* r1, const RECTANGLE_16* r2);
|
||||
|
||||
/** computes the intersection of two rectangles
|
||||
* @param r1 first rectangle
|
||||
* @param r2 second rectangle
|
||||
* @param dst resulting intersection
|
||||
* @return if the two rectangles intersect
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rectangles_intersection(const RECTANGLE_16* r1, const RECTANGLE_16* r2,
|
||||
RECTANGLE_16* dst);
|
||||
|
||||
/** initialize a region16
|
||||
* @param region the region to initialise
|
||||
*/
|
||||
FREERDP_API void region16_init(REGION16* region);
|
||||
|
||||
/** @return the number of rectangles of this region16 */
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API int region16_n_rects(const REGION16* region);
|
||||
|
||||
/** returns a pointer to rectangles and the number of rectangles in this region.
|
||||
* nbRects can be set to nullptr if not interested in the number of rectangles.
|
||||
* @param region the input region
|
||||
* @param nbRects if non-nullptr returns the number of rectangles
|
||||
* @return a pointer on the rectangles
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const RECTANGLE_16* region16_rects(const REGION16* region, UINT32* nbRects);
|
||||
|
||||
/** @return the extents rectangle of this region */
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const RECTANGLE_16* region16_extents(const REGION16* region);
|
||||
|
||||
/** returns if the rectangle is empty
|
||||
* @param rect the rectangle to check
|
||||
* @return if the rectangle is empty
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rectangle_is_empty(const RECTANGLE_16* rect);
|
||||
|
||||
/** returns if the region is empty
|
||||
* @param region the region to check
|
||||
* @return if the region is empty
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL region16_is_empty(const REGION16* region);
|
||||
|
||||
/** clears the region, the region is reset to a (0,0,0,0) region
|
||||
* @param region the region to clear
|
||||
*/
|
||||
FREERDP_API void region16_clear(REGION16* region);
|
||||
|
||||
/** dumps the region on stderr
|
||||
* @param region the region to dump
|
||||
*/
|
||||
FREERDP_API void region16_print(const REGION16* region);
|
||||
|
||||
/** copies the region to another region
|
||||
* @param dst destination region
|
||||
* @param src source region
|
||||
* @return if the operation was successful (false meaning out-of-memory)
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL region16_copy(REGION16* dst, const REGION16* src);
|
||||
|
||||
/** adds a rectangle in src and stores the resulting region in dst
|
||||
* @param dst destination region
|
||||
* @param src source region
|
||||
* @param rect the rectangle to add
|
||||
* @return if the operation was successful (false meaning out-of-memory)
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL region16_union_rect(REGION16* dst, const REGION16* src,
|
||||
const RECTANGLE_16* rect);
|
||||
|
||||
/** returns if a rectangle intersects the region
|
||||
* @param src the region
|
||||
* @param arg2 the rectangle
|
||||
* @return if region and rectangle intersect
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL region16_intersects_rect(const REGION16* src, const RECTANGLE_16* arg2);
|
||||
|
||||
/** computes the intersection between a region and a rectangle
|
||||
* @param dst destination region
|
||||
* @param src the source region
|
||||
* @param rect the rectangle that intersects
|
||||
* @return if the operation was successful (false meaning out-of-memory)
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL region16_intersect_rect(REGION16* dst, const REGION16* src,
|
||||
const RECTANGLE_16* rect);
|
||||
|
||||
/** release internal data associated with this region
|
||||
* @param region the region to release
|
||||
*/
|
||||
FREERDP_API void region16_uninit(REGION16* region);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_REGION_H */
|
||||
216
third_party/FreeRDP/include/freerdp/codec/rfx.h
vendored
Normal file
216
third_party/FreeRDP/include/freerdp/codec/rfx.h
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* RemoteFX Codec
|
||||
*
|
||||
* Copyright 2011 Vic Lee
|
||||
* Copyright 2016 Armin Novak <armin.novak@thincast.com>
|
||||
* Copyright 2016 Thincast Technologies GmbH
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_REMOTEFX_H
|
||||
#define FREERDP_CODEC_REMOTEFX_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/codec/region.h>
|
||||
|
||||
#include <winpr/stream.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RLGR1,
|
||||
RLGR3
|
||||
} RLGR_MODE;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT16 x;
|
||||
UINT16 y;
|
||||
UINT16 width;
|
||||
UINT16 height;
|
||||
} RFX_RECT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT16 x;
|
||||
UINT16 y;
|
||||
UINT32 width;
|
||||
UINT32 height;
|
||||
BYTE* data;
|
||||
UINT32 scanline;
|
||||
BOOL allocated;
|
||||
BYTE quantIdxY;
|
||||
BYTE quantIdxCb;
|
||||
BYTE quantIdxCr;
|
||||
UINT16 xIdx;
|
||||
UINT16 yIdx;
|
||||
UINT16 YLen;
|
||||
UINT16 CbLen;
|
||||
UINT16 CrLen;
|
||||
BYTE* YData;
|
||||
BYTE* CbData;
|
||||
BYTE* CrData;
|
||||
BYTE* YCbCrData;
|
||||
} RFX_TILE;
|
||||
|
||||
typedef struct S_RFX_MESSAGE_LIST RFX_MESSAGE_LIST;
|
||||
typedef struct S_RFX_MESSAGE RFX_MESSAGE;
|
||||
typedef struct S_RFX_CONTEXT RFX_CONTEXT;
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rfx_process_message(RFX_CONTEXT* WINPR_RESTRICT context,
|
||||
const BYTE* WINPR_RESTRICT data, UINT32 length,
|
||||
UINT32 left, UINT32 top, BYTE* WINPR_RESTRICT dst,
|
||||
UINT32 dstFormat, UINT32 dstStride, UINT32 dstHeight,
|
||||
REGION16* WINPR_RESTRICT invalidRegion);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT32 rfx_message_get_frame_idx(const RFX_MESSAGE* WINPR_RESTRICT message);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const UINT32* rfx_message_get_quants(const RFX_MESSAGE* WINPR_RESTRICT message,
|
||||
UINT16* WINPR_RESTRICT numQuantVals);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const RFX_TILE** rfx_message_get_tiles(const RFX_MESSAGE* WINPR_RESTRICT message,
|
||||
UINT16* WINPR_RESTRICT numTiles);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT16 rfx_message_get_tile_count(const RFX_MESSAGE* WINPR_RESTRICT message);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const RFX_RECT* rfx_message_get_rects(const RFX_MESSAGE* WINPR_RESTRICT message,
|
||||
UINT16* WINPR_RESTRICT numRects);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT16 rfx_message_get_rect_count(const RFX_MESSAGE* WINPR_RESTRICT message);
|
||||
|
||||
FREERDP_API void rfx_message_free(RFX_CONTEXT* WINPR_RESTRICT context,
|
||||
RFX_MESSAGE* WINPR_RESTRICT message);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rfx_compose_message(RFX_CONTEXT* WINPR_RESTRICT context,
|
||||
wStream* WINPR_RESTRICT s,
|
||||
const RFX_RECT* WINPR_RESTRICT rects, size_t numRects,
|
||||
const BYTE* WINPR_RESTRICT data, UINT32 width,
|
||||
UINT32 height, UINT32 scanline);
|
||||
|
||||
WINPR_ATTR_MALLOC(rfx_message_free, 2)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* WINPR_RESTRICT context,
|
||||
const RFX_RECT* WINPR_RESTRICT rects,
|
||||
size_t numRects, const BYTE* WINPR_RESTRICT data,
|
||||
UINT32 width, UINT32 height, size_t scanline);
|
||||
|
||||
FREERDP_API void rfx_message_list_free(RFX_MESSAGE_LIST* messages);
|
||||
|
||||
WINPR_ATTR_MALLOC(rfx_message_list_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API RFX_MESSAGE_LIST*
|
||||
rfx_encode_messages(RFX_CONTEXT* WINPR_RESTRICT context, const RFX_RECT* WINPR_RESTRICT rects,
|
||||
size_t numRects, const BYTE* WINPR_RESTRICT data, UINT32 width,
|
||||
UINT32 height, UINT32 scanline, size_t* WINPR_RESTRICT numMessages,
|
||||
size_t maxDataSize);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const RFX_MESSAGE*
|
||||
rfx_message_list_get(const RFX_MESSAGE_LIST* WINPR_RESTRICT messages, size_t idx);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rfx_write_message(RFX_CONTEXT* WINPR_RESTRICT context,
|
||||
wStream* WINPR_RESTRICT s,
|
||||
const RFX_MESSAGE* WINPR_RESTRICT message);
|
||||
|
||||
FREERDP_API void rfx_context_free(RFX_CONTEXT* context);
|
||||
|
||||
WINPR_ATTR_MALLOC(rfx_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API RFX_CONTEXT* rfx_context_new_ex(BOOL encoder, UINT32 ThreadingFlags);
|
||||
|
||||
WINPR_ATTR_MALLOC(rfx_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API RFX_CONTEXT* rfx_context_new(BOOL encoder);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rfx_context_reset(RFX_CONTEXT* WINPR_RESTRICT context, UINT32 width,
|
||||
UINT32 height);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rfx_context_set_mode(RFX_CONTEXT* WINPR_RESTRICT context, RLGR_MODE mode);
|
||||
|
||||
/** Getter for RFX mode
|
||||
* @param context The RFX context to query
|
||||
*
|
||||
* @since version 3.0.0
|
||||
*
|
||||
* @return The RFX mode that is currently in use
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API RLGR_MODE rfx_context_get_mode(RFX_CONTEXT* WINPR_RESTRICT context);
|
||||
|
||||
FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* WINPR_RESTRICT context,
|
||||
UINT32 pixel_format);
|
||||
|
||||
/** Getter for RFX pixel format
|
||||
* @param context The RFX context to query
|
||||
*
|
||||
* @since version 3.0.0
|
||||
*
|
||||
* @return The RFX pixel format that is currently in use
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT32 rfx_context_get_pixel_format(RFX_CONTEXT* WINPR_RESTRICT context);
|
||||
|
||||
FREERDP_API void rfx_context_set_palette(RFX_CONTEXT* WINPR_RESTRICT context,
|
||||
const BYTE* WINPR_RESTRICT palette);
|
||||
|
||||
/** Getter for RFX palette
|
||||
* @param context The RFX context to query
|
||||
*
|
||||
* @since version 3.0.0
|
||||
*
|
||||
* @return The RFX palette that is currently in use or \b nullptr
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API const BYTE* rfx_context_get_palette(RFX_CONTEXT* WINPR_RESTRICT context);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API UINT32 rfx_context_get_frame_idx(const RFX_CONTEXT* WINPR_RESTRICT context);
|
||||
|
||||
/** Write a RFX message as simple progressive message to a stream.
|
||||
*
|
||||
* @param rfx The RFX codec context
|
||||
* @param s The stream to write to
|
||||
* @param msg The message to encode
|
||||
*
|
||||
* @since version 3.0.0
|
||||
* @return \b TRUE in case of success, \b FALSE for any error
|
||||
*/
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL rfx_write_message_progressive_simple(RFX_CONTEXT* WINPR_RESTRICT rfx,
|
||||
wStream* WINPR_RESTRICT s,
|
||||
const RFX_MESSAGE* WINPR_RESTRICT msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_REMOTEFX_H */
|
||||
78
third_party/FreeRDP/include/freerdp/codec/yuv.h
vendored
Normal file
78
third_party/FreeRDP/include/freerdp/codec/yuv.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* YUV decoder
|
||||
*
|
||||
* Copyright 2017 David Fort <contact@hardening-consulting.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_YUV_H
|
||||
#define FREERDP_CODEC_YUV_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_YUV_CONTEXT YUV_CONTEXT;
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL yuv420_context_decode(
|
||||
YUV_CONTEXT* WINPR_RESTRICT context, const BYTE* WINPR_RESTRICT pYUVData[3],
|
||||
const UINT32 iStride[3], UINT32 yuvHeight, DWORD DstFormat, BYTE* WINPR_RESTRICT dest,
|
||||
UINT32 nDstStep, const RECTANGLE_16* WINPR_RESTRICT regionRects, UINT32 numRegionRects);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL yuv420_context_encode(YUV_CONTEXT* WINPR_RESTRICT context,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 nSrcStep,
|
||||
UINT32 SrcFormat, const UINT32 iStride[3],
|
||||
BYTE* WINPR_RESTRICT pYUVData[3],
|
||||
const RECTANGLE_16* WINPR_RESTRICT regionRects,
|
||||
UINT32 numRegionRects);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL yuv444_context_decode(
|
||||
YUV_CONTEXT* WINPR_RESTRICT context, BYTE type, const BYTE* WINPR_RESTRICT pYUVData[3],
|
||||
const UINT32 iStride[3], UINT32 srcYuvHeight, BYTE* WINPR_RESTRICT pYUVDstData[3],
|
||||
const UINT32 iDstStride[3], DWORD DstFormat, BYTE* WINPR_RESTRICT dest, UINT32 nDstStep,
|
||||
const RECTANGLE_16* WINPR_RESTRICT regionRects, UINT32 numRegionRects);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL yuv444_context_encode(YUV_CONTEXT* WINPR_RESTRICT context, BYTE version,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 nSrcStep,
|
||||
UINT32 SrcFormat, const UINT32 iStride[3],
|
||||
BYTE* WINPR_RESTRICT pYUVLumaData[3],
|
||||
BYTE* WINPR_RESTRICT pYUVChromaData[3],
|
||||
const RECTANGLE_16* WINPR_RESTRICT regionRects,
|
||||
UINT32 numRegionRects);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API BOOL yuv_context_reset(YUV_CONTEXT* WINPR_RESTRICT context, UINT32 width,
|
||||
UINT32 height);
|
||||
|
||||
FREERDP_API void yuv_context_free(YUV_CONTEXT* context);
|
||||
|
||||
WINPR_ATTR_MALLOC(yuv_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API YUV_CONTEXT* yuv_context_new(BOOL encoder, UINT32 ThreadingFlags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_YUV_H */
|
||||
72
third_party/FreeRDP/include/freerdp/codec/zgfx.h
vendored
Normal file
72
third_party/FreeRDP/include/freerdp/codec/zgfx.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* ZGFX (RDP8) Bulk Data Compression
|
||||
*
|
||||
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_CODEC_ZGFX_H
|
||||
#define FREERDP_CODEC_ZGFX_H
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
#include <freerdp/codec/bulk.h>
|
||||
|
||||
#define ZGFX_SEGMENTED_SINGLE 0xE0
|
||||
#define ZGFX_SEGMENTED_MULTIPART 0xE1
|
||||
|
||||
#define ZGFX_PACKET_COMPR_TYPE_RDP8 0x04
|
||||
|
||||
#define ZGFX_SEGMENTED_MAXSIZE 65535
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct S_ZGFX_CONTEXT ZGFX_CONTEXT;
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API int zgfx_decompress(ZGFX_CONTEXT* WINPR_RESTRICT zgfx,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
BYTE** WINPR_RESTRICT ppDstData,
|
||||
UINT32* WINPR_RESTRICT pDstSize, UINT32 flags);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API int zgfx_compress(ZGFX_CONTEXT* WINPR_RESTRICT zgfx,
|
||||
const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
|
||||
BYTE** WINPR_RESTRICT ppDstData, UINT32* WINPR_RESTRICT pDstSize,
|
||||
UINT32* WINPR_RESTRICT pFlags);
|
||||
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API int zgfx_compress_to_stream(ZGFX_CONTEXT* WINPR_RESTRICT zgfx,
|
||||
wStream* WINPR_RESTRICT sDst,
|
||||
const BYTE* WINPR_RESTRICT pUncompressed,
|
||||
UINT32 uncompressedSize, UINT32* WINPR_RESTRICT pFlags);
|
||||
|
||||
FREERDP_API void zgfx_context_reset(ZGFX_CONTEXT* WINPR_RESTRICT zgfx, BOOL flush);
|
||||
|
||||
FREERDP_API void zgfx_context_free(ZGFX_CONTEXT* zgfx);
|
||||
|
||||
WINPR_ATTR_MALLOC(zgfx_context_free, 1)
|
||||
WINPR_ATTR_NODISCARD
|
||||
FREERDP_API ZGFX_CONTEXT* zgfx_context_new(BOOL Compressor);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CODEC_ZGFX_H */
|
||||
Reference in New Issue
Block a user