[gfx] moved rdpgfx_get_codec_id_string to utils
the gfx related stringify helpers are nice to have outside the channel too so that meaningful logmessages can be written.
This commit is contained in:
parent
b56bef23dd
commit
06c070fc4d
@ -30,78 +30,6 @@
|
||||
|
||||
#include "rdpgfx_common.h"
|
||||
|
||||
static const char* RDPGFX_CMDID_STRINGS[] = { "RDPGFX_CMDID_UNUSED_0000",
|
||||
"RDPGFX_CMDID_WIRETOSURFACE_1",
|
||||
"RDPGFX_CMDID_WIRETOSURFACE_2",
|
||||
"RDPGFX_CMDID_DELETEENCODINGCONTEXT",
|
||||
"RDPGFX_CMDID_SOLIDFILL",
|
||||
"RDPGFX_CMDID_SURFACETOSURFACE",
|
||||
"RDPGFX_CMDID_SURFACETOCACHE",
|
||||
"RDPGFX_CMDID_CACHETOSURFACE",
|
||||
"RDPGFX_CMDID_EVICTCACHEENTRY",
|
||||
"RDPGFX_CMDID_CREATESURFACE",
|
||||
"RDPGFX_CMDID_DELETESURFACE",
|
||||
"RDPGFX_CMDID_STARTFRAME",
|
||||
"RDPGFX_CMDID_ENDFRAME",
|
||||
"RDPGFX_CMDID_FRAMEACKNOWLEDGE",
|
||||
"RDPGFX_CMDID_RESETGRAPHICS",
|
||||
"RDPGFX_CMDID_MAPSURFACETOOUTPUT",
|
||||
"RDPGFX_CMDID_CACHEIMPORTOFFER",
|
||||
"RDPGFX_CMDID_CACHEIMPORTREPLY",
|
||||
"RDPGFX_CMDID_CAPSADVERTISE",
|
||||
"RDPGFX_CMDID_CAPSCONFIRM",
|
||||
"RDPGFX_CMDID_UNUSED_0014",
|
||||
"RDPGFX_CMDID_MAPSURFACETOWINDOW",
|
||||
"RDPGFX_CMDID_QOEFRAMEACKNOWLEDGE",
|
||||
"RDPGFX_CMDID_MAPSURFACETOSCALEDOUTPUT",
|
||||
"RDPGFX_CMDID_MAPSURFACETOSCALEDWINDOW" };
|
||||
|
||||
const char* rdpgfx_get_cmd_id_string(UINT16 cmdId)
|
||||
{
|
||||
if (cmdId <= RDPGFX_CMDID_MAPSURFACETOSCALEDWINDOW)
|
||||
return RDPGFX_CMDID_STRINGS[cmdId];
|
||||
else
|
||||
return "RDPGFX_CMDID_UNKNOWN";
|
||||
}
|
||||
|
||||
const char* rdpgfx_get_codec_id_string(UINT16 codecId)
|
||||
{
|
||||
switch (codecId)
|
||||
{
|
||||
case RDPGFX_CODECID_UNCOMPRESSED:
|
||||
return "RDPGFX_CODECID_UNCOMPRESSED";
|
||||
|
||||
case RDPGFX_CODECID_CAVIDEO:
|
||||
return "RDPGFX_CODECID_CAVIDEO";
|
||||
|
||||
case RDPGFX_CODECID_CLEARCODEC:
|
||||
return "RDPGFX_CODECID_CLEARCODEC";
|
||||
|
||||
case RDPGFX_CODECID_PLANAR:
|
||||
return "RDPGFX_CODECID_PLANAR";
|
||||
|
||||
case RDPGFX_CODECID_AVC420:
|
||||
return "RDPGFX_CODECID_AVC420";
|
||||
|
||||
case RDPGFX_CODECID_AVC444:
|
||||
return "RDPGFX_CODECID_AVC444";
|
||||
|
||||
case RDPGFX_CODECID_AVC444v2:
|
||||
return "RDPGFX_CODECID_AVC444v2";
|
||||
|
||||
case RDPGFX_CODECID_ALPHA:
|
||||
return "RDPGFX_CODECID_ALPHA";
|
||||
|
||||
case RDPGFX_CODECID_CAPROGRESSIVE:
|
||||
return "RDPGFX_CODECID_CAPROGRESSIVE";
|
||||
|
||||
case RDPGFX_CODECID_CAPROGRESSIVE_V2:
|
||||
return "RDPGFX_CODECID_CAPROGRESSIVE_V2";
|
||||
}
|
||||
|
||||
return "RDPGFX_CODECID_UNKNOWN";
|
||||
}
|
||||
|
||||
/**
|
||||
* Function description
|
||||
*
|
||||
|
@ -27,9 +27,7 @@
|
||||
|
||||
#include <freerdp/channels/rdpgfx.h>
|
||||
#include <freerdp/api.h>
|
||||
|
||||
FREERDP_LOCAL const char* rdpgfx_get_cmd_id_string(UINT16 cmdId);
|
||||
FREERDP_LOCAL const char* rdpgfx_get_codec_id_string(UINT16 codecId);
|
||||
#include <freerdp/utils/gfx.h>
|
||||
|
||||
FREERDP_LOCAL UINT rdpgfx_read_header(wStream* s, RDPGFX_HEADER* header);
|
||||
FREERDP_LOCAL UINT rdpgfx_write_header(wStream* s, const RDPGFX_HEADER* header);
|
||||
|
41
include/freerdp/utils/gfx.h
Normal file
41
include/freerdp/utils/gfx.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
*
|
||||
* GFX Utils - Helper functions converting something to string
|
||||
*
|
||||
* Copyright 2022 Armin Novak <armin.novak@thincast.com>
|
||||
* Copyright 2022 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_UTILS_GFX_H
|
||||
#define FREERDP_UTILS_GFX_H
|
||||
|
||||
#include <winpr/wtypes.h>
|
||||
#include <freerdp/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
FREERDP_API const char* rdpgfx_get_cmd_id_string(UINT16 cmdId);
|
||||
|
||||
FREERDP_API const char* rdpgfx_get_codec_id_string(UINT16 codecId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -27,6 +27,7 @@
|
||||
#include <freerdp/log.h>
|
||||
#include <freerdp/gdi/gfx.h>
|
||||
#include <freerdp/gdi/region.h>
|
||||
#include <freerdp/utils/gfx.h>
|
||||
|
||||
#define TAG FREERDP_TAG("gdi")
|
||||
|
||||
@ -1030,13 +1031,14 @@ static UINT gdi_SurfaceCommand(RdpgfxClientContext* context, const RDPGFX_SURFAC
|
||||
|
||||
EnterCriticalSection(&context->mux);
|
||||
WLog_Print(gdi->log, WLOG_TRACE,
|
||||
"surfaceId=%" PRIu32 ", codec=%" PRIu32 ", contextId=%" PRIu32 ", format=%s, "
|
||||
"surfaceId=%" PRIu32 ", codec=%s [%" PRIu32 "], contextId=%" PRIu32 ", format=%s, "
|
||||
"left=%" PRIu32 ", top=%" PRIu32 ", right=%" PRIu32 ", bottom=%" PRIu32
|
||||
", width=%" PRIu32 ", height=%" PRIu32 " "
|
||||
"length=%" PRIu32 ", data=%p, extra=%p",
|
||||
cmd->surfaceId, cmd->codecId, cmd->contextId, FreeRDPGetColorFormatName(cmd->format),
|
||||
cmd->left, cmd->top, cmd->right, cmd->bottom, cmd->width, cmd->height, cmd->length,
|
||||
(void*)cmd->data, (void*)cmd->extra);
|
||||
cmd->surfaceId, rdpgfx_get_codec_id_string(cmd->codecId), cmd->codecId,
|
||||
cmd->contextId, FreeRDPGetColorFormatName(cmd->format), cmd->left, cmd->top,
|
||||
cmd->right, cmd->bottom, cmd->width, cmd->height, cmd->length, (void*)cmd->data,
|
||||
(void*)cmd->extra);
|
||||
|
||||
switch (cmd->codecId)
|
||||
{
|
||||
@ -1074,11 +1076,13 @@ static UINT gdi_SurfaceCommand(RdpgfxClientContext* context, const RDPGFX_SURFAC
|
||||
break;
|
||||
|
||||
case RDPGFX_CODECID_CAPROGRESSIVE_V2:
|
||||
WLog_WARN(TAG, "SurfaceCommand 0x%08" PRIX32 " not implemented", cmd->codecId);
|
||||
WLog_WARN(TAG, "SurfaceCommand %s [0x%08" PRIX32 "] not implemented",
|
||||
rdpgfx_get_codec_id_string(cmd->codecId), cmd->codecId);
|
||||
break;
|
||||
|
||||
default:
|
||||
WLog_WARN(TAG, "Invalid SurfaceCommand 0x%08" PRIX32 "", cmd->codecId);
|
||||
WLog_WARN(TAG, "Invalid SurfaceCommand %s [0x%08" PRIX32 "]",
|
||||
rdpgfx_get_codec_id_string(cmd->codecId), cmd->codecId);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ set(${MODULE_PREFIX}_SRCS
|
||||
ringbuffer.c
|
||||
signal.c
|
||||
string.c
|
||||
gfx.c
|
||||
smartcard_operations.c
|
||||
smartcard_pack.c
|
||||
smartcard_call.c
|
||||
|
95
libfreerdp/utils/gfx.c
Normal file
95
libfreerdp/utils/gfx.c
Normal file
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
*
|
||||
* GFX Utils - Helper functions converting something to string
|
||||
*
|
||||
* Copyright 2022 Armin Novak <armin.novak@thincast.com>
|
||||
* Copyright 2022 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.
|
||||
*/
|
||||
|
||||
#include <freerdp/utils/gfx.h>
|
||||
#include <freerdp/channels/rdpgfx.h>
|
||||
|
||||
static const char* RDPGFX_CMDID_STRINGS[] = { "RDPGFX_CMDID_UNUSED_0000",
|
||||
"RDPGFX_CMDID_WIRETOSURFACE_1",
|
||||
"RDPGFX_CMDID_WIRETOSURFACE_2",
|
||||
"RDPGFX_CMDID_DELETEENCODINGCONTEXT",
|
||||
"RDPGFX_CMDID_SOLIDFILL",
|
||||
"RDPGFX_CMDID_SURFACETOSURFACE",
|
||||
"RDPGFX_CMDID_SURFACETOCACHE",
|
||||
"RDPGFX_CMDID_CACHETOSURFACE",
|
||||
"RDPGFX_CMDID_EVICTCACHEENTRY",
|
||||
"RDPGFX_CMDID_CREATESURFACE",
|
||||
"RDPGFX_CMDID_DELETESURFACE",
|
||||
"RDPGFX_CMDID_STARTFRAME",
|
||||
"RDPGFX_CMDID_ENDFRAME",
|
||||
"RDPGFX_CMDID_FRAMEACKNOWLEDGE",
|
||||
"RDPGFX_CMDID_RESETGRAPHICS",
|
||||
"RDPGFX_CMDID_MAPSURFACETOOUTPUT",
|
||||
"RDPGFX_CMDID_CACHEIMPORTOFFER",
|
||||
"RDPGFX_CMDID_CACHEIMPORTREPLY",
|
||||
"RDPGFX_CMDID_CAPSADVERTISE",
|
||||
"RDPGFX_CMDID_CAPSCONFIRM",
|
||||
"RDPGFX_CMDID_UNUSED_0014",
|
||||
"RDPGFX_CMDID_MAPSURFACETOWINDOW",
|
||||
"RDPGFX_CMDID_QOEFRAMEACKNOWLEDGE",
|
||||
"RDPGFX_CMDID_MAPSURFACETOSCALEDOUTPUT",
|
||||
"RDPGFX_CMDID_MAPSURFACETOSCALEDWINDOW" };
|
||||
|
||||
const char* rdpgfx_get_cmd_id_string(UINT16 cmdId)
|
||||
{
|
||||
if (cmdId <= RDPGFX_CMDID_MAPSURFACETOSCALEDWINDOW)
|
||||
return RDPGFX_CMDID_STRINGS[cmdId];
|
||||
else
|
||||
return "RDPGFX_CMDID_UNKNOWN";
|
||||
}
|
||||
|
||||
const char* rdpgfx_get_codec_id_string(UINT16 codecId)
|
||||
{
|
||||
switch (codecId)
|
||||
{
|
||||
case RDPGFX_CODECID_UNCOMPRESSED:
|
||||
return "RDPGFX_CODECID_UNCOMPRESSED";
|
||||
|
||||
case RDPGFX_CODECID_CAVIDEO:
|
||||
return "RDPGFX_CODECID_CAVIDEO";
|
||||
|
||||
case RDPGFX_CODECID_CLEARCODEC:
|
||||
return "RDPGFX_CODECID_CLEARCODEC";
|
||||
|
||||
case RDPGFX_CODECID_PLANAR:
|
||||
return "RDPGFX_CODECID_PLANAR";
|
||||
|
||||
case RDPGFX_CODECID_AVC420:
|
||||
return "RDPGFX_CODECID_AVC420";
|
||||
|
||||
case RDPGFX_CODECID_AVC444:
|
||||
return "RDPGFX_CODECID_AVC444";
|
||||
|
||||
case RDPGFX_CODECID_AVC444v2:
|
||||
return "RDPGFX_CODECID_AVC444v2";
|
||||
|
||||
case RDPGFX_CODECID_ALPHA:
|
||||
return "RDPGFX_CODECID_ALPHA";
|
||||
|
||||
case RDPGFX_CODECID_CAPROGRESSIVE:
|
||||
return "RDPGFX_CODECID_CAPROGRESSIVE";
|
||||
|
||||
case RDPGFX_CODECID_CAPROGRESSIVE_V2:
|
||||
return "RDPGFX_CODECID_CAPROGRESSIVE_V2";
|
||||
}
|
||||
|
||||
return "RDPGFX_CODECID_UNKNOWN";
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user