mfreerdp-server: fix build

This commit is contained in:
Marc-André Moreau 2014-09-13 12:33:33 -04:00
parent b7351e0795
commit aa49e63cda
8 changed files with 43 additions and 192 deletions

View File

@ -34,19 +34,18 @@ static const AUDIO_FORMAT supported_audio_formats[] =
static void mf_peer_audin_opening(audin_server_context* context)
{
DEBUG_WARN( "AUDIN opening.\n");
/* Simply choose the first format supported by the client. */
context->SelectFormat(context, 0);
}
static void mf_peer_audin_open_result(audin_server_context* context, UINT32 result)
{
DEBUG_WARN( "AUDIN open result %d.\n", result);
}
static void mf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes)
{
DEBUG_WARN( "AUDIN receive %d frames.\n", nframes);
}
void mf_peer_audin_init(mfPeerContext* context)

View File

@ -26,7 +26,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
//#include <util.h>
#include "mf_event.h"
@ -49,9 +48,6 @@ void mf_signal_event(mfEventQueue* event_queue)
int length;
length = write(event_queue->pipe_fd[1], "sig", 4);
if (length != 4)
DEBUG_WARN( "mf_signal_event: error\n");
}
void mf_set_event(mfEventQueue* event_queue)
@ -59,9 +55,6 @@ void mf_set_event(mfEventQueue* event_queue)
int length;
length = write(event_queue->pipe_fd[1], "sig", 4);
if (length != 4)
DEBUG_WARN( "mf_set_event: error\n");
}
void mf_clear_events(mfEventQueue* event_queue)
@ -71,9 +64,6 @@ void mf_clear_events(mfEventQueue* event_queue)
while (mf_is_event_set(event_queue))
{
length = read(event_queue->pipe_fd[0], &length, 4);
if (length != 4)
DEBUG_WARN( "mf_clear_event: error\n");
}
}
@ -82,9 +72,6 @@ void mf_clear_event(mfEventQueue* event_queue)
int length;
length = read(event_queue->pipe_fd[0], &length, 4);
if (length != 4)
DEBUG_WARN( "mf_clear_event: error\n");
}
void mf_event_push(mfEventQueue* event_queue, mfEvent* event)
@ -188,7 +175,7 @@ mfEventQueue* mf_event_queue_new()
event_queue->events = (mfEvent**) malloc(sizeof(mfEvent*) * event_queue->size);
if (pipe(event_queue->pipe_fd) < 0)
DEBUG_WARN( "mf_event_queue_new: pipe failed\n");
return NULL;
pthread_mutex_init(&(event_queue->mutex), NULL);
}

View File

@ -34,16 +34,15 @@ static mfInfo* mfInfoInstance = NULL;
int mf_info_lock(mfInfo* mfi)
{
int status = pthread_mutex_lock(&mfi->mutex);
switch (status) {
switch (status)
{
case 0:
return TRUE;
break;
default:
DEBUG_MSG("mf_info_lock failed with %#X\n", status);
return -1;
break;
}
@ -55,7 +54,8 @@ int mf_info_try_lock(mfInfo* mfi, UINT32 ms)
int status = pthread_mutex_trylock(&mfi->mutex);
switch (status) {
switch (status)
{
case 0:
return TRUE;
break;
@ -65,7 +65,6 @@ int mf_info_try_lock(mfInfo* mfi, UINT32 ms)
break;
default:
DEBUG_MSG("mf_info_try_lock failed with %#X\n", status);
return -1;
break;
}
@ -76,13 +75,13 @@ int mf_info_unlock(mfInfo* mfi)
{
int status = pthread_mutex_unlock(&mfi->mutex);
switch (status) {
switch (status)
{
case 0:
return TRUE;
break;
default:
DEBUG_MSG("mf_info_unlock failed with %#X\n", status);
return -1;
break;
}
@ -96,52 +95,16 @@ mfInfo* mf_info_init()
mfi = (mfInfo*) malloc(sizeof(mfInfo));
memset(mfi, 0, sizeof(mfInfo));
if (mfi != NULL)
{
/* HKEY hKey;
LONG status;
DWORD dwType;
DWORD dwSize;
DWORD dwValue;
*/
int mutexInitStatus = pthread_mutex_init(&mfi->mutex, NULL);
if (mutexInitStatus != 0)
{
DEBUG_MSG(_T("CreateMutex error: %#X\n"), mutexInitStatus);
}
pthread_mutex_init(&mfi->mutex, NULL);
mfi->peers = (freerdp_peer**) malloc(sizeof(freerdp_peer*) * MF_INFO_MAXPEERS);
memset(mfi->peers, 0, sizeof(freerdp_peer*) * MF_INFO_MAXPEERS);
//Set FPS
mfi->framesPerSecond = MF_INFO_DEFAULT_FPS;
/*status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\FreeRDP\\Server"), 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
if (status == ERROR_SUCCESS)
{
if (RegQueryValueEx(hKey, _T("FramesPerSecond"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
mfi->framesPerSecond = dwValue;
}
RegCloseKey(hKey);*/
//Set input toggle
mfi->input_disabled = FALSE;
/*status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\FreeRDP\\Server"), 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
if (status == ERROR_SUCCESS)
{
if (RegQueryValueEx(hKey, _T("DisableInput"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
{
if (dwValue != 0)
mfi->input_disabled = TRUE;
}
}
RegCloseKey(hKey);*/
}
return mfi;
@ -161,9 +124,9 @@ void mf_info_peer_register(mfInfo* mfi, mfPeerContext* context)
{
int i;
int peerId;
if (mfi->peerCount == MF_INFO_MAXPEERS)
{
DEBUG_MSG("TODO: socketClose on OS X\n");
//context->socketClose = TRUE;
mf_info_unlock(mfi);
return;
@ -171,10 +134,6 @@ void mf_info_peer_register(mfInfo* mfi, mfPeerContext* context)
context->info = mfi;
//get the offset of the top left corner of selected screen
//EnumDisplayMonitors(NULL, NULL, mf_info_monEnumCB, 0);
//_IDcount = 0;
//initialize screen capture
if (mfi->peerCount == 0)
{
@ -201,8 +160,6 @@ void mf_info_peer_register(mfInfo* mfi, mfPeerContext* context)
//printf("Registering Peer: id=%d #=%d\n", peerId, mfi->peerCount);
mf_info_unlock(mfi);
//mfreerdp_server_peer_callback_event(peerId, MF_SRV_CALLBACK_EVENT_CONNECT);
}
}
@ -216,16 +173,12 @@ void mf_info_peer_unregister(mfInfo* mfi, mfPeerContext* context)
mfi->peers[peerId] = NULL;
mfi->peerCount--;
//printf("Unregistering Peer: id=%d, #=%d\n", peerId, mfi->peerCount);
//screen capture cleanup
if (mfi->peerCount == 0)
{
mf_mlion_stop_getting_screen_updates();
}
mf_info_unlock(mfi);
//mfreerdp_server_peer_callback_event(peerId, MF_SRV_CALLBACK_EVENT_DISCONNECT);
}
}
@ -239,14 +192,7 @@ BOOL mf_info_have_updates(mfInfo* mfi)
void mf_info_update_changes(mfInfo* mfi)
{
/*#ifdef WITH_WIN8
mf_dxgi_nextFrame(mfi, mfi->framesPerSecond * 1000);
#else
GETCHANGESBUF* buf;
buf = (GETCHANGESBUF*) mfi->changeBuffer;
mfi->nextUpdate = buf->buffer->counter;
#endif*/
}
void mf_info_find_invalid_region(mfInfo* mfi)
@ -289,21 +235,3 @@ void mf_info_getScreenData(mfInfo* mfi, long* width, long* height, BYTE** pBits,
}
/*
BOOL CALLBACK mf_info_monEnumCB(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)
{
mfInfo * mfi;
mfi = mf_info_get_instance();
if(_IDcount == mfi->screenID)
{
mfi->servscreen_xoffset = lprcMonitor->left;
mfi->servscreen_yoffset = lprcMonitor->top;
}
_IDcount++;
return TRUE;
}
*/

View File

@ -82,24 +82,19 @@ void (^streamHandler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef, CGDisp
if (status != kCGDisplayStreamFrameStatusFrameComplete)
{
//unhandled
switch(status)
{
case kCGDisplayStreamFrameStatusFrameIdle:
DEBUG_MSG("kCGDisplayStreamFrameStatusFrameIdle\n");
break;
case kCGDisplayStreamFrameStatusStopped:
//we dont need to clean up
//printf("kCGDisplayStreamFrameStatusStopped\n");
break;
case kCGDisplayStreamFrameStatusFrameBlank:
DEBUG_MSG("kCGDisplayStreamFrameStatusFrameBlank\n");
break;
default:
DEBUG_MSG("Unhandled Frame Status!!!\n");
break;
}
}
@ -191,9 +186,9 @@ int mf_mlion_start_getting_screen_updates()
CGError err;
err = CGDisplayStreamStart(stream);
if(err != kCGErrorSuccess)
if (err != kCGErrorSuccess)
{
DEBUG_MSG("Failed to start displaystream!! err = %d\n", err);
return 1;
}
@ -205,9 +200,9 @@ int mf_mlion_stop_getting_screen_updates()
CGError err;
err = CGDisplayStreamStop(stream);
if(err != kCGErrorSuccess)
if (err != kCGErrorSuccess)
{
DEBUG_MSG("Failed to stop displaystream!! err = %d\n", err);
return 1;
}
@ -225,7 +220,6 @@ int mf_mlion_get_dirty_region(RFX_RECT* invalid)
mf_mlion_peek_dirty_region(invalid);
}
dispatch_semaphore_signal(region_sem);
return 0;

View File

@ -83,7 +83,7 @@ BOOL mf_peer_check_fds(freerdp_peer* client)
{
if (event->type == MF_EVENT_TYPE_REGION)
{
DEBUG_WARN( "unhandled event\n");
}
else if (event->type == MF_EVENT_TYPE_FRAME_TICK)
{
@ -253,18 +253,6 @@ BOOL mf_peer_post_connect(freerdp_peer* client)
mfPeerContext* context = (mfPeerContext*) client->context;
rdpSettings* settings = client->settings;
DEBUG_WARN( "Client %s post connect\n", client->hostname);
if (client->settings->AutoLogonEnabled)
{
DEBUG_WARN( " and wants to login automatically as %s\\%s",
client->settings->Domain ? client->settings->Domain : "",
client->settings->Username);
/* A real server may perform OS login here if NLA is not executed previously. */
}
DEBUG_WARN( "\n");
mfInfo* mfi = mf_info_get_instance();
mfi->scale = 1;
@ -274,8 +262,7 @@ BOOL mf_peer_post_connect(freerdp_peer* client)
if ((settings->DesktopWidth != mfi->servscreen_width) || (settings->DesktopHeight != mfi->servscreen_height))
{
DEBUG_WARN( "Client requested resolution %dx%d, but will resize to %dx%d\n",
settings->DesktopWidth, settings->DesktopHeight, mfi->servscreen_width, mfi->servscreen_height);
}
settings->DesktopWidth = mfi->servscreen_width;
@ -314,13 +301,11 @@ BOOL mf_peer_activate(freerdp_peer* client)
void mf_peer_synchronize_event(rdpInput* input, UINT32 flags)
{
DEBUG_WARN( "Client sent a synchronize event (flags:0x%08X)\n", flags);
}
void mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
DEBUG_WARN( "Client sent a keyboard event (flags:0x%04X code:0x%04X)\n", flags, code);
UINT16 down = 0x4000;
//UINT16 up = 0x8000;
@ -330,52 +315,16 @@ void mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
state_down = TRUE;
}
/*
CGEventRef event;
event = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)code, state_down);
CGEventPost(kCGHIDEventTap, event);
CFRelease(event);
*/
}
void mf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
DEBUG_WARN( "Client sent a unicode keyboard event (flags:0x%04X code:0x%04X)\n", flags, code);
}
/*void mf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//DEBUG_WARN( "Client sent a mouse event (flags:0x%04X pos: %d,%d)\n", flags, x, y);
}
void mf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
//DEBUG_WARN( "Client sent an extended mouse event (flags:0x%04X pos: %d,%d)\n", flags, x, y);
}
*/
/*static void mf_peer_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_16* areas)
{
BYTE i;
DEBUG_WARN( "Client requested to refresh:\n");
for (i = 0; i < count; i++)
{
DEBUG_WARN( " (%d, %d) (%d, %d)\n", areas[i].left, areas[i].top, areas[i].right, areas[i].bottom);
}
}*/
static void mf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area)
{
if (allow > 0)
{
DEBUG_WARN( "Client restore output (%d, %d) (%d, %d).\n", area->left, area->top, area->right, area->bottom);
}
else
{
DEBUG_WARN( "Client minimized and suppress output.\n");
}
}
void mf_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
@ -425,20 +374,18 @@ void* mf_peer_main_loop(void* arg)
client->Initialize(client);
context = (mfPeerContext*) client->context;
DEBUG_WARN( "We've got a client %s\n", client->local ? "(local)" : client->hostname);
while (1)
{
rcount = 0;
if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE)
{
DEBUG_WARN( "Failed to get FreeRDP file descriptor\n");
break;
}
if (mf_peer_get_fds(client, rfds, &rcount) != TRUE)
{
DEBUG_WARN( "Failed to get mfreerdp file descriptor\n");
break;
}
@ -468,20 +415,17 @@ void* mf_peer_main_loop(void* arg)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
DEBUG_WARN( "select failed\n");
break;
}
}
if (client->CheckFileDescriptor(client) != TRUE)
{
DEBUG_WARN( "Failed to check freerdp file descriptor\n");
break;
}
if ((mf_peer_check_fds(client)) != TRUE)
{
DEBUG_WARN( "Failed to check mfreerdp file descriptor\n");
break;
}
@ -491,8 +435,6 @@ void* mf_peer_main_loop(void* arg)
}
}
DEBUG_WARN( "Client %s disconnected.\n", client->local ? "(local)" : client->hostname);
client->Disconnect(client);
freerdp_peer_context_free(client);
freerdp_peer_free(client);

View File

@ -47,8 +47,6 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
//we should actually loop through the list of client formats here
//and see if we can send the client something that it supports...
DEBUG_MSG("Client supports the following %d formats: \n", context->num_client_formats);
for (i = 0; i < context->num_client_formats; i++)
{
/* TODO: improve the way we agree on a format */
@ -58,7 +56,6 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
(context->client_formats[i].nChannels == context->server_formats[j].nChannels) &&
(context->client_formats[i].nSamplesPerSec == context->server_formats[j].nSamplesPerSec))
{
DEBUG_MSG("agreed on format!\n");
formatAgreed = TRUE;
agreedFormat = (AUDIO_FORMAT*)&context->server_formats[j];
break;
@ -71,7 +68,6 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
if (formatAgreed == FALSE)
{
DEBUG_MSG("Could not agree on a audio format with the server\n");
return;
}
@ -114,10 +110,9 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
if (status != noErr)
{
DEBUG_MSG("Failed to create a new Audio Queue. Status code: %d\n", status);
}
UInt32 dataFormatSize = sizeof (recorderState.dataFormat);
AudioQueueGetProperty(recorderState.queue,
@ -211,7 +206,7 @@ void mf_peer_rdpsnd_input_callback (void *inUserD
if (status != noErr)
{
DEBUG_MSG("AudioQueueEnqueueBuffer() returned status = %d\n", status);
}
}

View File

@ -60,7 +60,6 @@ static void mf_server_main_loop(freerdp_listener* instance)
if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE)
{
DEBUG_WARN( "Failed to get FreeRDP file descriptor\n");
break;
}
@ -88,14 +87,12 @@ static void mf_server_main_loop(freerdp_listener* instance)
(errno == EINPROGRESS) ||
(errno == EINTR))) /* signal occurred */
{
DEBUG_WARN( "select failed\n");
break;
}
}
if (instance->CheckFileDescriptor(instance) != TRUE)
{
DEBUG_WARN( "Failed to check FreeRDP file descriptor\n");
break;
}
}

View File

@ -53,11 +53,6 @@ void mac_shadow_input_extended_mouse_event(macShadowSubsystem* subsystem, UINT16
}
int mac_shadow_surface_copy(macShadowSubsystem* subsystem)
{
return 1;
}
void* mac_shadow_subsystem_thread(macShadowSubsystem* subsystem)
{
DWORD status;
@ -66,7 +61,7 @@ void* mac_shadow_subsystem_thread(macShadowSubsystem* subsystem)
HANDLE StopEvent;
StopEvent = subsystem->server->StopEvent;
nCount = 0;
events[nCount++] = StopEvent;
@ -86,6 +81,18 @@ void* mac_shadow_subsystem_thread(macShadowSubsystem* subsystem)
int mac_shadow_subsystem_init(macShadowSubsystem* subsystem)
{
MONITOR_DEF* monitor;
subsystem->monitorCount = 1;
monitor = &(subsystem->monitors[0]);
monitor->left = 0;
monitor->top = 0;
monitor->right = 1024;
monitor->bottom = 768;
monitor->flags = 1;
return 1;
}
@ -139,6 +146,10 @@ macShadowSubsystem* mac_shadow_subsystem_new(rdpShadowServer* server)
return NULL;
subsystem->server = server;
subsystem->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
region16_init(&(subsystem->invalidRegion));
subsystem->Init = (pfnShadowSubsystemInit) mac_shadow_subsystem_init;
subsystem->Uninit = (pfnShadowSubsystemInit) mac_shadow_subsystem_uninit;
@ -146,8 +157,6 @@ macShadowSubsystem* mac_shadow_subsystem_new(rdpShadowServer* server)
subsystem->Stop = (pfnShadowSubsystemStop) mac_shadow_subsystem_stop;
subsystem->Free = (pfnShadowSubsystemFree) mac_shadow_subsystem_free;
subsystem->SurfaceCopy = (pfnShadowSurfaceCopy) mac_shadow_surface_copy;
subsystem->SynchronizeEvent = (pfnShadowSynchronizeEvent) mac_shadow_input_synchronize_event;
subsystem->KeyboardEvent = (pfnShadowKeyboardEvent) mac_shadow_input_keyboard_event;
subsystem->UnicodeKeyboardEvent = (pfnShadowUnicodeKeyboardEvent) mac_shadow_input_unicode_keyboard_event;