Skip to content

Commit

Permalink
add h264 surface command
Browse files Browse the repository at this point in the history
  • Loading branch information
jsorg71 committed Feb 6, 2015
1 parent f9009b9 commit c2347e9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 3 deletions.
5 changes: 4 additions & 1 deletion client/X11/xf_gdi.c
Expand Up @@ -650,7 +650,10 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
RFX_CONTEXT* rfx_context = (RFX_CONTEXT*) xfi->rfx_context;
NSC_CONTEXT* nsc_context = (NSC_CONTEXT*) xfi->nsc_context;

if (surface_bits_command->codecID == CODEC_ID_JPEG)
if (surface_bits_command->codecID == CODEC_ID_H264)
{
}
else if (surface_bits_command->codecID == CODEC_ID_JPEG)
{
tui8* comp;
tbool ok;
Expand Down
1 change: 1 addition & 0 deletions cmake/ConfigOptions.cmake
Expand Up @@ -26,6 +26,7 @@ option(WITH_DEBUG_WND "Print window order debug messages" OFF)
option(WITH_NEON "Enable NEON optimization for rfx decoder" OFF)
option(WITH_JPEG "Use JPEG decoding." OFF)
option(WITH_TJPEG "Use Turbo JPEG decoding." OFF)
option(WITH_H264 "Use H264 decoding." OFF)
option(WITH_CUPS "Use CUPS printing." OFF)
option(WITH_XRDPVR "Use xrdp video redirection." ON)
option(WITH_TCUTILS "Use Thinclient utilities." ON)
1 change: 1 addition & 0 deletions config.h.in
Expand Up @@ -39,6 +39,7 @@
#cmakedefine WITH_SSE2_TARGET
#cmakedefine WITH_JPEG
#cmakedefine WITH_TJPEG
#cmakedefine WITH_H264
#cmakedefine WITH_NEON
#cmakedefine WITH_DEBUG_X11
#cmakedefine WITH_DEBUG_X11_CLIPRDR
Expand Down
3 changes: 2 additions & 1 deletion include/freerdp/constants.h
Expand Up @@ -29,7 +29,8 @@ enum RDP_CODEC_ID
CODEC_ID_NONE = 0x00,
CODEC_ID_NSCODEC = 0x01,
CODEC_ID_JPEG = 0x02,
CODEC_ID_REMOTEFX = 0x03
CODEC_ID_REMOTEFX = 0x03,
CODEC_ID_H264 = 0x04
};

/**
Expand Down
3 changes: 2 additions & 1 deletion include/freerdp/settings.h
Expand Up @@ -372,7 +372,8 @@ struct rdp_settings
uint32 jpeg_codec_id; /* 287 */
uint32 jpeg_quality; /* 288 */
uint32 v3_codec_id; /* 289 */
uint32 paddingM[296 - 290]; /* 290 */
boolean h264_codec; /* 290 */
uint32 paddingM[296 - 291]; /* 291 */

/* Recording */
boolean dump_rfx; /* 296 */
Expand Down
15 changes: 15 additions & 0 deletions libfreerdp-core/capabilities.c
Expand Up @@ -65,6 +65,9 @@ static const char* const CAPSET_TYPE_STRINGS[] =
/* CODEC_GUID_JPEG 0x430C9EED1BAF4CE6869ACB8B37B66237*/
#define CODEC_GUID_JPEG "\xE6\x4C\xAF\x1B\xED\x9E\x0C\x43\x86\x9A\xCB\x8B\x37\xB6\x62\x37"

/* MFVideoFormat_H264 ({34363248-0000-0010-8000-00AA00389B71}) */
#define CODEC_GUID_H264 "\x48\x32\x36\x34\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"

void rdp_read_capability_set_header(STREAM* s, uint16* length, uint16* type)
{
stream_read_uint16(s, *type); /* capabilitySetType */
Expand Down Expand Up @@ -1534,6 +1537,12 @@ void rdp_write_jpeg_client_capability_container(STREAM* s, rdpSettings* settings
stream_write_uint8(s, settings->jpeg_quality);
}

void rdp_write_h264_client_capability_container(STREAM* s, rdpSettings* settings)
{
stream_write_uint16(s, 64); /* codecPropertiesLength */
stream_write_zero(s, 64);
}

/**
* Write RemoteFX Server Capability Container.\n
* @param s stream
Expand Down Expand Up @@ -1630,6 +1639,12 @@ void rdp_write_bitmap_codecs_capability_set(STREAM* s, rdpSettings* settings)
rdp_write_jpeg_client_capability_container(s, settings);
}
}
if (settings->h264_codec)
{
stream_write(s, CODEC_GUID_H264, 16);
stream_write_uint8(s, CODEC_ID_H264); /* codecID */
rdp_write_h264_client_capability_container(s, settings);
}
rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CODECS);
}

Expand Down
9 changes: 9 additions & 0 deletions libfreerdp-utils/args.c
Expand Up @@ -108,6 +108,9 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
#if defined(WITH_JPEG) || defined(WITH_TJPEG)
" --jpeg: enable jpeg codec, uses 75 quality\n"
" --jpegex: enable jpeg and set quality(1..99)\n"
#endif
#if defined(WITH_H264)
" --h264: enable h264 codec\n"
#endif
" --disable-wallpaper: disables wallpaper\n"
" --composition: enable desktop composition\n"
Expand Down Expand Up @@ -421,6 +424,12 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
settings->jpeg_codec = true;
settings->jpeg_quality = atoi(argv[index]);
}
#endif
#if defined(WITH_H264)
else if (strcmp("--h264", argv[index]) == 0)
{
settings->h264_codec = true;
}
#endif
else if (strcmp("--rfx", argv[index]) == 0)
{
Expand Down

0 comments on commit c2347e9

Please sign in to comment.