2 * FreeRDP: A Remote Desktop Protocol Implementation
3 * Audio Output Virtual Channel
5 * Copyright 2009-2011 Jay Sorg
6 * Copyright 2010-2011 Vic Lee
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
34 #include <winpr/crt.h>
35 #include <winpr/synch.h>
36 #include <winpr/print.h>
37 #include <winpr/cmdline.h>
38 #include <winpr/sysinfo.h>
39 #include <winpr/collections.h>
41 #include <freerdp/types.h>
42 #include <freerdp/addin.h>
43 #include <freerdp/constants.h>
44 #include <winpr/stream.h>
45 #include <freerdp/utils/signal.h>
46 #include <freerdp/utils/svc_plugin.h>
48 #include "rdpsnd_main.h"
50 #define TIME_DELAY_MS 65
62 AUDIO_FORMAT* ServerFormats;
63 UINT16 NumberOfServerFormats;
65 AUDIO_FORMAT* ClientFormats;
66 UINT16 NumberOfClientFormats;
83 rdpsndDevicePlugin* device;
86 void rdpsnd_send_wave_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, BYTE cConfirmedBlockNo);
88 static void* rdpsnd_schedule_thread(void* arg)
95 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) arg;
99 if (!MessageQueue_Wait(rdpsnd->queue))
102 if (!MessageQueue_Peek(rdpsnd->queue, &message, TRUE))
105 if (message.id == WMQ_QUIT)
108 wave = (RDPSND_WAVE*) message.wParam;
109 wCurrentTime = (UINT16) GetTickCount();
110 wTimeStamp = wave->wLocalTimeB;
112 if (wCurrentTime <= wTimeStamp)
114 wTimeDiff = wTimeStamp - wCurrentTime;
118 rdpsnd_send_wave_confirm_pdu(rdpsnd, wave->wTimeStampB, wave->cBlockNo);
125 void rdpsnd_send_quality_mode_pdu(rdpsndPlugin* rdpsnd)
129 pdu = Stream_New(NULL, 8);
130 Stream_Write_UINT8(pdu, SNDC_QUALITYMODE); /* msgType */
131 Stream_Write_UINT8(pdu, 0); /* bPad */
132 Stream_Write_UINT16(pdu, 4); /* BodySize */
133 Stream_Write_UINT16(pdu, HIGH_QUALITY); /* wQualityMode */
134 Stream_Write_UINT16(pdu, 0); /* Reserved */
136 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
139 void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
142 AUDIO_FORMAT* serverFormat;
143 AUDIO_FORMAT* clientFormat;
145 rdpsnd_free_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
146 rdpsnd->NumberOfClientFormats = 0;
147 rdpsnd->ClientFormats = NULL;
149 if (!rdpsnd->NumberOfServerFormats)
152 rdpsnd->ClientFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) * rdpsnd->NumberOfServerFormats);
153 for (index = 0; index < (int) rdpsnd->NumberOfServerFormats; index++)
155 serverFormat = &rdpsnd->ServerFormats[index];
157 if (rdpsnd->fixedFormat > 0 && (rdpsnd->fixedFormat != serverFormat->wFormatTag))
160 if (rdpsnd->fixedChannel > 0 && (rdpsnd->fixedChannel != serverFormat->nChannels))
163 if (rdpsnd->fixedRate > 0 && (rdpsnd->fixedRate != serverFormat->nSamplesPerSec))
166 if (rdpsnd->device && rdpsnd->device->FormatSupported(rdpsnd->device, serverFormat))
168 clientFormat = &rdpsnd->ClientFormats[rdpsnd->NumberOfClientFormats++];
170 CopyMemory(clientFormat, serverFormat, sizeof(AUDIO_FORMAT));
171 clientFormat->cbSize = 0;
173 if (serverFormat->cbSize > 0)
175 clientFormat->data = (BYTE*) malloc(serverFormat->cbSize);
176 CopyMemory(clientFormat->data, serverFormat->data, serverFormat->cbSize);
177 clientFormat->cbSize = serverFormat->cbSize;
183 fprintf(stderr, "Server ");
184 rdpsnd_print_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
185 fprintf(stderr, "\n");
187 fprintf(stderr, "Client ");
188 rdpsnd_print_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
189 fprintf(stderr, "\n");
193 void rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
200 UINT16 dwVolumeRight;
201 UINT16 wNumberOfFormats;
202 AUDIO_FORMAT* clientFormat;
204 dwVolumeLeft = ((50 * 0xFFFF) / 100); /* 50% */
205 dwVolumeRight = ((50 * 0xFFFF) / 100); /* 50% */
206 dwVolume = (dwVolumeLeft << 16) | dwVolumeRight;
210 if (rdpsnd->device->GetVolume)
211 dwVolume = rdpsnd->device->GetVolume(rdpsnd->device);
214 wNumberOfFormats = rdpsnd->NumberOfClientFormats;
218 for (index = 0; index < (int) wNumberOfFormats; index++)
219 length += (18 + rdpsnd->ClientFormats[index].cbSize);
221 pdu = Stream_New(NULL, length);
223 Stream_Write_UINT8(pdu, SNDC_FORMATS); /* msgType */
224 Stream_Write_UINT8(pdu, 0); /* bPad */
225 Stream_Write_UINT16(pdu, length - 4); /* BodySize */
227 Stream_Write_UINT32(pdu, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */
228 Stream_Write_UINT32(pdu, dwVolume); /* dwVolume */
229 Stream_Write_UINT32(pdu, 0); /* dwPitch */
230 Stream_Write_UINT16(pdu, 0); /* wDGramPort */
231 Stream_Write_UINT16(pdu, wNumberOfFormats); /* wNumberOfFormats */
232 Stream_Write_UINT8(pdu, 0); /* cLastBlockConfirmed */
233 Stream_Write_UINT16(pdu, 6); /* wVersion */
234 Stream_Write_UINT8(pdu, 0); /* bPad */
236 for (index = 0; index < (int) wNumberOfFormats; index++)
238 clientFormat = &rdpsnd->ClientFormats[index];
240 Stream_Write_UINT16(pdu, clientFormat->wFormatTag);
241 Stream_Write_UINT16(pdu, clientFormat->nChannels);
242 Stream_Write_UINT32(pdu, clientFormat->nSamplesPerSec);
243 Stream_Write_UINT32(pdu, clientFormat->nAvgBytesPerSec);
244 Stream_Write_UINT16(pdu, clientFormat->nBlockAlign);
245 Stream_Write_UINT16(pdu, clientFormat->wBitsPerSample);
246 Stream_Write_UINT16(pdu, clientFormat->cbSize);
248 if (clientFormat->cbSize > 0)
249 Stream_Write(pdu, clientFormat->data, clientFormat->cbSize);
252 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
255 void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream* s)
259 AUDIO_FORMAT* format;
260 UINT16 wNumberOfFormats;
262 rdpsnd_free_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
263 rdpsnd->NumberOfServerFormats = 0;
264 rdpsnd->ServerFormats = NULL;
266 Stream_Seek_UINT32(s); /* dwFlags */
267 Stream_Seek_UINT32(s); /* dwVolume */
268 Stream_Seek_UINT32(s); /* dwPitch */
269 Stream_Seek_UINT16(s); /* wDGramPort */
270 Stream_Read_UINT16(s, wNumberOfFormats);
271 Stream_Read_UINT8(s, rdpsnd->cBlockNo); /* cLastBlockConfirmed */
272 Stream_Read_UINT16(s, wVersion); /* wVersion */
273 Stream_Seek_UINT8(s); /* bPad */
275 rdpsnd->NumberOfServerFormats = wNumberOfFormats;
276 rdpsnd->ServerFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) * wNumberOfFormats);
278 for (index = 0; index < (int) wNumberOfFormats; index++)
280 format = &rdpsnd->ServerFormats[index];
282 Stream_Read_UINT16(s, format->wFormatTag); /* wFormatTag */
283 Stream_Read_UINT16(s, format->nChannels); /* nChannels */
284 Stream_Read_UINT32(s, format->nSamplesPerSec); /* nSamplesPerSec */
285 Stream_Read_UINT32(s, format->nAvgBytesPerSec); /* nAvgBytesPerSec */
286 Stream_Read_UINT16(s, format->nBlockAlign); /* nBlockAlign */
287 Stream_Read_UINT16(s, format->wBitsPerSample); /* wBitsPerSample */
288 Stream_Read_UINT16(s, format->cbSize); /* cbSize */
290 format->data = (BYTE*) malloc(format->cbSize);
291 Stream_Read(s, format->data, format->cbSize);
294 rdpsnd_select_supported_audio_formats(rdpsnd);
296 rdpsnd_send_client_audio_formats(rdpsnd);
299 rdpsnd_send_quality_mode_pdu(rdpsnd);
302 void rdpsnd_send_training_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, UINT16 wPackSize)
306 pdu = Stream_New(NULL, 8);
307 Stream_Write_UINT8(pdu, SNDC_TRAINING); /* msgType */
308 Stream_Write_UINT8(pdu, 0); /* bPad */
309 Stream_Write_UINT16(pdu, 4); /* BodySize */
310 Stream_Write_UINT16(pdu, wTimeStamp);
311 Stream_Write_UINT16(pdu, wPackSize);
313 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
316 static void rdpsnd_recv_training_pdu(rdpsndPlugin* rdpsnd, wStream* s)
321 Stream_Read_UINT16(s, wTimeStamp);
322 Stream_Read_UINT16(s, wPackSize);
324 rdpsnd_send_training_confirm_pdu(rdpsnd, wTimeStamp, wPackSize);
327 static void rdpsnd_recv_wave_info_pdu(rdpsndPlugin* rdpsnd, wStream* s, UINT16 BodySize)
330 AUDIO_FORMAT* format;
332 rdpsnd->expectingWave = TRUE;
334 Stream_Read_UINT16(s, rdpsnd->wTimeStamp);
335 Stream_Read_UINT16(s, wFormatNo);
336 Stream_Read_UINT8(s, rdpsnd->cBlockNo);
337 Stream_Seek(s, 3); /* bPad */
338 Stream_Read(s, rdpsnd->waveData, 4);
340 rdpsnd->waveDataSize = BodySize - 8;
342 format = &rdpsnd->ClientFormats[wFormatNo];
346 rdpsnd->isOpen = TRUE;
347 rdpsnd->wCurrentFormatNo = wFormatNo;
349 //rdpsnd_print_audio_format(format);
353 IFCALL(rdpsnd->device->Open, rdpsnd->device, format, rdpsnd->latency);
356 else if (wFormatNo != rdpsnd->wCurrentFormatNo)
358 rdpsnd->wCurrentFormatNo = wFormatNo;
362 IFCALL(rdpsnd->device->SetFormat, rdpsnd->device, format, rdpsnd->latency);
367 void rdpsnd_send_wave_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, BYTE cConfirmedBlockNo)
371 pdu = Stream_New(NULL, 8);
372 Stream_Write_UINT8(pdu, SNDC_WAVECONFIRM);
373 Stream_Write_UINT8(pdu, 0);
374 Stream_Write_UINT16(pdu, 4);
375 Stream_Write_UINT16(pdu, wTimeStamp);
376 Stream_Write_UINT8(pdu, cConfirmedBlockNo); /* cConfirmedBlockNo */
377 Stream_Write_UINT8(pdu, 0); /* bPad */
379 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
382 void rdpsnd_device_send_wave_confirm_pdu(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
384 MessageQueue_Post(device->rdpsnd->queue, NULL, 0, (void*) wave, NULL);
387 static void rdpsnd_recv_wave_pdu(rdpsndPlugin* rdpsnd, wStream* s)
392 AUDIO_FORMAT* format;
394 rdpsnd->expectingWave = FALSE;
397 * The Wave PDU is a special case: it is always sent after a Wave Info PDU,
398 * and we do not process its header. Instead, the header is pad that needs
399 * to be filled with the first four bytes of the audio sample data sent as
400 * part of the preceding Wave Info PDU.
403 CopyMemory(Stream_Buffer(s), rdpsnd->waveData, 4);
405 data = Stream_Buffer(s);
406 size = Stream_Capacity(s);
408 wave = (RDPSND_WAVE*) malloc(sizeof(RDPSND_WAVE));
410 wave->wLocalTimeA = GetTickCount();
411 wave->wTimeStampA = rdpsnd->wTimeStamp;
412 wave->wFormatNo = rdpsnd->wCurrentFormatNo;
413 wave->cBlockNo = rdpsnd->cBlockNo;
418 format = &rdpsnd->ClientFormats[rdpsnd->wCurrentFormatNo];
419 wave->wAudioLength = rdpsnd_compute_audio_time_length(format, size);
427 if (rdpsnd->device->WaveDecode)
429 IFCALL(rdpsnd->device->WaveDecode, rdpsnd->device, wave);
432 if (rdpsnd->device->WavePlay)
434 IFCALL(rdpsnd->device->WavePlay, rdpsnd->device, wave);
438 IFCALL(rdpsnd->device->Play, rdpsnd->device, data, size);
441 if (!rdpsnd->device->WavePlay)
443 wave->wTimeStampB = rdpsnd->wTimeStamp + wave->wAudioLength + TIME_DELAY_MS;
444 wave->wLocalTimeB = wave->wLocalTimeA + wave->wAudioLength + TIME_DELAY_MS;
445 rdpsnd->device->WaveConfirm(rdpsnd->device, wave);
449 static void rdpsnd_recv_close_pdu(rdpsndPlugin* rdpsnd)
451 DEBUG_SVC("server closes.");
455 IFCALL(rdpsnd->device->Close, rdpsnd->device);
458 rdpsnd->isOpen = FALSE;
461 static void rdpsnd_recv_volume_pdu(rdpsndPlugin* rdpsnd, wStream* s)
465 Stream_Read_UINT32(s, dwVolume);
466 DEBUG_SVC("dwVolume 0x%X", dwVolume);
470 IFCALL(rdpsnd->device->SetVolume, rdpsnd->device, dwVolume);
474 static void rdpsnd_recv_pdu(rdpSvcPlugin* plugin, wStream* s)
478 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
480 if (rdpsnd->expectingWave)
482 rdpsnd_recv_wave_pdu(rdpsnd, s);
483 Stream_Free(s, TRUE);
487 Stream_Read_UINT8(s, msgType); /* msgType */
488 Stream_Seek_UINT8(s); /* bPad */
489 Stream_Read_UINT16(s, BodySize);
491 //fprintf(stderr, "msgType %d BodySize %d\n", msgType, BodySize);
496 rdpsnd_recv_server_audio_formats_pdu(rdpsnd, s);
500 rdpsnd_recv_training_pdu(rdpsnd, s);
504 rdpsnd_recv_wave_info_pdu(rdpsnd, s, BodySize);
508 rdpsnd_recv_close_pdu(rdpsnd);
512 rdpsnd_recv_volume_pdu(rdpsnd, s);
516 DEBUG_WARN("unknown msgType %d", msgType);
520 Stream_Free(s, TRUE);
523 static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlugin* device)
527 DEBUG_WARN("existing device, abort.");
531 rdpsnd->device = device;
532 device->rdpsnd = rdpsnd;
534 device->WaveConfirm = rdpsnd_device_send_wave_confirm_pdu;
537 static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, ADDIN_ARGV* args)
539 PFREERDP_RDPSND_DEVICE_ENTRY entry;
540 FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
542 entry = (PFREERDP_RDPSND_DEVICE_ENTRY) freerdp_load_channel_addin_entry("rdpsnd", (LPSTR) name, NULL, 0);
547 entryPoints.rdpsnd = rdpsnd;
548 entryPoints.pRegisterRdpsndDevice = rdpsnd_register_device_plugin;
549 entryPoints.args = args;
551 if (entry(&entryPoints) != 0)
553 DEBUG_WARN("%s entry returns error.", name);
560 void rdpsnd_set_subsystem(rdpsndPlugin* rdpsnd, char* subsystem)
562 if (rdpsnd->subsystem)
563 free(rdpsnd->subsystem);
565 rdpsnd->subsystem = _strdup(subsystem);
568 void rdpsnd_set_device_name(rdpsndPlugin* rdpsnd, char* device_name)
570 if (rdpsnd->device_name)
571 free(rdpsnd->device_name);
573 rdpsnd->device_name = _strdup(device_name);
576 COMMAND_LINE_ARGUMENT_A rdpsnd_args[] =
578 { "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
579 { "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
580 { "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
581 { "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
582 { "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
583 { "latency", COMMAND_LINE_VALUE_REQUIRED, "<latency>", NULL, NULL, -1, NULL, "latency" },
584 { NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
587 static void rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args)
591 COMMAND_LINE_ARGUMENT_A* arg;
593 flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
595 status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
596 rdpsnd_args, flags, rdpsnd, NULL, NULL);
602 if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
605 CommandLineSwitchStart(arg)
607 CommandLineSwitchCase(arg, "sys")
609 rdpsnd_set_subsystem(rdpsnd, arg->Value);
611 CommandLineSwitchCase(arg, "dev")
613 rdpsnd_set_device_name(rdpsnd, arg->Value);
615 CommandLineSwitchCase(arg, "format")
617 rdpsnd->fixedFormat = atoi(arg->Value);
619 CommandLineSwitchCase(arg, "rate")
621 rdpsnd->fixedRate = atoi(arg->Value);
623 CommandLineSwitchCase(arg, "channel")
625 rdpsnd->fixedChannel = atoi(arg->Value);
627 CommandLineSwitchCase(arg, "latency")
629 rdpsnd->latency = atoi(arg->Value);
631 CommandLineSwitchDefault(arg)
636 CommandLineSwitchEnd(arg)
638 while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
641 static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
644 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
646 DEBUG_SVC("connecting");
648 rdpsnd->latency = -1;
649 rdpsnd->queue = MessageQueue_New();
650 rdpsnd->thread = CreateThread(NULL, 0,
651 (LPTHREAD_START_ROUTINE) rdpsnd_schedule_thread,
652 (void*) plugin, 0, NULL);
654 args = (ADDIN_ARGV*) plugin->channel_entry_points.pExtendedData;
657 rdpsnd_process_addin_args(rdpsnd, args);
659 if (rdpsnd->subsystem)
661 if (strcmp(rdpsnd->subsystem, "fake") == 0)
664 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
667 #if defined(WITH_IOSAUDIO)
670 rdpsnd_set_subsystem(rdpsnd, "ios");
671 rdpsnd_set_device_name(rdpsnd, "");
672 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
676 #if defined(WITH_OPENSLES)
679 rdpsnd_set_subsystem(rdpsnd, "opensles");
680 rdpsnd_set_device_name(rdpsnd, "");
681 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
685 #if defined(WITH_PULSE)
688 rdpsnd_set_subsystem(rdpsnd, "pulse");
689 rdpsnd_set_device_name(rdpsnd, "");
690 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
694 #if defined(WITH_ALSA)
697 rdpsnd_set_subsystem(rdpsnd, "alsa");
698 rdpsnd_set_device_name(rdpsnd, "default");
699 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
703 #if defined(WITH_MACAUDIO)
706 rdpsnd_set_subsystem(rdpsnd, "macaudio");
707 rdpsnd_set_device_name(rdpsnd, "default");
708 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
712 #if defined(WITH_WINMM)
715 rdpsnd_set_subsystem(rdpsnd, "winmm");
716 rdpsnd_set_device_name(rdpsnd, "");
717 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
723 DEBUG_WARN("no sound device.");
728 static void rdpsnd_process_event(rdpSvcPlugin* plugin, wMessage* event)
730 freerdp_event_free(event);
733 static void rdpsnd_process_terminate(rdpSvcPlugin* plugin)
735 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
738 IFCALL(rdpsnd->device->Free, rdpsnd->device);
740 MessageQueue_PostQuit(rdpsnd->queue, 0);
741 WaitForSingleObject(rdpsnd->thread, INFINITE);
743 MessageQueue_Free(rdpsnd->queue);
744 CloseHandle(rdpsnd->thread);
746 if (rdpsnd->subsystem)
747 free(rdpsnd->subsystem);
749 if (rdpsnd->device_name)
750 free(rdpsnd->device_name);
752 rdpsnd_free_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
753 rdpsnd->NumberOfServerFormats = 0;
754 rdpsnd->ServerFormats = NULL;
756 rdpsnd_free_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
757 rdpsnd->NumberOfClientFormats = 0;
758 rdpsnd->ClientFormats = NULL;
761 /* rdpsnd is always built-in */
762 #define VirtualChannelEntry rdpsnd_VirtualChannelEntry
764 int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
768 _p = (rdpsndPlugin*) malloc(sizeof(rdpsndPlugin));
769 ZeroMemory(_p, sizeof(rdpsndPlugin));
771 _p->plugin.channel_def.options =
772 CHANNEL_OPTION_INITIALIZED |
773 CHANNEL_OPTION_ENCRYPT_RDP;
775 strcpy(_p->plugin.channel_def.name, "rdpsnd");
777 _p->plugin.connect_callback = rdpsnd_process_connect;
778 _p->plugin.receive_callback = rdpsnd_recv_pdu;
779 _p->plugin.event_callback = rdpsnd_process_event;
780 _p->plugin.terminate_callback = rdpsnd_process_terminate;
782 #if !defined(_WIN32) && !defined(ANDROID)
786 sigaddset(&mask, SIGIO);
787 pthread_sigmask(SIG_BLOCK, &mask, NULL);
791 svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);