20#include <winpr/assert.h>
21#include <freerdp/client/geometry.h>
22#include <freerdp/client/video.h>
23#include <freerdp/gdi/video.h>
28#include <freerdp/log.h>
29#define TAG CLIENT_TAG("video")
37static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, UINT32 x, UINT32 y,
38 UINT32 width, UINT32 height)
40 xfContext* xfc = NULL;
41 xfVideoSurface* ret = NULL;
44 ret = (xfVideoSurface*)VideoClient_CreateCommonContext(
sizeof(xfContext), x, y, width, height);
48 xfc = (xfContext*)video->custom;
51 ret->image = LogDynAndXCreateImage(xfc->log, xfc->display, xfc->visual,
52 WINPR_ASSERTING_INT_CAST(uint32_t, xfc->depth), ZPixmap, 0,
53 (
char*)ret->base.data, width, height, 8,
54 WINPR_ASSERTING_INT_CAST(
int, ret->base.scanline));
58 WLog_ERR(TAG,
"unable to create surface image");
59 VideoClient_DestroyCommonContext(&ret->base);
66static BOOL xfVideoShowSurface(VideoClientContext* video,
const VideoSurface* surface,
67 WINPR_ATTR_UNUSED UINT32 destinationWidth,
68 WINPR_ATTR_UNUSED UINT32 destinationHeight)
70 const xfVideoSurface* xfSurface = (
const xfVideoSurface*)surface;
71 xfContext* xfc = NULL;
72 const rdpSettings* settings = NULL;
75 WINPR_ASSERT(xfSurface);
80 settings = xfc->common.context.settings;
81 WINPR_ASSERT(settings);
88 LogDynAndXPutImage(xfc->log, xfc->display, xfc->primary, xfc->gc, xfSurface->image, 0, 0,
89 WINPR_ASSERTING_INT_CAST(
int, surface->x),
90 WINPR_ASSERTING_INT_CAST(
int, surface->y), surface->w, surface->h);
91 xf_draw_screen(xfc, WINPR_ASSERTING_INT_CAST(int32_t, surface->x),
92 WINPR_ASSERTING_INT_CAST(int32_t, surface->y),
93 WINPR_ASSERTING_INT_CAST(int32_t, surface->w),
94 WINPR_ASSERTING_INT_CAST(int32_t, surface->h));
99 LogDynAndXPutImage(xfc->log, xfc->display, xfc->drawable, xfc->gc, xfSurface->image, 0, 0,
100 WINPR_ASSERTING_INT_CAST(
int, surface->x),
101 WINPR_ASSERTING_INT_CAST(
int, surface->y), surface->w, surface->h);
107static BOOL xfVideoDeleteSurface(VideoClientContext* video,
VideoSurface* surface)
109 xfVideoSurface* xfSurface = (xfVideoSurface*)surface;
114 XFree(xfSurface->image);
116 VideoClient_DestroyCommonContext(surface);
120void xf_video_control_init(xfContext* xfc, VideoClientContext* video)
125 gdi_video_control_init(xfc->common.context.gdi, video);
128 if (xfc->depth >= 24)
131 video->createSurface = xfVideoCreateSurface;
132 video->showSurface = xfVideoShowSurface;
133 video->deleteSurface = xfVideoDeleteSurface;
137void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video)
140 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