Fixed code duplication.
This commit is contained in:
parent
c7d701bdf8
commit
3eb004042e
@ -72,10 +72,7 @@ void xf_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEven
|
|||||||
}
|
}
|
||||||
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
|
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
|
||||||
{
|
{
|
||||||
if (settings->SoftwareGdi)
|
gdi_video_geometry_init(xfc->context.gdi, (GeometryClientContext*)e->pInterface);
|
||||||
gdi_video_geometry_init(xfc->context.gdi, (GeometryClientContext*)e->pInterface);
|
|
||||||
else
|
|
||||||
xf_video_geometry_init(xfc, (GeometryClientContext*)e->pInterface);
|
|
||||||
}
|
}
|
||||||
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
|
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
|
||||||
{
|
{
|
||||||
@ -86,10 +83,7 @@ void xf_OnChannelConnectedEventHandler(rdpContext* context, ChannelConnectedEven
|
|||||||
}
|
}
|
||||||
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
|
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
|
||||||
{
|
{
|
||||||
if (settings->SoftwareGdi)
|
gdi_video_data_init(xfc->context.gdi, (VideoClientContext*)e->pInterface);
|
||||||
gdi_video_data_init(xfc->context.gdi, (VideoClientContext*)e->pInterface);
|
|
||||||
else
|
|
||||||
xf_video_data_init(xfc, (VideoClientContext*)e->pInterface);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,10 +121,7 @@ void xf_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnect
|
|||||||
}
|
}
|
||||||
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
|
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
|
||||||
{
|
{
|
||||||
if (settings->SoftwareGdi)
|
gdi_video_geometry_uninit(xfc->context.gdi, (GeometryClientContext*)e->pInterface);
|
||||||
gdi_video_geometry_uninit(xfc->context.gdi, (GeometryClientContext*)e->pInterface);
|
|
||||||
else
|
|
||||||
xf_video_geometry_uninit(xfc, (GeometryClientContext*)e->pInterface);
|
|
||||||
}
|
}
|
||||||
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
|
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
|
||||||
{
|
{
|
||||||
@ -141,9 +132,6 @@ void xf_OnChannelDisconnectedEventHandler(rdpContext* context, ChannelDisconnect
|
|||||||
}
|
}
|
||||||
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
|
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
|
||||||
{
|
{
|
||||||
if (settings->SoftwareGdi)
|
gdi_video_data_uninit(xfc->context.gdi, (VideoClientContext*)e->pInterface);
|
||||||
gdi_video_data_uninit(xfc->context.gdi, (VideoClientContext*)e->pInterface);
|
|
||||||
else
|
|
||||||
xf_video_data_uninit(xfc, (VideoClientContext*)e->pInterface);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <freerdp/client/geometry.h>
|
#include <freerdp/client/geometry.h>
|
||||||
#include <freerdp/client/video.h>
|
#include <freerdp/client/video.h>
|
||||||
|
#include <freerdp/gdi/video.h>
|
||||||
|
|
||||||
#include "xf_video.h"
|
#include "xf_video.h"
|
||||||
|
|
||||||
@ -31,22 +32,6 @@ typedef struct
|
|||||||
XImage* image;
|
XImage* image;
|
||||||
} xfVideoSurface;
|
} xfVideoSurface;
|
||||||
|
|
||||||
|
|
||||||
void xf_video_geometry_init(xfContext* xfc, GeometryClientContext* geom)
|
|
||||||
{
|
|
||||||
xfc->geometry = geom;
|
|
||||||
|
|
||||||
if (xfc->video)
|
|
||||||
{
|
|
||||||
VideoClientContext* video = xfc->video;
|
|
||||||
video->setGeometry(video, xfc->geometry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf_video_geometry_uninit(xfContext* xfc, GeometryClientContext* geom)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, BYTE* data, UINT32 x, UINT32 y,
|
static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, BYTE* data, UINT32 x, UINT32 y,
|
||||||
UINT32 width, UINT32 height)
|
UINT32 width, UINT32 height)
|
||||||
{
|
{
|
||||||
@ -75,61 +60,51 @@ static VideoSurface* xfVideoCreateSurface(VideoClientContext* video, BYTE* data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL xfVideoShowSurface(VideoClientContext* video, xfVideoSurface* surface)
|
static BOOL xfVideoShowSurface(VideoClientContext* video, VideoSurface* surface)
|
||||||
{
|
{
|
||||||
|
xfVideoSurface* xfSurface = (xfVideoSurface*)surface;
|
||||||
xfContext* xfc = video->custom;
|
xfContext* xfc = video->custom;
|
||||||
#ifdef WITH_XRENDER
|
#ifdef WITH_XRENDER
|
||||||
|
|
||||||
if (xfc->context.settings->SmartSizing
|
if (xfc->context.settings->SmartSizing
|
||||||
|| xfc->context.settings->MultiTouchGestures)
|
|| xfc->context.settings->MultiTouchGestures)
|
||||||
{
|
{
|
||||||
XPutImage(xfc->display, xfc->primary, xfc->gc, surface->image,
|
XPutImage(xfc->display, xfc->primary, xfc->gc, xfSurface->image,
|
||||||
0, 0, surface->base.x, surface->base.y, surface->base.w, surface->base.h);
|
0, 0, surface->x, surface->y, surface->w, surface->h);
|
||||||
xf_draw_screen(xfc, surface->base.x, surface->base.y, surface->base.w, surface->base.h);
|
xf_draw_screen(xfc, surface->x, surface->y, surface->w, surface->h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
XPutImage(xfc->display, xfc->drawable, xfc->gc, surface->image,
|
XPutImage(xfc->display, xfc->drawable, xfc->gc, xfSurface->image,
|
||||||
0, 0,
|
0, 0,
|
||||||
surface->base.x, surface->base.y, surface->base.w, surface->base.h);
|
surface->x, surface->y, surface->w, surface->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL xfVideoDeleteSurface(VideoClientContext* video, xfVideoSurface* surface)
|
static BOOL xfVideoDeleteSurface(VideoClientContext* video, VideoSurface* surface)
|
||||||
{
|
{
|
||||||
XFree(surface->image);
|
xfVideoSurface* xfSurface = (xfVideoSurface*)surface;
|
||||||
|
|
||||||
|
if (xfSurface)
|
||||||
|
XFree(xfSurface->image);
|
||||||
|
|
||||||
free(surface);
|
free(surface);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
void xf_video_control_init(xfContext* xfc, VideoClientContext* video)
|
void xf_video_control_init(xfContext* xfc, VideoClientContext* video)
|
||||||
{
|
{
|
||||||
xfc->video = video;
|
gdi_video_control_init(xfc->context.gdi, video);
|
||||||
video->custom = xfc;
|
video->custom = xfc;
|
||||||
video->createSurface = xfVideoCreateSurface;
|
video->createSurface = xfVideoCreateSurface;
|
||||||
video->showSurface = (pcVideoShowSurface)xfVideoShowSurface;
|
video->showSurface = xfVideoShowSurface;
|
||||||
video->deleteSurface = (pcVideoDeleteSurface)xfVideoDeleteSurface;
|
video->deleteSurface = xfVideoDeleteSurface;
|
||||||
video->setGeometry(video, xfc->geometry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video)
|
void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video)
|
||||||
{
|
{
|
||||||
}
|
gdi_video_control_uninit(xfc->context.gdi, video);
|
||||||
|
|
||||||
static void xf_video_timer(xfContext* xfc, TimerEventArgs* timer)
|
|
||||||
{
|
|
||||||
xfc->video->timer(xfc->video, timer->now);
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf_video_data_init(xfContext* xfc, VideoClientContext* video)
|
|
||||||
{
|
|
||||||
PubSub_SubscribeTimer(xfc->context.pubSub, (pTimerEventHandler)xf_video_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf_video_data_uninit(xfContext* xfc, VideoClientContext* context)
|
|
||||||
{
|
|
||||||
PubSub_UnsubscribeTimer(xfc->context.pubSub, (pTimerEventHandler)xf_video_timer);
|
|
||||||
}
|
}
|
||||||
|
@ -27,15 +27,9 @@
|
|||||||
struct _xfVideoContext;
|
struct _xfVideoContext;
|
||||||
typedef struct _xfVideoContext xfVideoContext;
|
typedef struct _xfVideoContext xfVideoContext;
|
||||||
|
|
||||||
void xf_video_geometry_init(xfContext* xfc, GeometryClientContext* geom);
|
|
||||||
void xf_video_geometry_uninit(xfContext* xfc, GeometryClientContext* geom);
|
|
||||||
|
|
||||||
void xf_video_control_init(xfContext* xfc, VideoClientContext* video);
|
void xf_video_control_init(xfContext* xfc, VideoClientContext* video);
|
||||||
void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video);
|
void xf_video_control_uninit(xfContext* xfc, VideoClientContext* video);
|
||||||
|
|
||||||
void xf_video_data_init(xfContext* xfc, VideoClientContext* video);
|
|
||||||
void xf_video_data_uninit(xfContext* xfc, VideoClientContext* context);
|
|
||||||
|
|
||||||
xfVideoContext* xf_video_new(xfContext* xfc);
|
xfVideoContext* xf_video_new(xfContext* xfc);
|
||||||
void xf_video_free(xfVideoContext* context);
|
void xf_video_free(xfVideoContext* context);
|
||||||
|
|
||||||
|
@ -216,9 +216,7 @@ struct xf_context
|
|||||||
TsmfClientContext* tsmf;
|
TsmfClientContext* tsmf;
|
||||||
xfClipboard* clipboard;
|
xfClipboard* clipboard;
|
||||||
CliprdrClientContext* cliprdr;
|
CliprdrClientContext* cliprdr;
|
||||||
xfVideoContext *xfVideo;
|
xfVideoContext* xfVideo;
|
||||||
GeometryClientContext *geometry;
|
|
||||||
VideoClientContext *video;
|
|
||||||
RdpeiClientContext* rdpei;
|
RdpeiClientContext* rdpei;
|
||||||
EncomspClientContext* encomsp;
|
EncomspClientContext* encomsp;
|
||||||
xfDispContext* xfDisp;
|
xfDispContext* xfDisp;
|
||||||
|
Loading…
Reference in New Issue
Block a user