header.pduLength = RDPGFX_HEADER_SIZE + 2 + (pdu.capsSetCount * RDPGFX_CAPSET_SIZE);
- fprintf(stderr, "RdpGfxSendCapsAdvertisePdu: %d\n", header.pduLength);
+ WLog_Print(gfx->log, WLOG_DEBUG, "SendCapsAdvertisePdu");
s = Stream_New(NULL, header.pduLength);
RDPGFX_CAPSET capsSet;
UINT32 capsDataLength;
RDPGFX_CAPS_CONFIRM_PDU pdu;
+ RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
pdu.capsSet = &capsSet;
Stream_Read_UINT32(s, capsDataLength); /* capsDataLength (4 bytes) */
Stream_Read_UINT32(s, capsSet.flags); /* capsData (4 bytes) */
- fprintf(stderr, "RdpGfxRecvCapsConfirmPdu: version: 0x%04X flags: 0x%04X\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvCapsConfirmPdu: version: 0x%04X flags: 0x%04X",
capsSet.version, capsSet.flags);
return 1;
{
int status;
wStream* s;
- RDPGFX_PLUGIN* gfx;
RDPGFX_HEADER header;
-
- gfx = (RDPGFX_PLUGIN*) callback->plugin;
+ RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
header.flags = 0;
header.cmdId = RDPGFX_CMDID_FRAMEACKNOWLEDGE;
header.pduLength = RDPGFX_HEADER_SIZE + 12;
- fprintf(stderr, "RdpGfxSendFrameAcknowledgePdu: %d\n", pdu->frameId);
+ WLog_Print(gfx->log, WLOG_DEBUG, "SendFrameAcknowledgePdu: %d", pdu->frameId);
s = Stream_New(NULL, header.pduLength);
pad = 340 - (RDPGFX_HEADER_SIZE + 12 + (pdu.monitorCount * 20));
Stream_Seek(s, pad); /* pad (total size is 340 bytes) */
- fprintf(stderr, "RdpGfxRecvResetGraphicsPdu: width: %d height: %d count: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvResetGraphicsPdu: width: %d height: %d count: %d",
pdu.width, pdu.height, pdu.monitorCount);
if (context && context->ResetGraphics)
Stream_Read_UINT16(s, pdu.cacheSlot); /* cacheSlot (2 bytes) */
- fprintf(stderr, "RdpGfxRecvEvictCacheEntryPdu: cacheSlot: %d\n", pdu.cacheSlot);
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvEvictCacheEntryPdu: cacheSlot: %d", pdu.cacheSlot);
if (context && context->EvictCacheEntry)
{
Stream_Read_UINT16(s, pdu.cacheSlots[index]); /* cacheSlot (2 bytes) */
}
- fprintf(stderr, "RdpGfxRecvCacheImportReplyPdu: importedEntriesCount: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvCacheImportReplyPdu: importedEntriesCount: %d",
pdu.importedEntriesCount);
if (context && context->CacheImportReply)
Stream_Read_UINT16(s, pdu.height); /* height (2 bytes) */
Stream_Read_UINT8(s, pdu.pixelFormat); /* RDPGFX_PIXELFORMAT (1 byte) */
- fprintf(stderr, "RdpGfxRecvCreateSurfacePdu: surfaceId: %d width: %d height: %d pixelFormat: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvCreateSurfacePdu: surfaceId: %d width: %d height: %d pixelFormat: 0x%02X",
pdu.surfaceId, pdu.width, pdu.height, pdu.pixelFormat);
if (context && context->CreateSurface)
Stream_Read_UINT16(s, pdu.surfaceId); /* surfaceId (2 bytes) */
- fprintf(stderr, "RdpGfxRecvDeleteSurfacePdu: surfaceId: %d\n", pdu.surfaceId);
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvDeleteSurfacePdu: surfaceId: %d", pdu.surfaceId);
if (context && context->DeleteSurface)
{
Stream_Read_UINT32(s, pdu.timestamp); /* timestamp (4 bytes) */
Stream_Read_UINT32(s, pdu.frameId); /* frameId (4 bytes) */
- fprintf(stderr, "RdpGfxRecvStartFramePdu: frameId: %d timestamp: 0x%04X\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvStartFramePdu: frameId: %d timestamp: 0x%04X\n",
pdu.frameId, pdu.timestamp);
if (context && context->StartFrame)
Stream_Read_UINT32(s, pdu.frameId); /* frameId (4 bytes) */
- fprintf(stderr, "RdpGfxRecvEndFramePdu: frameId: %d\n", pdu.frameId);
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvEndFramePdu: frameId: %d\n", pdu.frameId);
if (context && context->EndFrame)
{
pdu.bitmapData = Stream_Pointer(s);
Stream_Seek(s, pdu.bitmapDataLength);
- fprintf(stderr, "RdpGfxRecvWireToSurface1Pdu: surfaceId: %d codecId: %s (0x%04X) pixelFormat: 0x%04X "
- "destRect: left: %d top: %d right: %d bottom: %d bitmapDataLength: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvWireToSurface1Pdu: surfaceId: %d codecId: %s (0x%04X) pixelFormat: 0x%04X "
+ "destRect: left: %d top: %d right: %d bottom: %d bitmapDataLength: %d",
(int) pdu.surfaceId, rdpgfx_get_codec_id_string(pdu.codecId), pdu.codecId, pdu.pixelFormat,
pdu.destRect.left, pdu.destRect.top, pdu.destRect.right, pdu.destRect.bottom,
pdu.bitmapDataLength);
pdu.bitmapData = Stream_Pointer(s);
Stream_Seek(s, pdu.bitmapDataLength);
- fprintf(stderr, "RdpGfxRecvWireToSurface2Pdu: surfaceId: %d codecId: 0x%04X "
- "codecContextId: %d pixelFormat: 0x%04X bitmapDataLength: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvWireToSurface2Pdu: surfaceId: %d codecId: 0x%04X "
+ "codecContextId: %d pixelFormat: 0x%04X bitmapDataLength: %d",
(int) pdu.surfaceId, pdu.codecId, pdu.codecContextId, pdu.pixelFormat, pdu.bitmapDataLength);
cmd.surfaceId = pdu.surfaceId;
Stream_Read_UINT16(s, pdu.surfaceId); /* surfaceId (2 bytes) */
Stream_Read_UINT32(s, pdu.codecContextId); /* codecContextId (4 bytes) */
- fprintf(stderr, "RdpGfxRecvDeleteEncodingContextPdu: surfaceId: %d codecContextId: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvDeleteEncodingContextPdu: surfaceId: %d codecContextId: %d",
pdu.surfaceId, pdu.codecContextId);
if (context && context->DeleteEncodingContext)
rdpgfx_read_rect16(s, fillRect);
}
- fprintf(stderr, "RdpGfxRecvSolidFillPdu: surfaceId: %d fillRectCount: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvSolidFillPdu: surfaceId: %d fillRectCount: %d",
pdu.surfaceId, pdu.fillRectCount);
if (context && context->SolidFill)
rdpgfx_read_point16(s, destPt);
}
- fprintf(stderr, "RdpGfxRecvSurfaceToSurfacePdu: surfaceIdSrc: %d surfaceIdDest: %d "
- "left: %d top: %d right: %d bottom: %d destPtsCount: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvSurfaceToSurfacePdu: surfaceIdSrc: %d surfaceIdDest: %d "
+ "left: %d top: %d right: %d bottom: %d destPtsCount: %d",
pdu.surfaceIdSrc, pdu.surfaceIdDest,
pdu.rectSrc.left, pdu.rectSrc.top, pdu.rectSrc.right, pdu.rectSrc.bottom,
pdu.destPtsCount);
Stream_Read_UINT16(s, pdu.cacheSlot); /* cacheSlot (2 bytes) */
rdpgfx_read_rect16(s, &(pdu.rectSrc)); /* rectSrc (8 bytes ) */
- fprintf(stderr, "RdpGfxRecvSurfaceToCachePdu: surfaceId: %d cacheKey: 0x%08X cacheSlot: %d "
- "left: %d top: %d right: %d bottom: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvSurfaceToCachePdu: surfaceId: %d cacheKey: 0x%08X cacheSlot: %d "
+ "left: %d top: %d right: %d bottom: %d",
pdu.surfaceId, (int) pdu.cacheKey, pdu.cacheSlot,
pdu.rectSrc.left, pdu.rectSrc.top,
pdu.rectSrc.right, pdu.rectSrc.bottom);
rdpgfx_read_point16(s, destPt);
}
- fprintf(stderr, "RdpGfxRecvCacheToSurfacePdu: cacheSlot: %d surfaceId: %d destPtsCount: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RdpGfxRecvCacheToSurfacePdu: cacheSlot: %d surfaceId: %d destPtsCount: %d",
pdu.cacheSlot, (int) pdu.surfaceId, pdu.destPtsCount);
if (context && context->CacheToSurface)
Stream_Read_UINT32(s, pdu.outputOriginX); /* outputOriginX (4 bytes) */
Stream_Read_UINT32(s, pdu.outputOriginY); /* outputOriginY (4 bytes) */
- fprintf(stderr, "RdpGfxRecvMapSurfaceToOutputPdu: surfaceId: %d outputOriginX: %d outputOriginY: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvMapSurfaceToOutputPdu: surfaceId: %d outputOriginX: %d outputOriginY: %d",
(int) pdu.surfaceId, pdu.outputOriginX, pdu.outputOriginY);
if (context && context->MapSurfaceToOutput)
Stream_Read_UINT32(s, pdu.mappedWidth); /* mappedWidth (4 bytes) */
Stream_Read_UINT32(s, pdu.mappedHeight); /* mappedHeight (4 bytes) */
- fprintf(stderr, "RdpGfxRecvMapSurfaceToWindowPdu: surfaceId: %d windowId: 0x%04X mappedWidth: %d mappedHeight: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "RecvMapSurfaceToWindowPdu: surfaceId: %d windowId: 0x%04X mappedWidth: %d mappedHeight: %d",
pdu.surfaceId, (int) pdu.windowId, pdu.mappedWidth, pdu.mappedHeight);
if (context && context->MapSurfaceToWindow)
int status;
int beg, end;
RDPGFX_HEADER header;
+ RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
beg = Stream_GetPosition(s);
rdpgfx_read_header(s, &header);
#if 1
- printf("cmdId: %s (0x%04X) flags: 0x%04X pduLength: %d\n",
+ WLog_Print(gfx->log, WLOG_DEBUG, "cmdId: %s (0x%04X) flags: 0x%04X pduLength: %d",
rdpgfx_get_cmd_id_string(header.cmdId), header.cmdId, header.flags, header.pduLength);
#endif
if (end != (beg + header.pduLength))
{
- fprintf(stderr, "Unexpected pdu end: Actual: %d, Expected: %d\n",
+ fprintf(stderr, "Unexpected gfx pdu end: Actual: %d, Expected: %d\n",
end, (beg + header.pduLength));
- exit(0);
-
Stream_SetPosition(s, (beg + header.pduLength));
}
int status = 0;
UINT32 DstSize = 0;
BYTE* pDstData = NULL;
- RDPGFX_PLUGIN* gfx = NULL;
RDPGFX_CHANNEL_CALLBACK* callback = (RDPGFX_CHANNEL_CALLBACK*) pChannelCallback;
-
- gfx = (RDPGFX_PLUGIN*) callback->plugin;
+ RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
status = zgfx_decompress(gfx->zgfx, pBuffer, cbSize, &pDstData, &DstSize, 0);
static int rdpgfx_on_open(IWTSVirtualChannelCallback* pChannelCallback)
{
RDPGFX_CHANNEL_CALLBACK* callback = (RDPGFX_CHANNEL_CALLBACK*) pChannelCallback;
+ RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
- fprintf(stderr, "RdpGfxOnOpen\n");
+ WLog_Print(gfx->log, WLOG_DEBUG, "OnOpen");
rdpgfx_send_caps_advertise_pdu(callback);
static int rdpgfx_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
RDPGFX_CHANNEL_CALLBACK* callback = (RDPGFX_CHANNEL_CALLBACK*) pChannelCallback;
+ RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) callback->plugin;
- fprintf(stderr, "RdpGfxOnClose\n");
+ WLog_Print(gfx->log, WLOG_DEBUG, "OnClose");
free(callback);
callback = (RDPGFX_CHANNEL_CALLBACK*) calloc(1, sizeof(RDPGFX_CHANNEL_CALLBACK));
+ if (!callback)
+ return -1;
+
callback->iface.OnDataReceived = rdpgfx_on_data_received;
callback->iface.OnOpen = rdpgfx_on_open;
callback->iface.OnClose = rdpgfx_on_close;
*ppCallback = (IWTSVirtualChannelCallback*) callback;
- fprintf(stderr, "RdpGfxOnNewChannelConnection\n");
-
return 0;
}
static int rdpgfx_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManager* pChannelMgr)
{
int status;
- RDPGFX_PLUGIN* rdpgfx = (RDPGFX_PLUGIN*) pPlugin;
+ RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) pPlugin;
- rdpgfx->listener_callback = (RDPGFX_LISTENER_CALLBACK*) calloc(1, sizeof(RDPGFX_LISTENER_CALLBACK));
+ gfx->listener_callback = (RDPGFX_LISTENER_CALLBACK*) calloc(1, sizeof(RDPGFX_LISTENER_CALLBACK));
- if (!rdpgfx->listener_callback)
+ if (!gfx->listener_callback)
return -1;
- rdpgfx->listener_callback->iface.OnNewChannelConnection = rdpgfx_on_new_channel_connection;
- rdpgfx->listener_callback->plugin = pPlugin;
- rdpgfx->listener_callback->channel_mgr = pChannelMgr;
+ gfx->listener_callback->iface.OnNewChannelConnection = rdpgfx_on_new_channel_connection;
+ gfx->listener_callback->plugin = pPlugin;
+ gfx->listener_callback->channel_mgr = pChannelMgr;
status = pChannelMgr->CreateListener(pChannelMgr, RDPGFX_DVC_CHANNEL_NAME, 0,
- (IWTSListenerCallback*) rdpgfx->listener_callback, &(rdpgfx->listener));
+ (IWTSListenerCallback*) gfx->listener_callback, &(gfx->listener));
- rdpgfx->listener->pInterface = rdpgfx->iface.pInterface;
+ gfx->listener->pInterface = gfx->iface.pInterface;
- fprintf(stderr, "RdpGfxInitialize: %d\n", status);
+ WLog_Print(gfx->log, WLOG_DEBUG, "Initialize");
return status;
}
static int rdpgfx_plugin_terminated(IWTSPlugin* pPlugin)
{
- RDPGFX_PLUGIN* rdpgfx = (RDPGFX_PLUGIN*) pPlugin;
-
- if (rdpgfx->listener_callback)
- free(rdpgfx->listener_callback);
+ RDPGFX_PLUGIN* gfx = (RDPGFX_PLUGIN*) pPlugin;
- zgfx_context_free(rdpgfx->zgfx);
+ WLog_Print(gfx->log, WLOG_DEBUG, "Terminated");
- free(rdpgfx);
+ if (gfx->listener_callback)
+ free(gfx->listener_callback);
- return 0;
-}
+ zgfx_context_free(gfx->zgfx);
-/**
- * Channel Client Interface
- */
+ free(gfx);
-UINT32 rdpgfx_get_version(RdpgfxClientContext* context)
-{
- //RDPGFX_PLUGIN* rdpgfx = (RDPGFX_PLUGIN*) context->handle;
return 0;
}
int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
{
- int error = 0;
- RDPGFX_PLUGIN* rdpgfx;
+ int status = 0;
+ RDPGFX_PLUGIN* gfx;
RdpgfxClientContext* context;
- rdpgfx = (RDPGFX_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "rdpgfx");
+ gfx = (RDPGFX_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "rdpgfx");
- if (!rdpgfx)
+ if (!gfx)
{
- rdpgfx = (RDPGFX_PLUGIN*) calloc(1, sizeof(RDPGFX_PLUGIN));
+ gfx = (RDPGFX_PLUGIN*) calloc(1, sizeof(RDPGFX_PLUGIN));
- if (!rdpgfx)
+ if (!gfx)
return -1;
- rdpgfx->iface.Initialize = rdpgfx_plugin_initialize;
- rdpgfx->iface.Connected = NULL;
- rdpgfx->iface.Disconnected = NULL;
- rdpgfx->iface.Terminated = rdpgfx_plugin_terminated;
+ gfx->log = WLog_Get("com.freerdp.gfx.client");
+
+ gfx->iface.Initialize = rdpgfx_plugin_initialize;
+ gfx->iface.Connected = NULL;
+ gfx->iface.Disconnected = NULL;
+ gfx->iface.Terminated = rdpgfx_plugin_terminated;
context = (RdpgfxClientContext*) calloc(1, sizeof(RdpgfxClientContext));
if (!context)
return -1;
- context->handle = (void*) rdpgfx;
+ context->handle = (void*) gfx;
- rdpgfx->iface.pInterface = (void*) context;
+ gfx->iface.pInterface = (void*) context;
- rdpgfx->zgfx = zgfx_context_new(FALSE);
+ gfx->zgfx = zgfx_context_new(FALSE);
- error = pEntryPoints->RegisterPlugin(pEntryPoints, "rdpgfx", (IWTSPlugin*) rdpgfx);
+ status = pEntryPoints->RegisterPlugin(pEntryPoints, "rdpgfx", (IWTSPlugin*) gfx);
}
- return error;
+ return status;
}