20#include <winpr/assert.h>
21#include <freerdp/client/geometry.h>
22#include <freerdp/client/video.h>
23#include <freerdp/gdi/video.h>
27#include <freerdp/log.h>
28#define TAG CLIENT_TAG("video")
36static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, UINT32 x, UINT32 y,
37 UINT32 width, UINT32 height)
39 xfContext* xfc = NULL;
40 xfVideoSurface* ret = NULL;
43 ret = (xfVideoSurface*)VideoClient_CreateCommonContext(
sizeof(xfContext), x, y, width, height);
47 xfc = (xfContext*)video->custom;
50 ret->image = XCreateImage(
51 xfc->display, xfc->visual, WINPR_ASSERTING_INT_CAST(uint32_t, xfc->depth), ZPixmap, 0,
52 (
char*)ret->base.data, width, height, 8, WINPR_ASSERTING_INT_CAST(
int, ret->base.scanline));
56 WLog_ERR(TAG,
"unable to create surface image");
57 VideoClient_DestroyCommonContext(&ret->base);
64static BOOL xfVideoShowSurface(VideoClientContext* video,
const VideoSurface* surface,
65 WINPR_ATTR_UNUSED UINT32 destinationWidth,
66 WINPR_ATTR_UNUSED UINT32 destinationHeight)
68 const xfVideoSurface* xfSurface = (
const xfVideoSurface*)surface;
69 xfContext* xfc = NULL;
70 const rdpSettings* settings = NULL;
73 WINPR_ASSERT(xfSurface);
78 settings = xfc->common.context.settings;
79 WINPR_ASSERT(settings);
86 XPutImage(xfc->display, xfc->primary, xfc->gc, xfSurface->image, 0, 0,
87 WINPR_ASSERTING_INT_CAST(
int, surface->x),
88 WINPR_ASSERTING_INT_CAST(
int, surface->y), surface->w, surface->h);
89 xf_draw_screen(xfc, WINPR_ASSERTING_INT_CAST(int32_t, surface->x),
90 WINPR_ASSERTING_INT_CAST(int32_t, surface->y),
91 WINPR_ASSERTING_INT_CAST(int32_t, surface->w),
92 WINPR_ASSERTING_INT_CAST(int32_t, surface->h));
97 XPutImage(xfc->display, xfc->drawable, xfc->gc, xfSurface->image, 0, 0,
98 WINPR_ASSERTING_INT_CAST(
int, surface->x),
99 WINPR_ASSERTING_INT_CAST(
int, surface->y), surface->w, surface->h);
105static BOOL xfVideoDeleteSurface(VideoClientContext* video,
VideoSurface* surface)
107 xfVideoSurface* xfSurface = (xfVideoSurface*)surface;
112 XFree(xfSurface->image);
114 VideoClient_DestroyCommonContext(surface);
118void xf_video_control_init(xfContext* xfc, VideoClientContext* video)
123 gdi_video_control_init(xfc->common.context.gdi, video);
126 if (xfc->depth >= 24)
129 video->createSurface = xfVideoCreateSurface;
130 video->showSurface = xfVideoShowSurface;
131 video->deleteSurface = xfVideoDeleteSurface;
135void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video)
138 gdi_video_control_uninit(xfc->common.context.gdi, video);
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.
an implementation of surface used by the video channel