nscodec capability set

This commit is contained in:
qubit 2011-10-03 00:36:41 +05:30
parent 8a52695ed0
commit 16eae52b1e
2 changed files with 55 additions and 2 deletions

View File

@ -151,6 +151,7 @@ add_subdirectory(libfreerdp-common)
add_subdirectory(libfreerdp-chanman)
add_subdirectory(libfreerdp-core)
add_subdirectory(libfreerdp-rfx)
add_subdirectory(libfreerdp-nsc)
if(NOT WIN32)
add_subdirectory(channels)

View File

@ -8,7 +8,7 @@
* 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
* 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,
@ -57,6 +57,9 @@ uint8 CAPSET_TYPE_STRINGS[][32] =
/* CODEC_GUID_REMOTEFX 0x76772F12BD724463AFB3B73C9C6F7886 */
#define CODEC_GUID_REMOTEFX "\x12\x2F\x77\x76\x72\xBD\x63\x44\xAF\xB3\xB7\x3C\x9C\x6F\x78\x86"
/* CODEC_GUID_NSCODEC 0xCA8D1BB9000F154F589FAE2D1A87E2D6 */
#define CODEC_GUID_NSCODEC "\xb9\x1b\x8d\xca\x0f\x00\x4f\x15\x58\x9f\xae\x2d\x1a\x87\xe2\xd6"
void rdp_read_capability_set_header(STREAM* s, uint16* length, uint16* type)
{
stream_read_uint16(s, *type); /* capabilitySetType */
@ -1367,6 +1370,7 @@ void rdp_read_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings)
if (settings->server_mode)
{
settings->rfx_codec = False;
settings->ns_codec = False;
}
while (bitmapCodecCount > 0)
@ -1377,6 +1381,12 @@ void rdp_read_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings)
stream_read_uint8(s, settings->rfx_codec_id);
settings->rfx_codec = True;
}
if (settings->server_mode && strncmp((char*)stream_get_tail(s),CODEC_GUID_NSCODEC, 16) == 0)
{
stream_seek(s, 16); /*codec GUID (16 bytes) */
stream_read_uint8(s, settings->ns_codec_id);
settings->ns_codec = True;
}
else
{
stream_seek(s, 16); /* codecGUID (16 bytes) */
@ -1438,6 +1448,21 @@ void rdp_write_rfx_client_capability_container(STREAM* s, rdpSettings* settings)
stream_write_uint8(s, CLW_ENTROPY_RLGR3); /* entropyBits */
}
/**
* Write NSCODEC Client Capability Container.\n
* @param s stream
* @param settings settings
*/
void rdp_write_nsc_client_capability_container(STREAM* s, rdpSettings* settings)
{
stream_write_uint16(s, 3); /* codecPropertiesLength */
/* TS_NSCODEC_CAPABILITYSET */
stream_write_uint8(s, 1); /* fAllowDynamicFidelity */
stream_write_uint8(s, 1); /* fAllowSubsampling */
stream_write_uint8(s, 3); /* colorLossLevel */
}
/**
* Write RemoteFX Server Capability Container.\n
* @param s stream
@ -1449,6 +1474,18 @@ void rdp_write_rfx_server_capability_container(STREAM* s, rdpSettings* settings)
stream_write_uint32(s, 0); /* reserved */
}
/**
* Write NSCODEC Server Capability Container.\n
* @param s stream
* @param settings settings
*/
void rdp_write_nsc_server_capability_container(STREAM* s, rdpSettings* settings)
{
stream_write_uint16(s, 4); /* codecPropertiesLength */
stream_write_uint32(s, 0); /* reserved */
}
/**
* Write bitmap codecs capability set.\n
* @msdn{dd891377}
@ -1466,6 +1503,8 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings)
bitmapCodecCount = 0;
if (settings->rfx_codec)
bitmapCodecCount++;
if (settings->ns_codec)
bitmapCodecCount++;
stream_write_uint8(s, bitmapCodecCount);
@ -1484,7 +1523,20 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings)
rdp_write_rfx_client_capability_container(s, settings);
}
}
if (settings->ns_codec)
{
stream_write(s, CODEC_GUID_NSCODEC, 16);
if (settings->server_mode)
{
stream_write_uint8(s, 0); /* codecID is defined by the client */
rdp_write_nsc_server_capability_container(s, settings);
}
else
{
stream_write_uint8(s, CODEC_ID_NSCODEC); /* codecID */
rdp_write_nsc_client_capability_container(s, settings);
}
}
rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CODECS);
}