Skip to content

Commit

Permalink
initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
metalefty committed Oct 24, 2023
1 parent cc837bb commit 4d121ff
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
4 changes: 1 addition & 3 deletions common/xrdp_client_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ struct xrdp_client_info
int large_pointer_support_flags;

/* Image RemoteFX */
int irfx_codec_id;
int irfx_prop_len;
char irfx_prop[64];
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
18 changes: 13 additions & 5 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 @@ -572,20 +575,25 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
{
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(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);
self->client_info.irfx_codec_id = codec_id;
i1 = MIN(sizeof(self->client_info.irfx_prop), (size_t) codec_properties_length);

g_memcpy(self->client_info.irfx_prop, s->p, i1);
self->client_info.irfx_prop_len = i1;
#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)
{
Expand Down
26 changes: 14 additions & 12 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,25 +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
else if (client_info->rfx_codec_id != 0)
#if defined(XRDP_RFXCODEC)
else if (client_info->rfx_codec_id != 0 && client_info->rfx_codec_mode == CODEC_MODE_IMAGE)
{
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_create: starting rfx codec session");
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);
RFX_FORMAT_YUV, 0, CODEC_MODE_IMAGE);
}
else if (client_info->irfx_codec_id != 0)
else if (client_info->rfx_codec_id != 0)
{
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_create: starting image rfx codec session");
self->codec_id = client_info->irfx_codec_id;
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;
/* TODO */
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_VIDEO);
}
#endif
else if (client_info->h264_codec_id != 0)
Expand Down Expand Up @@ -296,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

0 comments on commit 4d121ff

Please sign in to comment.