20 #ifndef FREERDP_SERVER_SHADOW_H
21 #define FREERDP_SERVER_SHADOW_H
23 #include <freerdp/api.h>
24 #include <freerdp/types.h>
26 #include <freerdp/freerdp.h>
27 #include <freerdp/settings.h>
28 #include <freerdp/listener.h>
30 #include <freerdp/channels/wtsvc.h>
31 #include <freerdp/channels/channels.h>
33 #include <freerdp/server/encomsp.h>
34 #include <freerdp/server/remdesk.h>
35 #include <freerdp/server/rdpsnd.h>
36 #if defined(CHANNEL_AUDIN_SERVER)
37 #include <freerdp/server/audin.h>
39 #include <freerdp/server/rdpgfx.h>
41 #include <freerdp/codec/color.h>
42 #include <freerdp/codec/region.h>
44 #include <winpr/crt.h>
45 #include <winpr/synch.h>
46 #include <winpr/collections.h>
47 #include <winpr/cmdline.h>
61 typedef struct rdp_shadow_multiclient_event rdpShadowMultiClientEvent;
64 typedef int (*pfnShadowSubsystemEntry)(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
66 typedef rdpShadowSubsystem* (*pfnShadowSubsystemNew)(void);
67 typedef void (*pfnShadowSubsystemFree)(rdpShadowSubsystem* subsystem);
69 typedef int (*pfnShadowSubsystemInit)(rdpShadowSubsystem* subsystem);
70 typedef int (*pfnShadowSubsystemUninit)(rdpShadowSubsystem* subsystem);
72 typedef int (*pfnShadowSubsystemStart)(rdpShadowSubsystem* subsystem);
73 typedef int (*pfnShadowSubsystemStop)(rdpShadowSubsystem* subsystem);
75 typedef UINT32 (*pfnShadowEnumMonitors)(
MONITOR_DEF* monitors, UINT32 maxMonitors);
77 typedef int (*pfnShadowAuthenticate)(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
78 const char* user,
const char* domain,
79 const char* password);
80 typedef BOOL (*pfnShadowClientConnect)(rdpShadowSubsystem* subsystem, rdpShadowClient* client);
81 typedef void (*pfnShadowClientDisconnect)(rdpShadowSubsystem* subsystem,
82 rdpShadowClient* client);
83 typedef BOOL (*pfnShadowClientCapabilities)(rdpShadowSubsystem* subsystem,
84 rdpShadowClient* client);
86 typedef BOOL (*pfnShadowSynchronizeEvent)(rdpShadowSubsystem* subsystem,
87 rdpShadowClient* client, UINT32 flags);
88 typedef BOOL (*pfnShadowKeyboardEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
89 UINT16 flags, UINT8 code);
90 typedef BOOL (*pfnShadowUnicodeKeyboardEvent)(rdpShadowSubsystem* subsystem,
91 rdpShadowClient* client, UINT16 flags,
93 typedef BOOL (*pfnShadowMouseEvent)(rdpShadowSubsystem* subsystem, rdpShadowClient* client,
94 UINT16 flags, UINT16 x, UINT16 y);
95 typedef BOOL (*pfnShadowExtendedMouseEvent)(rdpShadowSubsystem* subsystem,
96 rdpShadowClient* client, UINT16 flags, UINT16 x,
99 typedef BOOL (*pfnShadowChannelAudinServerReceiveSamples)(rdpShadowSubsystem* subsystem,
100 rdpShadowClient* client,
116 wMessageQueue* MsgQueue;
119 rdpShadowServer* server;
120 rdpShadowEncoder* encoder;
121 rdpShadowSubsystem* subsystem;
127 EncomspServerContext* encomsp;
128 RemdeskServerContext* remdesk;
129 RdpsndServerContext* rdpsnd;
130 #if defined(CHANNEL_AUDIN_SERVER)
131 audin_server_context* audin;
133 RdpgfxServerContext* rdpgfx;
135 BOOL resizeRequested;
138 BOOL areGfxCapsReady;
147 rdpSettings* settings;
148 rdpShadowScreen* screen;
149 rdpShadowSurface* surface;
150 rdpShadowSurface* lobby;
151 rdpShadowCapture* capture;
152 rdpShadowSubsystem* subsystem;
159 UINT32 selectedMonitor;
164 H264_RATECONTROL_MODE h264RateControlMode;
166 UINT32 h264FrameRate;
171 char* CertificateFile;
172 char* PrivateKeyFile;
174 freerdp_listener* listener;
176 size_t maxClientsConnected;
181 rdpShadowServer* server;
197 pfnShadowSubsystemNew New;
198 pfnShadowSubsystemFree Free;
200 pfnShadowSubsystemInit Init;
201 pfnShadowSubsystemUninit Uninit;
203 pfnShadowSubsystemStart Start;
204 pfnShadowSubsystemStop Stop;
206 pfnShadowEnumMonitors EnumMonitors;
211 RDP_SHADOW_ENTRY_POINTS ep;
214 UINT32 captureFrameRate;
215 UINT32 selectedMonitor;
222 rdpShadowMultiClientEvent* updateEvent;
229 size_t nRdpsndFormats;
231 size_t nAudinFormats;
233 pfnShadowSynchronizeEvent SynchronizeEvent;
234 pfnShadowKeyboardEvent KeyboardEvent;
235 pfnShadowUnicodeKeyboardEvent UnicodeKeyboardEvent;
236 pfnShadowMouseEvent MouseEvent;
237 pfnShadowExtendedMouseEvent ExtendedMouseEvent;
238 pfnShadowChannelAudinServerReceiveSamples AudinServerReceiveSamples;
240 pfnShadowAuthenticate Authenticate;
241 pfnShadowClientConnect ClientConnect;
242 pfnShadowClientDisconnect ClientDisconnect;
243 pfnShadowClientCapabilities ClientCapabilities;
245 rdpShadowServer* server;
249 #define SHADOW_MSG_IN_REFRESH_REQUEST_ID 1001
252 typedef void (*MSG_OUT_FREE_FN)(UINT32 id,
253 SHADOW_MSG_OUT* msg);
258 MSG_OUT_FREE_FN Free;
261 #define SHADOW_MSG_OUT_POINTER_POSITION_UPDATE_ID 2001
262 #define SHADOW_MSG_OUT_POINTER_ALPHA_UPDATE_ID 2002
263 #define SHADOW_MSG_OUT_AUDIO_OUT_SAMPLES_ID 2003
264 #define SHADOW_MSG_OUT_AUDIO_OUT_VOLUME_ID 2004
268 SHADOW_MSG_OUT common;
275 SHADOW_MSG_OUT common;
280 UINT32 lengthAndMask;
281 UINT32 lengthXorMask;
288 SHADOW_MSG_OUT common;
297 SHADOW_MSG_OUT common;
302 FREERDP_API
void shadow_subsystem_set_entry_builtin(
const char* name);
303 FREERDP_API
void shadow_subsystem_set_entry(pfnShadowSubsystemEntry pEntry);
305 FREERDP_API WINPR_DEPRECATED_VAR(
306 "[since 3.4.0] Use shadow_subsystem_pointer_convert_alpha_pointer_data_to_format instead",
307 int shadow_subsystem_pointer_convert_alpha_pointer_data(
308 const BYTE* WINPR_RESTRICT pixels, BOOL premultiplied, UINT32 width, UINT32 height,
324 FREERDP_API
int shadow_subsystem_pointer_convert_alpha_pointer_data_to_format(
325 const BYTE* WINPR_RESTRICT pixels, UINT32 format, BOOL premultiplied, UINT32 width,
328 FREERDP_API
int shadow_server_parse_command_line(rdpShadowServer* server,
int argc,
char** argv,
330 FREERDP_API
int shadow_server_command_line_status_print(rdpShadowServer* server,
int argc,
331 char** argv,
int status,
334 FREERDP_API
int shadow_server_start(rdpShadowServer* server);
335 FREERDP_API
int shadow_server_stop(rdpShadowServer* server);
337 FREERDP_API
int shadow_server_init(rdpShadowServer* server);
338 FREERDP_API
int shadow_server_uninit(rdpShadowServer* server);
340 FREERDP_API UINT32 shadow_enum_monitors(
MONITOR_DEF* monitors, UINT32 maxMonitors);
342 FREERDP_API
void shadow_server_free(rdpShadowServer* server);
344 WINPR_ATTR_MALLOC(shadow_server_free, 1)
345 FREERDP_API rdpShadowServer* shadow_server_new(
void);
349 FREERDP_API WINPR_DEPRECATED_VAR(
350 "[since 3.4.0] Use shadow_capture_compare_with_format",
351 int shadow_capture_compare(const BYTE* WINPR_RESTRICT pData1, UINT32 nStep1, UINT32 nWidth,
352 UINT32 nHeight, const BYTE* WINPR_RESTRICT pData2, UINT32 nStep2,
371 FREERDP_API
int shadow_capture_compare_with_format(const BYTE* WINPR_RESTRICT pData1,
372 UINT32 format1, UINT32 nStep1, UINT32 nWidth,
374 const BYTE* WINPR_RESTRICT pData2,
375 UINT32 format2, UINT32 nStep2,
378 FREERDP_API
void shadow_subsystem_frame_update(rdpShadowSubsystem* subsystem);
380 FREERDP_API BOOL shadow_client_post_msg(rdpShadowClient* client,
void* context, UINT32 type,
381 SHADOW_MSG_OUT* msg,
void* lParam);
382 FREERDP_API
int shadow_client_boardcast_msg(rdpShadowServer* server,
void* context, UINT32 type,
383 SHADOW_MSG_OUT* msg,
void* lParam);
384 FREERDP_API
int shadow_client_boardcast_quit(rdpShadowServer* server,
int nExitCode);
386 FREERDP_API UINT32 shadow_encoder_preferred_fps(rdpShadowEncoder* encoder);
387 FREERDP_API UINT32 shadow_encoder_inflight_frames(rdpShadowEncoder* encoder);
389 FREERDP_API BOOL shadow_screen_resize(rdpShadowScreen* screen);