Skip to content

Commit 263d74e

Browse files
authored
Merge pull request FreeRDP#5783 from akallabeth/gfx_mask_arg
Added /gfx and /gfx-h264 option mask=<value>
2 parents 205b0fb + 1d9722f commit 263d74e

File tree

2 files changed

+72
-26
lines changed

2 files changed

+72
-26
lines changed

client/common/cmdline.c

Lines changed: 68 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,28 +2451,50 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
24512451

24522452
if (arg->Value)
24532453
{
2454-
#ifdef WITH_GFX_H264
2454+
int rc = CHANNEL_RC_OK;
2455+
char** p;
2456+
size_t count, x;
24552457

2456-
if (_strnicmp("AVC444", arg->Value, 7) == 0)
2457-
{
2458-
settings->GfxH264 = TRUE;
2459-
settings->GfxAVC444 = TRUE;
2460-
}
2461-
else if (_strnicmp("AVC420", arg->Value, 7) == 0)
2458+
p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
2459+
if (!p || (count == 0))
2460+
rc = COMMAND_LINE_ERROR;
2461+
for (x = 0; x < count; x++)
24622462
{
2463-
settings->GfxH264 = TRUE;
2464-
settings->GfxAVC444 = FALSE;
2465-
}
2466-
else
2463+
const char* val = p[x];
2464+
#ifdef WITH_GFX_H264
2465+
if (_strnicmp("AVC444", val, 7) == 0)
2466+
{
2467+
settings->GfxH264 = TRUE;
2468+
settings->GfxAVC444 = TRUE;
2469+
}
2470+
else if (_strnicmp("AVC420", val, 7) == 0)
2471+
{
2472+
settings->GfxH264 = TRUE;
2473+
settings->GfxAVC444 = FALSE;
2474+
}
2475+
else
24672476
#endif
2468-
if (_strnicmp("RFX", arg->Value, 4) == 0)
2469-
{
2470-
settings->GfxAVC444 = FALSE;
2471-
settings->GfxH264 = FALSE;
2472-
settings->RemoteFxCodec = TRUE;
2477+
if (_strnicmp("RFX", val, 4) == 0)
2478+
{
2479+
settings->GfxAVC444 = FALSE;
2480+
settings->GfxH264 = FALSE;
2481+
settings->RemoteFxCodec = TRUE;
2482+
}
2483+
else if (_strnicmp("mask:", val, 5) == 0)
2484+
{
2485+
ULONGLONG v;
2486+
const char* uv = &val[5];
2487+
if (!value_to_uint(uv, &v, 0, UINT32_MAX))
2488+
rc = COMMAND_LINE_ERROR;
2489+
else
2490+
settings->GfxCapsFilter = (UINT32)v;
2491+
}
2492+
else
2493+
rc = COMMAND_LINE_ERROR;
24732494
}
2474-
else
2475-
return COMMAND_LINE_ERROR;
2495+
free(p);
2496+
if (rc != CHANNEL_RC_OK)
2497+
return rc;
24762498
}
24772499
}
24782500
CommandLineSwitchCase(arg, "gfx-thin-client")
@@ -2507,12 +2529,36 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
25072529

25082530
if (arg->Value)
25092531
{
2510-
if (_strnicmp("AVC444", arg->Value, 7) == 0)
2532+
int rc = CHANNEL_RC_OK;
2533+
char** p;
2534+
size_t count, x;
2535+
2536+
p = freerdp_command_line_parse_comma_separated_values(arg->Value, &count);
2537+
if (!p || (count == 0))
2538+
rc = COMMAND_LINE_ERROR;
2539+
for (x = 0; x < count; x++)
25112540
{
2512-
settings->GfxAVC444 = TRUE;
2541+
const char* val = p[x];
2542+
2543+
if (_strnicmp("AVC444", val, 7) == 0)
2544+
{
2545+
settings->GfxAVC444 = TRUE;
2546+
}
2547+
else if (_strnicmp("AVC420", val, 7) != 0)
2548+
rc = COMMAND_LINE_ERROR;
2549+
else if (_strnicmp("mask:", val, 5) == 0)
2550+
{
2551+
ULONGLONG v;
2552+
const char* uv = &val[5];
2553+
if (!value_to_uint(uv, &v, 0, UINT32_MAX))
2554+
rc = COMMAND_LINE_ERROR;
2555+
else
2556+
settings->GfxCapsFilter = (UINT32)v;
2557+
}
25132558
}
2514-
else if (_strnicmp("AVC420", arg->Value, 7) != 0)
2515-
return COMMAND_LINE_ERROR;
2559+
free(p);
2560+
if (rc != CHANNEL_RC_OK)
2561+
return rc;
25162562
}
25172563
}
25182564
#endif

client/common/cmdline.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
134134
{ "gestures", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL,
135135
"Consume multitouch input locally" },
136136
#ifdef WITH_GFX_H264
137-
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, "[RFX|AVC420|AVC444]", NULL, NULL, -1, NULL,
138-
"RDP8 graphics pipeline" },
139-
{ "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "[AVC420|AVC444]", NULL, NULL, -1, NULL,
140-
"RDP8.1 graphics pipeline using H264 codec" },
137+
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, "[[RFX|AVC420|AVC444],mask:<value>]", NULL, NULL, -1,
138+
NULL, "RDP8 graphics pipeline" },
139+
{ "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "[[AVC420|AVC444],mask:<value>]", NULL, NULL, -1,
140+
NULL, "RDP8.1 graphics pipeline using H264 codec" },
141141
#else
142142
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, "RFX", NULL, NULL, -1, NULL, "RDP8 graphics pipeline" },
143143
#endif

0 commit comments

Comments
 (0)