Skip to content

Commit 6882b1f

Browse files
committed
mfreerdp-server: initial commit
1 parent 51cd809 commit 6882b1f

File tree

22 files changed

+760
-50
lines changed

22 files changed

+760
-50
lines changed

channels/cliprdr/client/cliprdr_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ static void cliprdr_process_terminate(rdpSvcPlugin* plugin)
274274
/* cliprdr is always built-in */
275275
#define VirtualChannelEntry cliprdr_VirtualChannelEntry
276276

277-
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
277+
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
278278
{
279279
cliprdrPlugin* _p;
280280

channels/disk/client/disk_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* na
697697
#define DeviceServiceEntry disk_DeviceServiceEntry
698698
#endif
699699

700-
const int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
700+
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
701701
{
702702
char* name;
703703
char* path;

channels/drdynvc/client/drdynvc_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ static void drdynvc_process_terminate(rdpSvcPlugin* plugin)
368368
/* drdynvc is always built-in */
369369
#define VirtualChannelEntry drdynvc_VirtualChannelEntry
370370

371-
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
371+
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
372372
{
373373
drdynvcPlugin* _p;
374374

channels/rail/client/rail_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static void rail_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
255255
/* rail is always built-in */
256256
#define VirtualChannelEntry rail_VirtualChannelEntry
257257

258-
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
258+
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
259259
{
260260
railPlugin* _p;
261261

channels/rdpdr/client/rdpdr_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static void rdpdr_process_terminate(rdpSvcPlugin* plugin)
319319
/* rdpdr is always built-in */
320320
#define VirtualChannelEntry rdpdr_VirtualChannelEntry
321321

322-
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
322+
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
323323
{
324324
rdpdrPlugin* _p;
325325

channels/rdpsnd/client/rdpsnd_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ static void rdpsnd_process_terminate(rdpSvcPlugin* plugin)
583583
/* rdpsnd is always built-in */
584584
#define VirtualChannelEntry rdpsnd_VirtualChannelEntry
585585

586-
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
586+
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
587587
{
588588
rdpsndPlugin* _p;
589589

channels/sample/client/sample_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static void sample_process_terminate(rdpSvcPlugin* plugin)
136136

137137
#define VirtualChannelEntry sample_VirtualChannelEntry
138138

139-
const int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
139+
int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
140140
{
141141
samplePlugin* _p;
142142

channels/tsmf/client/tsmf_media.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ TSMF_PRESENTATION* tsmf_presentation_new(const BYTE* guid, IWTSVirtualChannelCal
259259

260260
if (fout)
261261
{
262-
fprintf(fout, "%d\n", (int) thid);
262+
fprintf(fout, "%d\n", (int) (size_t) thid);
263263
fclose(fout);
264264
}
265265

client/Mac/MRDPRailView.h

+34-36
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,52 @@
77

88
@interface MRDPRailView : NSView
99
{
10-
freerdp * rdp_instance;
11-
rdpContext * context;
12-
NSBitmapImageRep * bmiRep;
13-
NSPoint savedDragLocation;
14-
char * pixelData;
15-
BOOL mouseInClientArea;
16-
BOOL titleBarClicked;
17-
BOOL gestureEventInProgress;
18-
int width;
19-
int height;
20-
int savedWindowId;
21-
int scrollWheelCount;
10+
freerdp* rdp_instance;
11+
rdpContext* context;
12+
NSBitmapImageRep* bmiRep;
13+
NSPoint savedDragLocation;
14+
char* pixelData;
15+
BOOL mouseInClientArea;
16+
BOOL titleBarClicked;
17+
BOOL gestureEventInProgress;
18+
int width;
19+
int height;
20+
int savedWindowId;
21+
int scrollWheelCount;
2222

23-
// store state info for some keys
24-
int kdlshift;
25-
int kdrshift;
26-
int kdlctrl;
27-
int kdrctrl;
28-
int kdlalt;
29-
int kdralt;
30-
int kdlmeta;
31-
int kdrmeta;
32-
int kdcapslock;
23+
/* store state info for some keys */
24+
int kdlshift;
25+
int kdrshift;
26+
int kdlctrl;
27+
int kdrctrl;
28+
int kdlalt;
29+
int kdralt;
30+
int kdlmeta;
31+
int kdrmeta;
32+
int kdcapslock;
3333

3434
@public
35-
BOOL isMoveSizeInProgress;
36-
BOOL saveInitialDragLoc;
37-
BOOL skipMoveWindowOnce;
38-
int localMoveType;
35+
BOOL isMoveSizeInProgress;
36+
BOOL saveInitialDragLoc;
37+
BOOL skipMoveWindowOnce;
38+
int localMoveType;
3939
}
4040

41-
@property (assign) MRDPRailWindow * mrdpRailWindow;
41+
@property (assign) MRDPRailWindow* mrdpRailWindow;
4242
@property (assign) int windowIndex;
4343
@property (assign) BOOL activateWindow;
4444

45-
- (void) windowDidMove:(NSNotification *) notification;
45+
- (void) windowDidMove:(NSNotification*) notification;
4646
- (void) updateDisplay;
47-
- (void) setRdpInstance:(freerdp *) instance width:(int) w andHeight:(int) h windowID:(int) windowID;
48-
- (BOOL) eventIsInClientArea :(NSEvent *) event :(int *) xptr :(int *) yptr;
47+
- (void) setRdpInstance:(freerdp*) instance width:(int) w andHeight:(int) h windowID:(int) windowID;
4948
- (void) setupBmiRep:(int) width :(int) height;
5049
- (void) releaseResources;
5150

52-
void mac_rail_MoveWindow(rdpRail *rail, rdpWindow *window);
53-
void apple_to_windowMove(NSRect * r, RAIL_WINDOW_MOVE_ORDER * windowMove);
54-
void mac_send_rail_client_event(rdpChannels *channels, UINT16 event_type, void *param);
55-
void windows_to_apple_cords(NSRect * r);
56-
void rail_MoveWindow(rdpRail * rail, rdpWindow * window);
51+
void mac_rail_MoveWindow(rdpRail* rail, rdpWindow* window);
52+
void apple_to_windowMove(NSRect* r, RAIL_WINDOW_MOVE_ORDER* windowMove);
53+
void mac_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param);
54+
void windows_to_apple_cords(NSRect* r);
55+
void rail_MoveWindow(rdpRail* rail, rdpWindow* window);
5756
void mac_rail_send_activate(int window_id);
5857

5958
@end
60-

client/Mac/MRDPRailView.m

+2-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
106106
}
107107

108108
/** *********************************************************************
109-
* called when a mouse move event occurrs
109+
* called when a mouse move event occurs
110110
*
111111
* ideally we want to be called when the mouse moves over NSView client area,
112112
* but in reality we get called any time the mouse moves anywhere on the screen;
@@ -130,7 +130,7 @@ - (void) mouseMoved:(NSEvent *)event
130130

131131
y = height - y;
132132

133-
// send mouse motion event to RDP server
133+
/* send mouse motion event to RDP server */
134134
rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_MOVE, x, y);
135135
}
136136

@@ -150,7 +150,6 @@ - (void)mouseDown:(NSEvent *) event
150150

151151
y = height - y;
152152

153-
154153
if ((yPos >= 4) && (yPos <= 20))
155154
titleBarClicked = YES;
156155
else

client/X11/xfreerdp.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,7 @@ int xfreerdp_run(freerdp* instance)
12421242
int thid = 0;
12431243
fscanf(fin, "%d", &thid);
12441244
fclose(fin);
1245-
pthread_kill((pthread_t) thid, SIGUSR1);
1245+
pthread_kill((pthread_t) (size_t) thid, SIGUSR1);
12461246

12471247
FILE *fin1 = fopen("/tmp/tsmf.tid", "rt");
12481248
int timeout = 5;
@@ -1254,7 +1254,7 @@ int xfreerdp_run(freerdp* instance)
12541254
if (timeout <= 0)
12551255
{
12561256
unlink("/tmp/tsmf.tid");
1257-
pthread_kill((pthread_t) thid, SIGKILL);
1257+
pthread_kill((pthread_t) (size_t) thid, SIGKILL);
12581258
break;
12591259
}
12601260
fin1 = fopen("/tmp/tsmf.tid", "rt");

server/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ if(NOT WIN32)
2525
endif()
2626

2727
find_suggested_package(X11)
28-
if(WITH_X11)
28+
if(WITH_X11 AND (NOT APPLE))
2929
add_subdirectory(X11)
3030
endif()
31+
32+
if(APPLE)
33+
add_subdirectory(Mac)
34+
endif()
3135
else()
3236
add_subdirectory(Windows)
3337
endif()

server/Mac/CMakeLists.txt

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# FreeRDP: A Remote Desktop Protocol Implementation
2+
# FreeRDP Mac OS X Server cmake build script
3+
#
4+
# Copyright 2012 Marc-Andre Moreau <[email protected]>
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
set(MODULE_NAME "mfreerdp-server")
19+
set(MODULE_PREFIX "FREERDP_SERVER_MAC")
20+
21+
set(${MODULE_PREFIX}_SRCS
22+
mfreerdp.c
23+
mfreerdp.h
24+
mf_audin.c
25+
mf_audin.h
26+
mf_rdpsnd.c
27+
mf_rdpsnd.h)
28+
29+
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
30+
31+
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-server)
32+
33+
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
34+
MONOLITHIC ${MONOLITHIC_BUILD}
35+
MODULE freerdp
36+
MODULES freerdp-core freerdp-utils freerdp-codec)
37+
38+
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
39+
MONOLITHIC ${MONOLITHIC_BUILD}
40+
MODULE winpr
41+
MODULES winpr-crt)
42+
43+
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
44+
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
45+
46+
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/Mac")

server/Mac/mf_audin.c

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* FreeRDP: A Remote Desktop Protocol Implementation
3+
* FreeRDP Mac OS X Server (Audio Input)
4+
*
5+
* Copyright 2012 Marc-Andre Moreau <[email protected]>
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
#ifdef HAVE_CONFIG_H
21+
#include "config.h"
22+
#endif
23+
24+
#include "mfreerdp.h"
25+
26+
#include "mf_audin.h"
27+
28+
static const rdpsndFormat audio_formats[] =
29+
{
30+
{ 0x11, 2, 22050, 1024, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 2 channels */
31+
{ 0x11, 1, 22050, 512, 4, 0, NULL }, /* IMA ADPCM, 22050 Hz, 1 channels */
32+
{ 0x01, 2, 22050, 4, 16, 0, NULL }, /* PCM, 22050 Hz, 2 channels, 16 bits */
33+
{ 0x01, 1, 22050, 2, 16, 0, NULL }, /* PCM, 22050 Hz, 1 channels, 16 bits */
34+
{ 0x01, 2, 44100, 4, 16, 0, NULL }, /* PCM, 44100 Hz, 2 channels, 16 bits */
35+
{ 0x01, 1, 44100, 2, 16, 0, NULL }, /* PCM, 44100 Hz, 1 channels, 16 bits */
36+
{ 0x01, 2, 11025, 4, 16, 0, NULL }, /* PCM, 11025 Hz, 2 channels, 16 bits */
37+
{ 0x01, 1, 11025, 2, 16, 0, NULL }, /* PCM, 11025 Hz, 1 channels, 16 bits */
38+
{ 0x01, 2, 8000, 4, 16, 0, NULL }, /* PCM, 8000 Hz, 2 channels, 16 bits */
39+
{ 0x01, 1, 8000, 2, 16, 0, NULL } /* PCM, 8000 Hz, 1 channels, 16 bits */
40+
};
41+
42+
static void mf_peer_audin_opening(audin_server_context* context)
43+
{
44+
printf("AUDIN opening.\n");
45+
/* Simply choose the first format supported by the client. */
46+
context->SelectFormat(context, 0);
47+
}
48+
49+
static void mf_peer_audin_open_result(audin_server_context* context, UINT32 result)
50+
{
51+
printf("AUDIN open result %d.\n", result);
52+
}
53+
54+
static void mf_peer_audin_receive_samples(audin_server_context* context, const void* buf, int nframes)
55+
{
56+
printf("AUDIN receive %d frames.\n", nframes);
57+
}
58+
59+
void mf_peer_audin_init(mfPeerContext* context)
60+
{
61+
context->audin = audin_server_context_new(context->vcm);
62+
context->audin->data = context;
63+
64+
context->audin->server_formats = audio_formats;
65+
context->audin->num_server_formats = sizeof(audio_formats) / sizeof(audio_formats[0]);
66+
67+
context->audin->dst_format.wFormatTag = 1;
68+
context->audin->dst_format.nChannels = 2;
69+
context->audin->dst_format.nSamplesPerSec = 44100;
70+
context->audin->dst_format.wBitsPerSample = 16;
71+
72+
context->audin->Opening = mf_peer_audin_opening;
73+
context->audin->OpenResult = mf_peer_audin_open_result;
74+
context->audin->ReceiveSamples = mf_peer_audin_receive_samples;
75+
}

server/Mac/mf_audin.h

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* FreeRDP: A Remote Desktop Protocol Implementation
3+
* FreeRDP Mac OS X Server (Audio Input)
4+
*
5+
* Copyright 2012 Marc-Andre Moreau <[email protected]>
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
#ifndef MF_AUDIN_H
21+
#define MF_AUDIN_H
22+
23+
#include <freerdp/freerdp.h>
24+
#include <freerdp/listener.h>
25+
#include <freerdp/server/audin.h>
26+
27+
#include "mfreerdp.h"
28+
29+
void mf_peer_audin_init(mfPeerContext* context);
30+
31+
#endif /* MF_AUDIN_H */
32+

0 commit comments

Comments
 (0)