libfreerdp-codec: stub new ZGFX (RDP8) bulk compressor/decompressor

This commit is contained in:
Marc-André Moreau 2014-06-03 13:38:10 -04:00
parent 3d7524cac9
commit abd833c27e
6 changed files with 160 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#include <winpr/crt.h>
#include <winpr/wlog.h>
#include <winpr/print.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
@ -144,6 +145,23 @@ int rdpgfx_send_caps_advertise_pdu(RDPGFX_CHANNEL_CALLBACK* callback)
int rdpgfx_recv_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s)
{
RDPGFX_HEADER header;
/* RDPGFX_HEADER */
/* data needs to be decompressed first */
//winpr_HexDump(Stream_Buffer(s), 32);
return 0;
Stream_Read_UINT16(s, header.cmdId); /* cmdId (2 bytes) */
Stream_Read_UINT16(s, header.flags); /* flags (2 bytes) */
Stream_Read_UINT32(s, header.pduLength); /* pduLength (4 bytes) */
printf("cmdId: 0x%04X flags: 0x%04X pduLength: %d\n",
header.cmdId, header.flags, header.pduLength);
return 0;
}
@ -153,7 +171,7 @@ static int rdpgfx_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
int status = 0;
RDPGFX_CHANNEL_CALLBACK* callback = (RDPGFX_CHANNEL_CALLBACK*) pChannelCallback;
fprintf(stderr, "RdpGfxOnDataReceived\n");
fprintf(stderr, "RdpGfxOnDataReceived: cbSize: %d\n", cbSize);
s = Stream_New(pBuffer, cbSize);

View File

@ -0,0 +1,57 @@
/**
* 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>
#pragma pack(push,1)
#pragma pack(pop)
struct _ZGFX_CONTEXT
{
BOOL Compressor;
};
typedef struct _ZGFX_CONTEXT ZGFX_CONTEXT;
#ifdef __cplusplus
extern "C" {
#endif
FREERDP_API int zgfx_compress(ZGFX_CONTEXT* zgfx, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags);
FREERDP_API int zgfx_decompress(ZGFX_CONTEXT* zgfx, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags);
FREERDP_API void zgfx_context_reset(ZGFX_CONTEXT* zgfx, BOOL flush);
FREERDP_API ZGFX_CONTEXT* zgfx_context_new(BOOL Compressor);
FREERDP_API void zgfx_context_free(ZGFX_CONTEXT* zgfx);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_ZGFX_H */

View File

@ -50,6 +50,7 @@ set(${MODULE_PREFIX}_SRCS
ncrush.c
xcrush.c
mppc.c
zgfx.c
jpeg.c)
set(${MODULE_PREFIX}_SSE2_SRCS

View File

@ -9,6 +9,7 @@ set(${MODULE_PREFIX}_TESTS
TestFreeRDPCodecMppc.c
TestFreeRDPCodecNCrush.c
TestFreeRDPCodecXCrush.c
TestFreeRDPCodecZGfx.c
TestFreeRDPCodecPlanar.c
TestFreeRDPCodecRemoteFX.c)

View File

@ -0,0 +1,10 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/codec/zgfx.h>
int TestFreeRDPCodecZGfx(int argc, char* argv[])
{
return 0;
}

72
libfreerdp/codec/zgfx.c Normal file
View 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/bitstream.h>
#include <freerdp/codec/zgfx.h>
int zgfx_decompress(ZGFX_CONTEXT* zgfx, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags)
{
int status = 0;
return status;
}
int zgfx_compress(ZGFX_CONTEXT* zgfx, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags)
{
int status = 0;
return 1;
}
void zgfx_context_reset(ZGFX_CONTEXT* zgfx, BOOL flush)
{
}
ZGFX_CONTEXT* zgfx_context_new(BOOL Compressor)
{
ZGFX_CONTEXT* zgfx;
zgfx = (ZGFX_CONTEXT*) calloc(1, sizeof(ZGFX_CONTEXT));
if (zgfx)
{
zgfx->Compressor = Compressor;
zgfx_context_reset(zgfx, FALSE);
}
return zgfx;
}
void zgfx_context_free(ZGFX_CONTEXT* zgfx)
{
if (zgfx)
{
free(zgfx);
}
}