Added /video support for wayland client

This commit is contained in:
Armin Novak 2021-10-18 10:18:42 +02:00 committed by akallabeth
parent 41d77cae46
commit 17d40edf5b
2 changed files with 63 additions and 5 deletions

View File

@ -23,6 +23,8 @@
#include <freerdp/gdi/gfx.h>
#include <freerdp/gdi/video.h>
#include "wlf_channels.h"
#include "wlf_cliprdr.h"
#include "wlf_disp.h"
@ -124,6 +126,18 @@ void wlf_OnChannelConnectedEventHandler(void* context, ChannelConnectedEventArgs
{
wlf_disp_init(wlf->disp, (DispClientContext*)e->pInterface);
}
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_init(wlf->context.gdi, (GeometryClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
gdi_video_control_init(wlf->context.gdi, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_init(wlf->context.gdi, (VideoClientContext*)e->pInterface);
}
}
void wlf_OnChannelDisconnectedEventHandler(void* context, ChannelDisconnectedEventArgs* e)
@ -153,4 +167,16 @@ void wlf_OnChannelDisconnectedEventHandler(void* context, ChannelDisconnectedEve
{
wlf_disp_uninit(wlf->disp, (DispClientContext*)e->pInterface);
}
else if (strcmp(e->name, GEOMETRY_DVC_CHANNEL_NAME) == 0)
{
gdi_video_geometry_uninit(wlf->context.gdi, (GeometryClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_CONTROL_DVC_CHANNEL_NAME) == 0)
{
gdi_video_control_uninit(wlf->context.gdi, (VideoClientContext*)e->pInterface);
}
else if (strcmp(e->name, VIDEO_DATA_DVC_CHANNEL_NAME) == 0)
{
gdi_video_data_uninit(wlf->context.gdi, (VideoClientContext*)e->pInterface);
}
}

View File

@ -24,6 +24,8 @@
#include <locale.h>
#include <float.h>
#include <winpr/sysinfo.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/channels/channels.h>
#include <freerdp/gdi/gdi.h>
@ -464,9 +466,13 @@ static BOOL handle_window_events(freerdp* instance)
static int wlfreerdp_run(freerdp* instance)
{
wlfContext* context;
DWORD count;
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
DWORD status = WAIT_ABANDONED;
HANDLE timer = NULL;
LARGE_INTEGER due;
TimerEventArgs timerEvent;
EventArgsInit(&timerEvent, "xfreerdp");
if (!instance)
return -1;
@ -482,13 +488,30 @@ static int wlfreerdp_run(freerdp* instance)
return -1;
}
timer = CreateWaitableTimerA(NULL, FALSE, "mainloop-periodic-timer");
if (!timer)
{
WLog_ERR(TAG, "failed to create timer");
goto disconnect;
}
due.QuadPart = 0;
if (!SetWaitableTimer(timer, &due, 20, NULL, NULL, FALSE))
{
goto disconnect;
}
while (!freerdp_shall_disconnect(instance))
{
handles[0] = context->displayHandle;
count =
freerdp_get_event_handles(instance->context, &handles[1], ARRAYSIZE(handles) - 1) + 1;
DWORD count = 0;
handles[count++] = timer;
handles[count++] = context->displayHandle;
count += freerdp_get_event_handles(instance->context, &handles[count],
ARRAYSIZE(handles) - count);
if (count <= 1)
if (count <= 2)
{
WLog_Print(context->log, WLOG_ERROR, "Failed to get FreeRDP file descriptor");
break;
@ -533,8 +556,17 @@ static int wlfreerdp_run(freerdp* instance)
break;
}
if ((status != WAIT_TIMEOUT) && (status == WAIT_OBJECT_0))
{
timerEvent.now = GetTickCount64();
PubSub_OnTimer(context->context.pubSub, context, &timerEvent);
}
}
disconnect:
if (timer)
CloseHandle(timer);
freerdp_disconnect(instance);
return status;
}