Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Image RemoteFX #2789

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions common/xrdp_client_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ struct xrdp_client_info
unsigned int session_physical_height; /* in mm */

int large_pointer_support_flags;

/* Image RemoteFX */
int rfx_codec_mode;
};

/* yyyymmdd of last incompatible change to xrdp_client_info */
Expand Down
3 changes: 2 additions & 1 deletion libxrdp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ LIBXRDP_EXTRA_LIBS += $(FREERDP_LIBS)
endif

if XRDP_RFXCODEC
AM_CPPFLAGS += -DXRDP_RFXCODEC
AM_CPPFLAGS += -DXRDP_RFXCODEC \
-I$(top_srcdir)/librfxcodec/include
endif

if XRDP_TJPEG
Expand Down
26 changes: 22 additions & 4 deletions libxrdp/xrdp_caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include "libxrdp.h"
#include "ms-rdpbcgr.h"
#include "ms-rdperp.h"
#if defined(XRDP_RFXCODEC)
#include "ms-rdprfx.h"
#endif

/**
* The largest supported size for a fastpath update
Expand Down Expand Up @@ -564,25 +567,40 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
LOG(LOG_LEVEL_INFO, "xrdp_caps_process_codecs: NSCodec(%s), codec id [%d], properties len [%d]",
codec_guid_str, codec_id, codec_properties_length);
self->client_info.ns_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
i1 = MIN(sizeof(self->client_info.ns_prop), (size_t) codec_properties_length);
g_memcpy(self->client_info.ns_prop, s->p, i1);
self->client_info.ns_prop_len = i1;
}
else if (g_memcmp(codec_guid, XR_CODEC_GUID_REMOTEFX, 16) == 0)
{
LOG(LOG_LEVEL_INFO, "xrdp_caps_process_codecs: RemoteFX(%s), codec id [%d], properties len [%d]",
codec_guid_str, codec_id, codec_properties_length);
#if defined(XRDP_RFXCODEC)
self->client_info.rfx_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
i1 = MIN(sizeof(self->client_info.rfx_prop), (size_t) codec_properties_length);
g_memcpy(self->client_info.rfx_prop, s->p, i1);
self->client_info.rfx_prop_len = i1;
self->client_info.rfx_codec_mode = CODEC_MODE_VIDEO;
#endif
}
else if (g_memcmp(codec_guid, XR_CODEC_GUID_IMAGE_REMOTEFX, 16) == 0)
{
LOG(LOG_LEVEL_INFO, "xrdp_caps_process_codecs: Image RemoteFX(%s), codec id [%d], properties len [%d]",
codec_guid_str, codec_id, codec_properties_length);
#if defined(XRDP_RFXCODEC)
self->client_info.rfx_codec_id = codec_id;
i1 = MIN(sizeof(self->client_info.rfx_prop), (size_t) codec_properties_length);
g_memcpy(self->client_info.rfx_prop, s->p, i1);
self->client_info.rfx_prop_len = i1;
self->client_info.rfx_codec_mode = CODEC_MODE_IMAGE;
#endif
}
else if (g_memcmp(codec_guid, XR_CODEC_GUID_JPEG, 16) == 0)
{
LOG(LOG_LEVEL_INFO, "xrdp_caps_process_codecs: JPEG(%s), codec id [%d], properties len [%d]",
codec_guid_str, codec_id, codec_properties_length);
self->client_info.jpeg_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
i1 = MIN(sizeof(self->client_info.jpeg_prop), (size_t) codec_properties_length);
g_memcpy(self->client_info.jpeg_prop, s->p, i1);
self->client_info.jpeg_prop_len = i1;
/* make sure that requested quality is between 0 to 100 */
Expand All @@ -599,7 +617,7 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
LOG(LOG_LEVEL_INFO, "xrdp_caps_process_codecs: H264(%s), codec id [%d], properties len [%d]",
codec_guid_str, codec_id, codec_properties_length);
self->client_info.h264_codec_id = codec_id;
i1 = MIN(64, codec_properties_length);
i1 = MIN(sizeof(self->client_info.h264_prop), (size_t) codec_properties_length);
g_memcpy(self->client_info.h264_prop, s->p, i1);
self->client_info.h264_prop_len = i1;
}
Expand Down
24 changes: 17 additions & 7 deletions xrdp/xrdp_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@
#include "thread_calls.h"
#include "fifo.h"

#ifdef XRDP_RFXCODEC
#if defined(XRDP_RFXCODEC)
#include "rfxcodec_encode.h"
#include "ms-rdprfx.h"
#endif



#define XRDP_SURCMD_PREFIX_BYTES 256

/*****************************************************************************/
Expand Down Expand Up @@ -101,17 +100,28 @@ xrdp_encoder_create(struct xrdp_mm *mm)
(32 << 24) | (3 << 16) | (8 << 12) | (8 << 8) | (8 << 4) | 8;
self->process_enc = process_enc_jpg;
}
#ifdef XRDP_RFXCODEC
#if defined(XRDP_RFXCODEC)
else if (client_info->rfx_codec_id != 0 && client_info->rfx_codec_mode == CODEC_MODE_IMAGE)
{
LOG(LOG_LEVEL_TRACE, "xrdp_encoder_create: starting image rfx codec session");
self->codec_id = client_info->rfx_codec_id;
self->in_codec_mode = 1;
client_info->capture_code = 2;
self->process_enc = process_enc_rfx;
self->codec_handle = rfxcodec_encode_create(mm->wm->screen->width,
mm->wm->screen->height,
RFX_FORMAT_YUV, 0, CODEC_MODE_IMAGE);
}
else if (client_info->rfx_codec_id != 0)
{
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_create: starting rfx codec session");
LOG(LOG_LEVEL_TRACE, "xrdp_encoder_create: starting rfx codec session");
self->codec_id = client_info->rfx_codec_id;
self->in_codec_mode = 1;
client_info->capture_code = 2;
self->process_enc = process_enc_rfx;
self->codec_handle = rfxcodec_encode_create(mm->wm->screen->width,
mm->wm->screen->height,
RFX_FORMAT_YUV, 0);
RFX_FORMAT_YUV, 0, CODEC_MODE_VIDEO);
}
#endif
else if (client_info->h264_codec_id != 0)
Expand Down Expand Up @@ -288,7 +298,7 @@ process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
return 0;
}

#ifdef XRDP_RFXCODEC
#if defined(XRDP_RFXCODEC)
/*****************************************************************************/
/* called from encoder thread */
static int
Expand Down
Loading