1 /*****************************************************************************
2 * wasapi.c : Windows Audio Session API output plugin for VLC
3 *****************************************************************************
4 * Copyright (C) 2012 RĂ©mi Denis-Courmont
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
31 #include <audioclient.h>
32 #include <audiopolicy.h>
33 #include <mmdeviceapi.h>
35 #include <vlc_common.h>
36 #include <vlc_plugin.h>
38 #include <vlc_charset.h>
40 DEFINE_GUID (GUID_VLC_AUD_OUT, 0x4533f59d, 0x59ee, 0x00c6,
41 0xad, 0xb2, 0xc6, 0x8b, 0x50, 0x1a, 0x66, 0x55);
43 DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd,
44 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);
46 static int Open(vlc_object_t *);
47 static void Close(vlc_object_t *);
50 set_shortname("WASAPI")
51 set_description(N_("Windows Audio Session output") )
52 set_capability("audio output", 150)
53 set_category(CAT_AUDIO)
54 set_subcategory(SUBCAT_AUDIO_AOUT)
55 add_shortcut("was", "audioclient")
56 set_callbacks(Open, Close)
59 static LARGE_INTEGER freq; /* performance counters frequency */
61 BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID); /* avoid warning */
63 BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved)
70 case DLL_PROCESS_ATTACH:
71 if (!QueryPerformanceFrequency(&freq))
78 static UINT64 GetQPC(void)
80 LARGE_INTEGER counter;
82 if (!QueryPerformanceCounter(&counter))
85 lldiv_t d = lldiv(counter.QuadPart, freq.QuadPart);
86 return (d.quot * 10000000) + ((d.rem * 10000000) / freq.QuadPart);
89 static int TryEnter(vlc_object_t *obj)
91 HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
92 if (unlikely(FAILED(hr)))
94 msg_Err (obj, "cannot initialize COM (error 0x%lx)", hr);
99 #define TryEnter(o) TryEnter(VLC_OBJECT(o))
101 static void Enter(void)
103 HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
104 if (unlikely(FAILED(hr)))
108 static void Leave(void)
115 audio_output_t *aout;
116 IMMDeviceEnumerator *it;
117 IAudioClient *client;
118 IAudioRenderClient *render;
121 IAudioSessionControl *control;
122 struct IAudioSessionEvents events;
125 uint8_t chans_table[AOUT_CHAN_MAX];
126 uint8_t chans_to_reorder;
127 uint8_t bits; /**< Bits per sample */
128 unsigned rate; /**< Sample rate */
129 unsigned bytes_per_frame;
130 UINT32 frames; /**< Total buffer size (frames) */
132 HANDLE ready; /**< Semaphore from MTA thread */
133 HANDLE done; /**< Semaphore to MTA thread */
137 /*** VLC audio output callbacks ***/
138 static int TimeGet(audio_output_t *aout, mtime_t *restrict pts)
140 aout_sys_t *sys = aout->sys;
144 if (sys->clock == NULL)
148 hr = IAudioClock_GetPosition(sys->clock, &pos, &qpcpos);
152 msg_Err(aout, "cannot get position (error 0x%lx)", hr);
158 msg_Dbg(aout, "cannot compute position: still propagating buffers");
162 mtime_t delay = ((GetQPC() - qpcpos) / (10000000 / CLOCK_FREQ));
163 static_assert((10000000 % CLOCK_FREQ) == 0, "Frequency conversion broken");
165 *pts = mdate() + delay;
169 static void Play(audio_output_t *aout, block_t *block)
171 aout_sys_t *sys = aout->sys;
174 if (sys->chans_to_reorder)
175 aout_ChannelReorder(block->p_buffer, block->i_buffer,
176 sys->chans_to_reorder, sys->chans_table, sys->bits);
182 hr = IAudioClient_GetCurrentPadding(sys->client, &frames);
185 msg_Err(aout, "cannot get current padding (error 0x%lx)", hr);
189 assert(frames <= sys->frames);
190 frames = sys->frames - frames;
191 if (frames > block->i_nb_samples)
192 frames = block->i_nb_samples;
195 hr = IAudioRenderClient_GetBuffer(sys->render, frames, &dst);
198 msg_Err(aout, "cannot get buffer (error 0x%lx)", hr);
202 const size_t copy = frames * sys->bytes_per_frame;
204 memcpy(dst, block->p_buffer, copy);
205 hr = IAudioRenderClient_ReleaseBuffer(sys->render, frames, 0);
208 msg_Err(aout, "cannot release buffer (error 0x%lx)", hr);
211 IAudioClient_Start(sys->client);
213 block->p_buffer += copy;
214 block->i_buffer -= copy;
215 block->i_nb_samples -= frames;
216 if (block->i_nb_samples == 0)
219 /* Out of buffer space, sleep */
220 msleep(AOUT_MIN_PREPARE_TIME
221 + block->i_nb_samples * CLOCK_FREQ / sys->rate);
225 block_Release(block);
227 /* Restart on unplug */
228 if (unlikely(hr == AUDCLNT_E_DEVICE_INVALIDATED))
229 var_TriggerCallback(aout, "audio-device");
232 static void Pause(audio_output_t *aout, bool paused, mtime_t date)
234 aout_sys_t *sys = aout->sys;
239 hr = IAudioClient_Stop(sys->client);
241 hr = IAudioClient_Start(sys->client);
243 msg_Warn(aout, "cannot %s stream (error 0x%lx)",
244 paused ? "stop" : "start", hr);
249 static void Flush(audio_output_t *aout, bool wait)
251 aout_sys_t *sys = aout->sys;
255 return; /* Drain not implemented */
258 IAudioClient_Stop(sys->client);
259 hr = IAudioClient_Reset(sys->client);
261 msg_Warn(aout, "cannot reset stream (error 0x%lx)", hr);
265 static int SimpleVolumeSet(audio_output_t *aout, float vol)
267 ISimpleAudioVolume *simple;
272 hr = IAudioClient_GetService(aout->sys->client, &IID_ISimpleAudioVolume,
276 hr = ISimpleAudioVolume_SetMasterVolume(simple, vol, NULL);
277 ISimpleAudioVolume_Release(simple);
283 msg_Err(aout, "cannot set volume (error 0x%lx)", hr);
289 static int SimpleMuteSet(audio_output_t *aout, bool mute)
291 ISimpleAudioVolume *simple;
296 hr = IAudioClient_GetService(aout->sys->client, &IID_ISimpleAudioVolume,
300 hr = ISimpleAudioVolume_SetMute(simple, mute, NULL);
301 ISimpleAudioVolume_Release(simple);
307 msg_Err(aout, "cannot set mute (error 0x%lx)", hr);
314 /*** Audio devices ***/
315 static int DeviceChanged(vlc_object_t *obj, const char *varname,
316 vlc_value_t prev, vlc_value_t cur, void *data)
318 aout_ChannelsRestart(obj, varname, prev, cur, data);
320 if (!var_Type (obj, "wasapi-audio-device"))
321 var_Create (obj, "wasapi-audio-device", VLC_VAR_STRING);
322 var_SetString (obj, "wasapi-audio-device", cur.psz_string);
326 static void GetDevices(vlc_object_t *obj, IMMDeviceEnumerator *it)
329 vlc_value_t val, text;
331 var_Create (obj, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE);
332 text.psz_string = _("Audio Device");
333 var_Change (obj, "audio-device", VLC_VAR_SETTEXT, &text, NULL);
335 IMMDeviceCollection *devs;
336 hr = IMMDeviceEnumerator_EnumAudioEndpoints(it, eRender,
337 DEVICE_STATE_ACTIVE, &devs);
340 msg_Warn (obj, "cannot enumerate audio endpoints (error 0x%lx)", hr);
345 hr = IMMDeviceCollection_GetCount(devs, &n);
348 msg_Warn (obj, "cannot count audio endpoints (error 0x%lx)", hr);
352 msg_Dbg(obj, "Available Windows Audio devices:");
358 hr = IMMDeviceCollection_Item(devs, --n, &dev);
362 /* Unique device ID */
364 hr = IMMDevice_GetId(dev, &devid);
367 IMMDevice_Release(dev);
370 val.psz_string = FromWide(devid);
371 CoTaskMemFree(devid);
372 text.psz_string = val.psz_string;
374 /* User-readable device name */
375 IPropertyStore *props;
376 hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &props);
382 hr = IPropertyStore_GetValue(props, &PKEY_Device_FriendlyName, &v);
384 text.psz_string = FromWide(v.pwszVal);
385 PropVariantClear(&v);
386 IPropertyStore_Release(props);
388 IMMDevice_Release(dev);
390 msg_Dbg(obj, "%s (%s)", val.psz_string, text.psz_string);
391 var_Change(obj, "audio-device", VLC_VAR_ADDCHOICE, &val, &text);
392 if (likely(text.psz_string != val.psz_string))
393 free(text.psz_string);
394 free(val.psz_string);
396 IMMDeviceCollection_Release(devs);
400 /*** Audio session events ***/
401 static inline aout_sys_t *vlc_AudioSessionEvents_sys(IAudioSessionEvents *this)
403 return (aout_sys_t *)(((char *)this) - offsetof(aout_sys_t, events));
407 vlc_AudioSessionEvents_QueryInterface(IAudioSessionEvents *this, REFIID riid,
410 if (IsEqualIID(riid, &IID_IUnknown)
411 || IsEqualIID(riid, &IID_IAudioSessionEvents))
414 IUnknown_AddRef(this);
420 return E_NOINTERFACE;
424 static STDMETHODIMP_(ULONG)
425 vlc_AudioSessionEvents_AddRef(IAudioSessionEvents *this)
427 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
428 return InterlockedIncrement(&sys->refs);
431 static STDMETHODIMP_(ULONG)
432 vlc_AudioSessionEvents_Release(IAudioSessionEvents *this)
434 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
435 return InterlockedDecrement(&sys->refs);
439 vlc_AudioSessionEvents_OnDisplayNameChanged(IAudioSessionEvents *this,
440 LPCWSTR wname, LPCGUID ctx)
442 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
443 audio_output_t *aout = sys->aout;
445 msg_Dbg(aout, "display name changed: %ls", wname);
451 vlc_AudioSessionEvents_OnIconPathChanged(IAudioSessionEvents *this,
452 LPCWSTR wpath, LPCGUID ctx)
454 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
455 audio_output_t *aout = sys->aout;
457 msg_Dbg(aout, "icon path changed: %ls", wpath);
463 vlc_AudioSessionEvents_OnSimpleVolumeChanged(IAudioSessionEvents *this, float vol,
464 WINBOOL mute, LPCGUID ctx)
466 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
467 audio_output_t *aout = sys->aout;
469 msg_Dbg(aout, "simple volume changed: %f, muting %sabled", vol,
470 mute ? "en" : "dis");
471 aout_VolumeReport(aout, vol);
472 aout_MuteReport(aout, mute == TRUE);
478 vlc_AudioSessionEvents_OnChannelVolumeChanged(IAudioSessionEvents *this,
479 DWORD count, float *vols,
480 DWORD changed, LPCGUID ctx)
482 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
483 audio_output_t *aout = sys->aout;
485 msg_Dbg(aout, "channel volume %lu of %lu changed: %f", changed, count,
492 vlc_AudioSessionEvents_OnGroupingParamChanged(IAudioSessionEvents *this,
493 LPCGUID param, LPCGUID ctx)
496 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
497 audio_output_t *aout = sys->aout;
499 msg_Dbg(aout, "grouping parameter changed");
506 vlc_AudioSessionEvents_OnStateChanged(IAudioSessionEvents *this,
507 AudioSessionState state)
509 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
510 audio_output_t *aout = sys->aout;
512 msg_Dbg(aout, "state changed: %d", state);
517 vlc_AudioSessionEvents_OnSessionDisconnected(IAudioSessionEvents *this,
518 AudioSessionDisconnectReason reason)
520 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
521 audio_output_t *aout = sys->aout;
523 msg_Dbg(aout, "session disconnected: reason %d", reason);
527 static const struct IAudioSessionEventsVtbl vlc_AudioSessionEvents =
529 vlc_AudioSessionEvents_QueryInterface,
530 vlc_AudioSessionEvents_AddRef,
531 vlc_AudioSessionEvents_Release,
533 vlc_AudioSessionEvents_OnDisplayNameChanged,
534 vlc_AudioSessionEvents_OnIconPathChanged,
535 vlc_AudioSessionEvents_OnSimpleVolumeChanged,
536 vlc_AudioSessionEvents_OnChannelVolumeChanged,
537 vlc_AudioSessionEvents_OnGroupingParamChanged,
538 vlc_AudioSessionEvents_OnStateChanged,
539 vlc_AudioSessionEvents_OnSessionDisconnected,
543 /*** Initialization / deinitialization **/
544 static const uint32_t chans_out[] = {
545 SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
546 SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
547 SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
548 SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0
550 static const uint32_t chans_in[] = {
551 SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
552 SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
553 SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
554 SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0
557 static void vlc_ToWave(WAVEFORMATEXTENSIBLE *restrict wf,
558 audio_sample_format_t *restrict audio)
560 switch (audio->i_format)
563 audio->i_format = VLC_CODEC_FL32;
565 wf->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
570 audio->i_format = VLC_CODEC_S16N;
572 wf->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
576 audio->i_format = VLC_CODEC_FL32;
577 wf->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
580 aout_FormatPrepare (audio);
582 wf->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
583 wf->Format.nChannels = audio->i_channels;
584 wf->Format.nSamplesPerSec = audio->i_rate;
585 wf->Format.nAvgBytesPerSec = audio->i_bytes_per_frame * audio->i_rate;
586 wf->Format.nBlockAlign = audio->i_bytes_per_frame;
587 wf->Format.wBitsPerSample = audio->i_bitspersample;
588 wf->Format.cbSize = sizeof (*wf) - sizeof (wf->Format);
590 wf->Samples.wValidBitsPerSample = audio->i_bitspersample;
592 wf->dwChannelMask = 0;
593 for (unsigned i = 0; pi_vlc_chan_order_wg4[i]; i++)
594 if (audio->i_physical_channels & pi_vlc_chan_order_wg4[i])
595 wf->dwChannelMask |= chans_in[i];
598 static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
599 audio_sample_format_t *restrict audio)
601 audio->i_rate = wf->nSamplesPerSec;
603 if (wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
605 const WAVEFORMATEXTENSIBLE *wfe = (void *)wf;
607 audio->i_physical_channels = 0;
608 for (unsigned i = 0; chans_in[i]; i++)
609 if (wfe->dwChannelMask & chans_in[i])
610 audio->i_physical_channels |= pi_vlc_chan_order_wg4[i];
613 audio->i_original_channels = audio->i_physical_channels;
614 aout_FormatPrepare (audio);
616 if (wf->nChannels != audio->i_channels)
621 static wchar_t *var_InheritWide(vlc_object_t *obj, const char *name)
623 char *v8 = var_InheritString(obj, name);
627 wchar_t *v16 = ToWide(v8);
631 #define var_InheritWide(o,n) var_InheritWide(VLC_OBJECT(o),n)
633 static int var_SetWide(vlc_object_t *obj, const char *name, const wchar_t *val)
635 char *str = FromWide(val);
636 if (unlikely(str == NULL))
639 int ret = var_SetString(obj, name, str);
643 #define var_SetWide(o,n,v) var_SetWide(VLC_OBJECT(o),n,v)
645 /* Dummy thread to create and release COM interfaces when needed. */
646 static void MTAThread(void *data)
648 audio_output_t *aout = data;
649 aout_sys_t *sys = aout->sys;
654 hr = IAudioClient_GetService(sys->client, &IID_IAudioRenderClient,
655 (void **)&sys->render);
658 msg_Err(aout, "cannot get audio render service (error 0x%lx)", hr);
662 hr = IAudioClient_GetService(sys->client, &IID_IAudioClock,
663 (void **)&sys->clock);
665 msg_Warn(aout, "cannot get audio clock (error 0x%lx)", hr);
667 hr = IAudioClient_GetService(sys->client, &IID_IAudioSessionControl,
668 (void **)&sys->control);
670 msg_Warn(aout, "cannot get audio session control (error 0x%lx)", hr);
673 wchar_t *ua = var_InheritWide(aout, "user-agent");
674 IAudioSessionControl_SetDisplayName(sys->control, ua, NULL);
678 /* do nothing until the audio session terminates */
679 ReleaseSemaphore(sys->ready, 1, NULL);
680 WaitForSingleObject(sys->done, INFINITE);
682 if (sys->control != NULL)
683 IAudioSessionControl_Release(sys->control);
684 if (sys->clock != NULL)
685 IAudioClock_Release(sys->clock);
686 IAudioRenderClient_Release(sys->render);
689 ReleaseSemaphore(sys->ready, 1, NULL);
692 static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
694 aout_sys_t *sys = aout->sys;
700 sys->events.lpVtbl = &vlc_AudioSessionEvents;
707 /* Get audio device according to policy */
708 // Without configuration item, the variable must be created explicitly.
709 var_Create (aout, "wasapi-audio-device", VLC_VAR_STRING);
710 LPWSTR devid = var_InheritWide (aout, "wasapi-audio-device");
711 var_Destroy (aout, "wasapi-audio-device");
713 IMMDevice *dev = NULL;
716 msg_Dbg (aout, "using selected device %ls", devid);
717 hr = IMMDeviceEnumerator_GetDevice (sys->it, devid, &dev);
719 msg_Warn(aout, "cannot get audio endpoint (error 0x%lx)", hr);
724 msg_Dbg (aout, "using default device");
725 hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(sys->it, eRender,
730 msg_Err(aout, "cannot get audio endpoint (error 0x%lx)", hr);
734 hr = IMMDevice_GetId(dev, &devid);
737 msg_Dbg(aout, "using device %ls", devid);
738 var_SetWide (aout, "audio-device", devid);
739 CoTaskMemFree(devid);
742 hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_ALL, NULL,
743 (void **)&sys->client);
744 IMMDevice_Release(dev);
747 msg_Err(aout, "cannot activate audio client (error 0x%lx)", hr);
751 /* Configure audio stream */
752 WAVEFORMATEXTENSIBLE wf;
755 vlc_ToWave(&wf, fmt);
756 hr = IAudioClient_IsFormatSupported(sys->client, AUDCLNT_SHAREMODE_SHARED,
760 msg_Err(aout, "cannot negotiate audio format (error 0x%lx)", hr);
767 if (vlc_FromWave(pwf, fmt))
770 msg_Err(aout, "unsupported audio format");
773 msg_Dbg(aout, "modified format");
778 sys->chans_to_reorder = aout_CheckChannelReorder(chans_in, chans_out,
779 fmt->i_physical_channels,
781 sys->bits = fmt->i_bitspersample;
783 hr = IAudioClient_Initialize(sys->client, AUDCLNT_SHAREMODE_SHARED, 0,
784 AOUT_MAX_PREPARE_TIME * 10, 0,
785 (hr == S_OK) ? &wf.Format : pwf,
790 msg_Err(aout, "cannot initialize audio client (error 0x%lx)", hr);
794 hr = IAudioClient_GetBufferSize(sys->client, &sys->frames);
797 msg_Err(aout, "cannot get buffer size (error 0x%lx)", hr);
801 sys->ready = CreateSemaphore(NULL, 0, 1, NULL);
802 sys->done = CreateSemaphore(NULL, 0, 1, NULL);
803 if (unlikely(sys->ready == NULL || sys->done == NULL))
805 /* Note: thread handle released by CRT, ignore it. */
806 if (_beginthread(MTAThread, 0, aout) == (uintptr_t)-1)
809 WaitForSingleObject(sys->ready, INFINITE);
810 if (sys->render == NULL)
815 sys->rate = fmt->i_rate;
816 sys->bytes_per_frame = fmt->i_bytes_per_frame;
817 aout->time_get = TimeGet;
821 if (likely(sys->control != NULL))
822 IAudioSessionControl_RegisterAudioSessionNotification(sys->control,
824 var_AddCallback (aout, "audio-device", DeviceChanged, NULL);
828 if (sys->done != NULL)
829 CloseHandle(sys->done);
830 if (sys->ready != NULL)
831 CloseHandle(sys->done);
832 if (sys->client != NULL)
833 IAudioClient_Release(sys->client);
834 if (hr == AUDCLNT_E_DEVICE_INVALIDATED)
836 var_SetString(aout, "audio-device", "");
837 msg_Warn(aout, "device invalidated, retrying");
844 static void Stop(audio_output_t *aout)
846 aout_sys_t *sys = aout->sys;
849 if (likely(sys->control != NULL))
850 IAudioSessionControl_UnregisterAudioSessionNotification(sys->control,
852 ReleaseSemaphore(sys->done, 1, NULL); /* tell MTA thread to finish */
853 WaitForSingleObject(sys->ready, INFINITE); /* wait for that ^ */
854 IAudioClient_Stop(sys->client); /* should not be needed */
855 IAudioClient_Release(sys->client);
858 var_DelCallback (aout, "audio-device", DeviceChanged, NULL);
860 CloseHandle(sys->done);
861 CloseHandle(sys->ready);
864 static int Open(vlc_object_t *obj)
866 audio_output_t *aout = (audio_output_t *)obj;
870 if (!aout->b_force && var_InheritBool(aout, "spdif"))
871 /* Fallback to other plugin until pass-through is implemented */
874 aout_sys_t *sys = malloc(sizeof (*sys));
875 if (unlikely(sys == NULL))
882 hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
883 &IID_IMMDeviceEnumerator, &pv);
886 msg_Dbg(aout, "cannot create device enumerator (error 0x%lx)", hr);
891 GetDevices(obj, sys->it);
897 aout->volume_set = SimpleVolumeSet; /* FIXME */
898 aout->mute_set = SimpleMuteSet;
905 static void Close(vlc_object_t *obj)
907 audio_output_t *aout = (audio_output_t *)obj;
908 aout_sys_t *sys = aout->sys;
910 var_Destroy (aout, "audio-device");
913 IMMDeviceEnumerator_Release(sys->it);