21 #include <freerdp/config.h>
27 #include <winpr/crt.h>
28 #include <winpr/stream.h>
29 #include <winpr/cmdline.h>
31 #include <freerdp/types.h>
32 #include <freerdp/settings.h>
34 #include "rdpsnd_main.h"
38 rdpsndDevicePlugin device;
41 static BOOL rdpsnd_fake_open(rdpsndDevicePlugin* device,
const AUDIO_FORMAT* format, UINT32 latency)
46 static void rdpsnd_fake_close(rdpsndDevicePlugin* device)
50 static BOOL rdpsnd_fake_set_volume(rdpsndDevicePlugin* device, UINT32 value)
55 static void rdpsnd_fake_free(rdpsndDevicePlugin* device)
57 rdpsndFakePlugin* fake = (rdpsndFakePlugin*)device;
65 static BOOL rdpsnd_fake_format_supported(rdpsndDevicePlugin* device,
const AUDIO_FORMAT* format)
70 static UINT rdpsnd_fake_play(rdpsndDevicePlugin* device,
const BYTE* data,
size_t size)
80 static UINT rdpsnd_fake_parse_addin_args(rdpsndFakePlugin* fake,
const ADDIN_ARGV* args)
87 COMMAND_LINE_SIGIL_NONE | COMMAND_LINE_SEPARATOR_COLON | COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
88 status = CommandLineParseArgumentsA(args->argc, args->argv, rdpsnd_fake_args, flags, fake, NULL,
92 return ERROR_INVALID_DATA;
94 arg = rdpsnd_fake_args;
98 if (!(arg->Flags & COMMAND_LINE_VALUE_PRESENT))
101 CommandLineSwitchStart(arg) CommandLineSwitchEnd(arg)
102 }
while ((arg = CommandLineFindNextArgumentA(arg)) != NULL);
104 return CHANNEL_RC_OK;
112 FREERDP_ENTRY_POINT(UINT VCAPITYPE fake_freerdp_rdpsnd_client_subsystem_entry(
116 rdpsndFakePlugin* fake = NULL;
117 UINT ret = CHANNEL_RC_OK;
118 fake = (rdpsndFakePlugin*)calloc(1,
sizeof(rdpsndFakePlugin));
121 return CHANNEL_RC_NO_MEMORY;
123 fake->device.Open = rdpsnd_fake_open;
124 fake->device.FormatSupported = rdpsnd_fake_format_supported;
125 fake->device.SetVolume = rdpsnd_fake_set_volume;
126 fake->device.Play = rdpsnd_fake_play;
127 fake->device.Close = rdpsnd_fake_close;
128 fake->device.Free = rdpsnd_fake_free;
129 args = pEntryPoints->args;
133 ret = rdpsnd_fake_parse_addin_args(fake, args);
135 if (ret != CHANNEL_RC_OK)
137 WLog_ERR(TAG,
"error parsing arguments");
142 pEntryPoints->pRegisterRdpsndDevice(pEntryPoints->rdpsnd, &fake->device);
145 rdpsnd_fake_free(&fake->device);