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 static 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);
120 message.wParam = NULL;
126 void rdpsnd_send_quality_mode_pdu(rdpsndPlugin* rdpsnd)
130 pdu = Stream_New(NULL, 8);
131 Stream_Write_UINT8(pdu, SNDC_QUALITYMODE); /* msgType */
132 Stream_Write_UINT8(pdu, 0); /* bPad */
133 Stream_Write_UINT16(pdu, 4); /* BodySize */
134 Stream_Write_UINT16(pdu, HIGH_QUALITY); /* wQualityMode */
135 Stream_Write_UINT16(pdu, 0); /* Reserved */
137 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
140 void rdpsnd_select_supported_audio_formats(rdpsndPlugin* rdpsnd)
143 AUDIO_FORMAT* serverFormat;
144 AUDIO_FORMAT* clientFormat;
146 rdpsnd_free_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
147 rdpsnd->NumberOfClientFormats = 0;
148 rdpsnd->ClientFormats = NULL;
150 if (!rdpsnd->NumberOfServerFormats)
153 rdpsnd->ClientFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) * rdpsnd->NumberOfServerFormats);
154 for (index = 0; index < (int) rdpsnd->NumberOfServerFormats; index++)
156 serverFormat = &rdpsnd->ServerFormats[index];
158 if (rdpsnd->fixedFormat > 0 && (rdpsnd->fixedFormat != serverFormat->wFormatTag))
161 if (rdpsnd->fixedChannel > 0 && (rdpsnd->fixedChannel != serverFormat->nChannels))
164 if (rdpsnd->fixedRate > 0 && (rdpsnd->fixedRate != serverFormat->nSamplesPerSec))
167 if (rdpsnd->device && rdpsnd->device->FormatSupported(rdpsnd->device, serverFormat))
169 clientFormat = &rdpsnd->ClientFormats[rdpsnd->NumberOfClientFormats++];
171 CopyMemory(clientFormat, serverFormat, sizeof(AUDIO_FORMAT));
172 clientFormat->cbSize = 0;
174 if (serverFormat->cbSize > 0)
176 clientFormat->data = (BYTE*) malloc(serverFormat->cbSize);
177 CopyMemory(clientFormat->data, serverFormat->data, serverFormat->cbSize);
178 clientFormat->cbSize = serverFormat->cbSize;
184 fprintf(stderr, "Server ");
185 rdpsnd_print_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
186 fprintf(stderr, "\n");
188 fprintf(stderr, "Client ");
189 rdpsnd_print_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
190 fprintf(stderr, "\n");
194 void rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
201 UINT16 dwVolumeRight;
202 UINT16 wNumberOfFormats;
203 AUDIO_FORMAT* clientFormat;
205 dwVolumeLeft = ((50 * 0xFFFF) / 100); /* 50% */
206 dwVolumeRight = ((50 * 0xFFFF) / 100); /* 50% */
207 dwVolume = (dwVolumeLeft << 16) | dwVolumeRight;
211 if (rdpsnd->device->GetVolume)
212 dwVolume = rdpsnd->device->GetVolume(rdpsnd->device);
215 wNumberOfFormats = rdpsnd->NumberOfClientFormats;
219 for (index = 0; index < (int) wNumberOfFormats; index++)
220 length += (18 + rdpsnd->ClientFormats[index].cbSize);
222 pdu = Stream_New(NULL, length);
224 Stream_Write_UINT8(pdu, SNDC_FORMATS); /* msgType */
225 Stream_Write_UINT8(pdu, 0); /* bPad */
226 Stream_Write_UINT16(pdu, length - 4); /* BodySize */
228 Stream_Write_UINT32(pdu, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */
229 Stream_Write_UINT32(pdu, dwVolume); /* dwVolume */
230 Stream_Write_UINT32(pdu, 0); /* dwPitch */
231 Stream_Write_UINT16(pdu, 0); /* wDGramPort */
232 Stream_Write_UINT16(pdu, wNumberOfFormats); /* wNumberOfFormats */
233 Stream_Write_UINT8(pdu, 0); /* cLastBlockConfirmed */
234 Stream_Write_UINT16(pdu, 6); /* wVersion */
235 Stream_Write_UINT8(pdu, 0); /* bPad */
237 for (index = 0; index < (int) wNumberOfFormats; index++)
239 clientFormat = &rdpsnd->ClientFormats[index];
241 Stream_Write_UINT16(pdu, clientFormat->wFormatTag);
242 Stream_Write_UINT16(pdu, clientFormat->nChannels);
243 Stream_Write_UINT32(pdu, clientFormat->nSamplesPerSec);
244 Stream_Write_UINT32(pdu, clientFormat->nAvgBytesPerSec);
245 Stream_Write_UINT16(pdu, clientFormat->nBlockAlign);
246 Stream_Write_UINT16(pdu, clientFormat->wBitsPerSample);
247 Stream_Write_UINT16(pdu, clientFormat->cbSize);
249 if (clientFormat->cbSize > 0)
250 Stream_Write(pdu, clientFormat->data, clientFormat->cbSize);
253 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
256 void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream* s)
260 AUDIO_FORMAT* format;
261 UINT16 wNumberOfFormats;
264 rdpsnd_free_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
265 rdpsnd->NumberOfServerFormats = 0;
266 rdpsnd->ServerFormats = NULL;
268 Stream_Seek_UINT32(s); /* dwFlags */
269 Stream_Read_UINT32(s, dwVolume); /* dwVolume */
270 Stream_Seek_UINT32(s); /* dwPitch */
271 Stream_Seek_UINT16(s); /* wDGramPort */
272 Stream_Read_UINT16(s, wNumberOfFormats);
273 Stream_Read_UINT8(s, rdpsnd->cBlockNo); /* cLastBlockConfirmed */
274 Stream_Read_UINT16(s, wVersion); /* wVersion */
275 Stream_Seek_UINT8(s); /* bPad */
277 rdpsnd->NumberOfServerFormats = wNumberOfFormats;
278 rdpsnd->ServerFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) * wNumberOfFormats);
280 for (index = 0; index < (int) wNumberOfFormats; index++)
282 format = &rdpsnd->ServerFormats[index];
284 Stream_Read_UINT16(s, format->wFormatTag); /* wFormatTag */
285 Stream_Read_UINT16(s, format->nChannels); /* nChannels */
286 Stream_Read_UINT32(s, format->nSamplesPerSec); /* nSamplesPerSec */
287 Stream_Read_UINT32(s, format->nAvgBytesPerSec); /* nAvgBytesPerSec */
288 Stream_Read_UINT16(s, format->nBlockAlign); /* nBlockAlign */
289 Stream_Read_UINT16(s, format->wBitsPerSample); /* wBitsPerSample */
290 Stream_Read_UINT16(s, format->cbSize); /* cbSize */
292 format->data = (BYTE*) malloc(format->cbSize);
293 Stream_Read(s, format->data, format->cbSize);
296 rdpsnd_select_supported_audio_formats(rdpsnd);
298 rdpsnd_send_client_audio_formats(rdpsnd);
301 rdpsnd_send_quality_mode_pdu(rdpsnd);
304 IFCALL(rdpsnd->device->SetVolume, rdpsnd->device, dwVolume);
307 void rdpsnd_send_training_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, UINT16 wPackSize)
311 pdu = Stream_New(NULL, 8);
312 Stream_Write_UINT8(pdu, SNDC_TRAINING); /* msgType */
313 Stream_Write_UINT8(pdu, 0); /* bPad */
314 Stream_Write_UINT16(pdu, 4); /* BodySize */
315 Stream_Write_UINT16(pdu, wTimeStamp);
316 Stream_Write_UINT16(pdu, wPackSize);
318 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
321 static void rdpsnd_recv_training_pdu(rdpsndPlugin* rdpsnd, wStream* s)
326 Stream_Read_UINT16(s, wTimeStamp);
327 Stream_Read_UINT16(s, wPackSize);
329 rdpsnd_send_training_confirm_pdu(rdpsnd, wTimeStamp, wPackSize);
332 static void rdpsnd_recv_wave_info_pdu(rdpsndPlugin* rdpsnd, wStream* s, UINT16 BodySize)
335 AUDIO_FORMAT* format;
337 rdpsnd->expectingWave = TRUE;
339 Stream_Read_UINT16(s, rdpsnd->wTimeStamp);
340 Stream_Read_UINT16(s, wFormatNo);
341 Stream_Read_UINT8(s, rdpsnd->cBlockNo);
342 Stream_Seek(s, 3); /* bPad */
343 Stream_Read(s, rdpsnd->waveData, 4);
345 rdpsnd->waveDataSize = BodySize - 8;
347 format = &rdpsnd->ClientFormats[wFormatNo];
351 rdpsnd->isOpen = TRUE;
352 rdpsnd->wCurrentFormatNo = wFormatNo;
354 //rdpsnd_print_audio_format(format);
358 IFCALL(rdpsnd->device->Open, rdpsnd->device, format, rdpsnd->latency);
361 else if (wFormatNo != rdpsnd->wCurrentFormatNo)
363 rdpsnd->wCurrentFormatNo = wFormatNo;
367 IFCALL(rdpsnd->device->SetFormat, rdpsnd->device, format, rdpsnd->latency);
372 void rdpsnd_send_wave_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, BYTE cConfirmedBlockNo)
376 pdu = Stream_New(NULL, 8);
377 Stream_Write_UINT8(pdu, SNDC_WAVECONFIRM);
378 Stream_Write_UINT8(pdu, 0);
379 Stream_Write_UINT16(pdu, 4);
380 Stream_Write_UINT16(pdu, wTimeStamp);
381 Stream_Write_UINT8(pdu, cConfirmedBlockNo); /* cConfirmedBlockNo */
382 Stream_Write_UINT8(pdu, 0); /* bPad */
384 svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
387 static void rdpsnd_device_send_wave_confirm_pdu(rdpsndDevicePlugin* device, RDPSND_WAVE* wave)
389 MessageQueue_Post(device->rdpsnd->queue, NULL, 0, (void*) wave, NULL);
392 static void rdpsnd_recv_wave_pdu(rdpsndPlugin* rdpsnd, wStream* s)
397 AUDIO_FORMAT* format;
399 rdpsnd->expectingWave = FALSE;
402 * The Wave PDU is a special case: it is always sent after a Wave Info PDU,
403 * and we do not process its header. Instead, the header is pad that needs
404 * to be filled with the first four bytes of the audio sample data sent as
405 * part of the preceding Wave Info PDU.
408 CopyMemory(Stream_Buffer(s), rdpsnd->waveData, 4);
410 data = Stream_Buffer(s);
411 size = Stream_Capacity(s);
413 wave = (RDPSND_WAVE*) malloc(sizeof(RDPSND_WAVE));
415 wave->wLocalTimeA = GetTickCount();
416 wave->wTimeStampA = rdpsnd->wTimeStamp;
417 wave->wFormatNo = rdpsnd->wCurrentFormatNo;
418 wave->cBlockNo = rdpsnd->cBlockNo;
423 format = &rdpsnd->ClientFormats[rdpsnd->wCurrentFormatNo];
424 wave->wAudioLength = rdpsnd_compute_audio_time_length(format, size);
432 if (rdpsnd->device->WaveDecode)
434 IFCALL(rdpsnd->device->WaveDecode, rdpsnd->device, wave);
437 if (rdpsnd->device->WavePlay)
439 IFCALL(rdpsnd->device->WavePlay, rdpsnd->device, wave);
443 IFCALL(rdpsnd->device->Play, rdpsnd->device, data, size);
446 if (!rdpsnd->device->WavePlay)
448 wave->wTimeStampB = rdpsnd->wTimeStamp + wave->wAudioLength + TIME_DELAY_MS;
449 wave->wLocalTimeB = wave->wLocalTimeA + wave->wAudioLength + TIME_DELAY_MS;
451 rdpsnd->device->WaveConfirm(rdpsnd->device, wave);
454 static void rdpsnd_recv_close_pdu(rdpsndPlugin* rdpsnd)
456 DEBUG_SVC("server closes.");
460 IFCALL(rdpsnd->device->Close, rdpsnd->device);
463 rdpsnd->isOpen = FALSE;
466 static void rdpsnd_recv_volume_pdu(rdpsndPlugin* rdpsnd, wStream* s)
470 Stream_Read_UINT32(s, dwVolume);
471 DEBUG_SVC("dwVolume 0x%X", dwVolume);
475 IFCALL(rdpsnd->device->SetVolume, rdpsnd->device, dwVolume);
479 static void rdpsnd_recv_pdu(rdpSvcPlugin* plugin, wStream* s)
483 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
485 if (rdpsnd->expectingWave)
487 rdpsnd_recv_wave_pdu(rdpsnd, s);
488 Stream_Free(s, TRUE);
492 Stream_Read_UINT8(s, msgType); /* msgType */
493 Stream_Seek_UINT8(s); /* bPad */
494 Stream_Read_UINT16(s, BodySize);
496 //fprintf(stderr, "msgType %d BodySize %d\n", msgType, BodySize);
501 rdpsnd_recv_server_audio_formats_pdu(rdpsnd, s);
505 rdpsnd_recv_training_pdu(rdpsnd, s);
509 rdpsnd_recv_wave_info_pdu(rdpsnd, s, BodySize);
513 rdpsnd_recv_close_pdu(rdpsnd);
517 rdpsnd_recv_volume_pdu(rdpsnd, s);
521 DEBUG_WARN("unknown msgType %d", msgType);
525 Stream_Free(s, TRUE);
528 static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlugin* device)
532 DEBUG_WARN("existing device, abort.");
536 rdpsnd->device = device;
537 device->rdpsnd = rdpsnd;
539 device->WaveConfirm = rdpsnd_device_send_wave_confirm_pdu;
542 static BOOL rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, ADDIN_ARGV* args)
544 PFREERDP_RDPSND_DEVICE_ENTRY entry;
545 FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
547 entry = (PFREERDP_RDPSND_DEVICE_ENTRY) freerdp_load_channel_addin_entry("rdpsnd", (LPSTR) name, NULL, 0);
552 entryPoints.rdpsnd = rdpsnd;
553 entryPoints.pRegisterRdpsndDevice = rdpsnd_register_device_plugin;
554 entryPoints.args = args;
556 if (entry(&entryPoints) != 0)
558 DEBUG_WARN("%s entry returns error.", name);
565 void rdpsnd_set_subsystem(rdpsndPlugin* rdpsnd, char* subsystem)
567 if (rdpsnd->subsystem)
568 free(rdpsnd->subsystem);
570 rdpsnd->subsystem = _strdup(subsystem);
573 void rdpsnd_set_device_name(rdpsndPlugin* rdpsnd, char* device_name)
575 if (rdpsnd->device_name)
576 free(rdpsnd->device_name);
578 rdpsnd->device_name = _strdup(device_name);
581 COMMAND_LINE_ARGUMENT_A rdpsnd_args[] =
583 { "sys", COMMAND_LINE_VALUE_REQUIRED, "<subsystem>", NULL, NULL, -1, NULL, "subsystem" },
584 { "dev", COMMAND_LINE_VALUE_REQUIRED, "<device>", NULL, NULL, -1, NULL, "device" },
585 { "format", COMMAND_LINE_VALUE_REQUIRED, "<format>", NULL, NULL, -1, NULL, "format" },
586 { "rate", COMMAND_LINE_VALUE_REQUIRED, "<rate>", NULL, NULL, -1, NULL, "rate" },
587 { "channel", COMMAND_LINE_VALUE_REQUIRED, "<channel>", NULL, NULL, -1, NULL, "channel" },
588 { "latency", COMMAND_LINE_VALUE_REQUIRED, "<latency>", NULL, NULL, -1, NULL, "latency" },
589 { NULL, 0, NULL, NULL, NULL, -1, NULL, NULL }
592 static void rdpsnd_process_addin_args(rdpsndPlugin* rdpsnd, ADDIN_ARGV* args)
596 COMMAND_LINE_ARGUMENT_A* arg;
598 flags = COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON;
600 status = CommandLineParseArgumentsA(args->argc, (const char**) args->argv,
601 rdpsnd_args, flags, rdpsnd, NULL, NULL);
609 if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
612 CommandLineSwitchStart(arg)
614 CommandLineSwitchCase(arg, "sys")
616 rdpsnd_set_subsystem(rdpsnd, arg->Value);
618 CommandLineSwitchCase(arg, "dev")
620 rdpsnd_set_device_name(rdpsnd, arg->Value);
622 CommandLineSwitchCase(arg, "format")
624 rdpsnd->fixedFormat = atoi(arg->Value);
626 CommandLineSwitchCase(arg, "rate")
628 rdpsnd->fixedRate = atoi(arg->Value);
630 CommandLineSwitchCase(arg, "channel")
632 rdpsnd->fixedChannel = atoi(arg->Value);
634 CommandLineSwitchCase(arg, "latency")
636 rdpsnd->latency = atoi(arg->Value);
638 CommandLineSwitchDefault(arg)
643 CommandLineSwitchEnd(arg)
645 while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
648 static void rdpsnd_process_connect(rdpSvcPlugin* plugin)
651 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
653 DEBUG_SVC("connecting");
655 rdpsnd->latency = -1;
656 rdpsnd->queue = MessageQueue_New();
657 rdpsnd->thread = CreateThread(NULL, 0,
658 (LPTHREAD_START_ROUTINE) rdpsnd_schedule_thread,
659 (void*) plugin, 0, NULL);
661 args = (ADDIN_ARGV*) plugin->channel_entry_points.pExtendedData;
664 rdpsnd_process_addin_args(rdpsnd, args);
666 if (rdpsnd->subsystem)
668 if (strcmp(rdpsnd->subsystem, "fake") == 0)
671 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
674 #if defined(WITH_IOSAUDIO)
677 rdpsnd_set_subsystem(rdpsnd, "ios");
678 rdpsnd_set_device_name(rdpsnd, "");
679 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
683 #if defined(WITH_OPENSLES)
686 rdpsnd_set_subsystem(rdpsnd, "opensles");
687 rdpsnd_set_device_name(rdpsnd, "");
688 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
692 #if defined(WITH_PULSE)
695 rdpsnd_set_subsystem(rdpsnd, "pulse");
696 rdpsnd_set_device_name(rdpsnd, "");
697 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
701 #if defined(WITH_ALSA)
704 rdpsnd_set_subsystem(rdpsnd, "alsa");
705 rdpsnd_set_device_name(rdpsnd, "default");
706 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
710 #if defined(WITH_MACAUDIO)
713 rdpsnd_set_subsystem(rdpsnd, "macaudio");
714 rdpsnd_set_device_name(rdpsnd, "default");
715 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
719 #if defined(WITH_WINMM)
722 rdpsnd_set_subsystem(rdpsnd, "winmm");
723 rdpsnd_set_device_name(rdpsnd, "");
724 rdpsnd_load_device_plugin(rdpsnd, rdpsnd->subsystem, args);
730 DEBUG_WARN("no sound device.");
735 static void rdpsnd_process_event(rdpSvcPlugin* plugin, wMessage* event)
737 freerdp_event_free(event);
740 static void rdpsnd_process_terminate(rdpSvcPlugin* plugin)
742 rdpsndPlugin* rdpsnd = (rdpsndPlugin*) plugin;
745 IFCALL(rdpsnd->device->Free, rdpsnd->device);
747 MessageQueue_PostQuit(rdpsnd->queue, 0);
748 WaitForSingleObject(rdpsnd->thread, INFINITE);
750 MessageQueue_Free(rdpsnd->queue);
751 CloseHandle(rdpsnd->thread);
753 if (rdpsnd->subsystem)
754 free(rdpsnd->subsystem);
756 if (rdpsnd->device_name)
757 free(rdpsnd->device_name);
759 rdpsnd_free_audio_formats(rdpsnd->ServerFormats, rdpsnd->NumberOfServerFormats);
760 rdpsnd->NumberOfServerFormats = 0;
761 rdpsnd->ServerFormats = NULL;
763 rdpsnd_free_audio_formats(rdpsnd->ClientFormats, rdpsnd->NumberOfClientFormats);
764 rdpsnd->NumberOfClientFormats = 0;
765 rdpsnd->ClientFormats = NULL;
768 /* rdpsnd is always built-in */
769 #define VirtualChannelEntry rdpsnd_VirtualChannelEntry
771 int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
775 _p = (rdpsndPlugin*) malloc(sizeof(rdpsndPlugin));
776 ZeroMemory(_p, sizeof(rdpsndPlugin));
778 _p->plugin.channel_def.options =
779 CHANNEL_OPTION_INITIALIZED |
780 CHANNEL_OPTION_ENCRYPT_RDP;
782 strcpy(_p->plugin.channel_def.name, "rdpsnd");
784 _p->plugin.connect_callback = rdpsnd_process_connect;
785 _p->plugin.receive_callback = rdpsnd_recv_pdu;
786 _p->plugin.event_callback = rdpsnd_process_event;
787 _p->plugin.terminate_callback = rdpsnd_process_terminate;
789 #if !defined(_WIN32) && !defined(ANDROID)
793 sigaddset(&mask, SIGIO);
794 pthread_sigmask(SIG_BLOCK, &mask, NULL);
798 svc_plugin_init((rdpSvcPlugin*) _p, pEntryPoints);