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 delay)
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 *delay = ((GetQPC() - qpcpos) / (10000000 / CLOCK_FREQ));
163 static_assert((10000000 % CLOCK_FREQ) == 0, "Frequency conversion broken");
167 static void Play(audio_output_t *aout, block_t *block)
169 aout_sys_t *sys = aout->sys;
172 if (sys->chans_to_reorder)
173 aout_ChannelReorder(block->p_buffer, block->i_buffer,
174 sys->chans_to_reorder, sys->chans_table, sys->bits);
180 hr = IAudioClient_GetCurrentPadding(sys->client, &frames);
183 msg_Err(aout, "cannot get current padding (error 0x%lx)", hr);
187 assert(frames <= sys->frames);
188 frames = sys->frames - frames;
189 if (frames > block->i_nb_samples)
190 frames = block->i_nb_samples;
193 hr = IAudioRenderClient_GetBuffer(sys->render, frames, &dst);
196 msg_Err(aout, "cannot get buffer (error 0x%lx)", hr);
200 const size_t copy = frames * sys->bytes_per_frame;
202 memcpy(dst, block->p_buffer, copy);
203 hr = IAudioRenderClient_ReleaseBuffer(sys->render, frames, 0);
206 msg_Err(aout, "cannot release buffer (error 0x%lx)", hr);
209 IAudioClient_Start(sys->client);
211 block->p_buffer += copy;
212 block->i_buffer -= copy;
213 block->i_nb_samples -= frames;
214 if (block->i_nb_samples == 0)
217 /* Out of buffer space, sleep */
218 msleep(AOUT_MIN_PREPARE_TIME
219 + block->i_nb_samples * CLOCK_FREQ / sys->rate);
223 block_Release(block);
225 /* Restart on unplug */
226 if (unlikely(hr == AUDCLNT_E_DEVICE_INVALIDATED))
227 var_TriggerCallback(aout, "audio-device");
230 static void Pause(audio_output_t *aout, bool paused, mtime_t date)
232 aout_sys_t *sys = aout->sys;
237 hr = IAudioClient_Stop(sys->client);
239 hr = IAudioClient_Start(sys->client);
241 msg_Warn(aout, "cannot %s stream (error 0x%lx)",
242 paused ? "stop" : "start", hr);
247 static void Flush(audio_output_t *aout, bool wait)
249 aout_sys_t *sys = aout->sys;
253 return; /* Drain not implemented */
256 IAudioClient_Stop(sys->client);
257 hr = IAudioClient_Reset(sys->client);
259 msg_Warn(aout, "cannot reset stream (error 0x%lx)", hr);
263 static int SimpleVolumeSet(audio_output_t *aout, float vol)
265 ISimpleAudioVolume *simple;
270 hr = IAudioClient_GetService(aout->sys->client, &IID_ISimpleAudioVolume,
274 hr = ISimpleAudioVolume_SetMasterVolume(simple, vol, NULL);
275 ISimpleAudioVolume_Release(simple);
281 msg_Err(aout, "cannot set volume (error 0x%lx)", hr);
287 static int SimpleMuteSet(audio_output_t *aout, bool mute)
289 ISimpleAudioVolume *simple;
294 hr = IAudioClient_GetService(aout->sys->client, &IID_ISimpleAudioVolume,
298 hr = ISimpleAudioVolume_SetMute(simple, mute, NULL);
299 ISimpleAudioVolume_Release(simple);
305 msg_Err(aout, "cannot set mute (error 0x%lx)", hr);
312 /*** Audio devices ***/
313 static int DeviceChanged(vlc_object_t *obj, const char *varname,
314 vlc_value_t prev, vlc_value_t cur, void *data)
316 aout_ChannelsRestart(obj, varname, prev, cur, data);
318 if (!var_Type (obj, "wasapi-audio-device"))
319 var_Create (obj, "wasapi-audio-device", VLC_VAR_STRING);
320 var_SetString (obj, "wasapi-audio-device", cur.psz_string);
324 static void GetDevices(vlc_object_t *obj, IMMDeviceEnumerator *it)
327 vlc_value_t val, text;
329 var_Create (obj, "audio-device", VLC_VAR_STRING | VLC_VAR_HASCHOICE);
330 text.psz_string = _("Audio Device");
331 var_Change (obj, "audio-device", VLC_VAR_SETTEXT, &text, NULL);
333 IMMDeviceCollection *devs;
334 hr = IMMDeviceEnumerator_EnumAudioEndpoints(it, eRender,
335 DEVICE_STATE_ACTIVE, &devs);
338 msg_Warn (obj, "cannot enumerate audio endpoints (error 0x%lx)", hr);
343 hr = IMMDeviceCollection_GetCount(devs, &n);
346 msg_Warn (obj, "cannot count audio endpoints (error 0x%lx)", hr);
350 msg_Dbg(obj, "Available Windows Audio devices:");
356 hr = IMMDeviceCollection_Item(devs, --n, &dev);
360 /* Unique device ID */
362 hr = IMMDevice_GetId(dev, &devid);
365 IMMDevice_Release(dev);
368 val.psz_string = FromWide(devid);
369 CoTaskMemFree(devid);
370 text.psz_string = val.psz_string;
372 /* User-readable device name */
373 IPropertyStore *props;
374 hr = IMMDevice_OpenPropertyStore(dev, STGM_READ, &props);
380 hr = IPropertyStore_GetValue(props, &PKEY_Device_FriendlyName, &v);
382 text.psz_string = FromWide(v.pwszVal);
383 PropVariantClear(&v);
384 IPropertyStore_Release(props);
386 IMMDevice_Release(dev);
388 msg_Dbg(obj, "%s (%s)", val.psz_string, text.psz_string);
389 var_Change(obj, "audio-device", VLC_VAR_ADDCHOICE, &val, &text);
390 if (likely(text.psz_string != val.psz_string))
391 free(text.psz_string);
392 free(val.psz_string);
394 IMMDeviceCollection_Release(devs);
398 /*** Audio session events ***/
399 static inline aout_sys_t *vlc_AudioSessionEvents_sys(IAudioSessionEvents *this)
401 return (aout_sys_t *)(((char *)this) - offsetof(aout_sys_t, events));
405 vlc_AudioSessionEvents_QueryInterface(IAudioSessionEvents *this, REFIID riid,
408 if (IsEqualIID(riid, &IID_IUnknown)
409 || IsEqualIID(riid, &IID_IAudioSessionEvents))
412 IUnknown_AddRef(this);
418 return E_NOINTERFACE;
422 static STDMETHODIMP_(ULONG)
423 vlc_AudioSessionEvents_AddRef(IAudioSessionEvents *this)
425 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
426 return InterlockedIncrement(&sys->refs);
429 static STDMETHODIMP_(ULONG)
430 vlc_AudioSessionEvents_Release(IAudioSessionEvents *this)
432 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
433 return InterlockedDecrement(&sys->refs);
437 vlc_AudioSessionEvents_OnDisplayNameChanged(IAudioSessionEvents *this,
438 LPCWSTR wname, LPCGUID ctx)
440 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
441 audio_output_t *aout = sys->aout;
443 msg_Dbg(aout, "display name changed: %ls", wname);
449 vlc_AudioSessionEvents_OnIconPathChanged(IAudioSessionEvents *this,
450 LPCWSTR wpath, LPCGUID ctx)
452 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
453 audio_output_t *aout = sys->aout;
455 msg_Dbg(aout, "icon path changed: %ls", wpath);
461 vlc_AudioSessionEvents_OnSimpleVolumeChanged(IAudioSessionEvents *this, float vol,
462 WINBOOL mute, LPCGUID ctx)
464 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
465 audio_output_t *aout = sys->aout;
467 msg_Dbg(aout, "simple volume changed: %f, muting %sabled", vol,
468 mute ? "en" : "dis");
469 aout_VolumeReport(aout, vol);
470 aout_MuteReport(aout, mute == TRUE);
476 vlc_AudioSessionEvents_OnChannelVolumeChanged(IAudioSessionEvents *this,
477 DWORD count, float *vols,
478 DWORD changed, LPCGUID ctx)
480 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
481 audio_output_t *aout = sys->aout;
483 msg_Dbg(aout, "channel volume %lu of %lu changed: %f", changed, count,
490 vlc_AudioSessionEvents_OnGroupingParamChanged(IAudioSessionEvents *this,
491 LPCGUID param, LPCGUID ctx)
494 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
495 audio_output_t *aout = sys->aout;
497 msg_Dbg(aout, "grouping parameter changed");
504 vlc_AudioSessionEvents_OnStateChanged(IAudioSessionEvents *this,
505 AudioSessionState state)
507 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
508 audio_output_t *aout = sys->aout;
510 msg_Dbg(aout, "state changed: %d", state);
515 vlc_AudioSessionEvents_OnSessionDisconnected(IAudioSessionEvents *this,
516 AudioSessionDisconnectReason reason)
518 aout_sys_t *sys = vlc_AudioSessionEvents_sys(this);
519 audio_output_t *aout = sys->aout;
521 msg_Dbg(aout, "session disconnected: reason %d", reason);
525 static const struct IAudioSessionEventsVtbl vlc_AudioSessionEvents =
527 vlc_AudioSessionEvents_QueryInterface,
528 vlc_AudioSessionEvents_AddRef,
529 vlc_AudioSessionEvents_Release,
531 vlc_AudioSessionEvents_OnDisplayNameChanged,
532 vlc_AudioSessionEvents_OnIconPathChanged,
533 vlc_AudioSessionEvents_OnSimpleVolumeChanged,
534 vlc_AudioSessionEvents_OnChannelVolumeChanged,
535 vlc_AudioSessionEvents_OnGroupingParamChanged,
536 vlc_AudioSessionEvents_OnStateChanged,
537 vlc_AudioSessionEvents_OnSessionDisconnected,
541 /*** Initialization / deinitialization **/
542 static const uint32_t chans_out[] = {
543 SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
544 SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
545 SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
546 SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0
548 static const uint32_t chans_in[] = {
549 SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
550 SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
551 SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
552 SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0
555 static void vlc_ToWave(WAVEFORMATEXTENSIBLE *restrict wf,
556 audio_sample_format_t *restrict audio)
558 switch (audio->i_format)
561 audio->i_format = VLC_CODEC_FL32;
563 wf->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
568 audio->i_format = VLC_CODEC_S16N;
570 wf->SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
574 audio->i_format = VLC_CODEC_FL32;
575 wf->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
578 aout_FormatPrepare (audio);
580 wf->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
581 wf->Format.nChannels = audio->i_channels;
582 wf->Format.nSamplesPerSec = audio->i_rate;
583 wf->Format.nAvgBytesPerSec = audio->i_bytes_per_frame * audio->i_rate;
584 wf->Format.nBlockAlign = audio->i_bytes_per_frame;
585 wf->Format.wBitsPerSample = audio->i_bitspersample;
586 wf->Format.cbSize = sizeof (*wf) - sizeof (wf->Format);
588 wf->Samples.wValidBitsPerSample = audio->i_bitspersample;
590 wf->dwChannelMask = 0;
591 for (unsigned i = 0; pi_vlc_chan_order_wg4[i]; i++)
592 if (audio->i_physical_channels & pi_vlc_chan_order_wg4[i])
593 wf->dwChannelMask |= chans_in[i];
596 static int vlc_FromWave(const WAVEFORMATEX *restrict wf,
597 audio_sample_format_t *restrict audio)
599 audio->i_rate = wf->nSamplesPerSec;
601 if (wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
603 const WAVEFORMATEXTENSIBLE *wfe = (void *)wf;
605 audio->i_physical_channels = 0;
606 for (unsigned i = 0; chans_in[i]; i++)
607 if (wfe->dwChannelMask & chans_in[i])
608 audio->i_physical_channels |= pi_vlc_chan_order_wg4[i];
611 audio->i_original_channels = audio->i_physical_channels;
612 aout_FormatPrepare (audio);
614 if (wf->nChannels != audio->i_channels)
619 static wchar_t *var_InheritWide(vlc_object_t *obj, const char *name)
621 char *v8 = var_InheritString(obj, name);
625 wchar_t *v16 = ToWide(v8);
629 #define var_InheritWide(o,n) var_InheritWide(VLC_OBJECT(o),n)
631 static int var_SetWide(vlc_object_t *obj, const char *name, const wchar_t *val)
633 char *str = FromWide(val);
634 if (unlikely(str == NULL))
637 int ret = var_SetString(obj, name, str);
641 #define var_SetWide(o,n,v) var_SetWide(VLC_OBJECT(o),n,v)
643 /* Dummy thread to create and release COM interfaces when needed. */
644 static void MTAThread(void *data)
646 audio_output_t *aout = data;
647 aout_sys_t *sys = aout->sys;
652 hr = IAudioClient_GetService(sys->client, &IID_IAudioRenderClient,
653 (void **)&sys->render);
656 msg_Err(aout, "cannot get audio render service (error 0x%lx)", hr);
660 hr = IAudioClient_GetService(sys->client, &IID_IAudioClock,
661 (void **)&sys->clock);
663 msg_Warn(aout, "cannot get audio clock (error 0x%lx)", hr);
665 hr = IAudioClient_GetService(sys->client, &IID_IAudioSessionControl,
666 (void **)&sys->control);
668 msg_Warn(aout, "cannot get audio session control (error 0x%lx)", hr);
671 wchar_t *ua = var_InheritWide(aout, "user-agent");
672 IAudioSessionControl_SetDisplayName(sys->control, ua, NULL);
676 /* do nothing until the audio session terminates */
677 ReleaseSemaphore(sys->ready, 1, NULL);
678 WaitForSingleObject(sys->done, INFINITE);
680 if (sys->control != NULL)
681 IAudioSessionControl_Release(sys->control);
682 if (sys->clock != NULL)
683 IAudioClock_Release(sys->clock);
684 IAudioRenderClient_Release(sys->render);
687 ReleaseSemaphore(sys->ready, 1, NULL);
690 static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
692 aout_sys_t *sys = aout->sys;
698 sys->events.lpVtbl = &vlc_AudioSessionEvents;
705 /* Get audio device according to policy */
706 // Without configuration item, the variable must be created explicitly.
707 var_Create (aout, "wasapi-audio-device", VLC_VAR_STRING);
708 LPWSTR devid = var_InheritWide (aout, "wasapi-audio-device");
709 var_Destroy (aout, "wasapi-audio-device");
711 IMMDevice *dev = NULL;
714 msg_Dbg (aout, "using selected device %ls", devid);
715 hr = IMMDeviceEnumerator_GetDevice (sys->it, devid, &dev);
717 msg_Warn(aout, "cannot get audio endpoint (error 0x%lx)", hr);
722 msg_Dbg (aout, "using default device");
723 hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(sys->it, eRender,
728 msg_Err(aout, "cannot get audio endpoint (error 0x%lx)", hr);
732 hr = IMMDevice_GetId(dev, &devid);
735 msg_Dbg(aout, "using device %ls", devid);
736 var_SetWide (aout, "audio-device", devid);
737 CoTaskMemFree(devid);
740 hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_ALL, NULL,
741 (void **)&sys->client);
742 IMMDevice_Release(dev);
745 msg_Err(aout, "cannot activate audio client (error 0x%lx)", hr);
749 /* Configure audio stream */
750 WAVEFORMATEXTENSIBLE wf;
753 vlc_ToWave(&wf, fmt);
754 hr = IAudioClient_IsFormatSupported(sys->client, AUDCLNT_SHAREMODE_SHARED,
758 msg_Err(aout, "cannot negotiate audio format (error 0x%lx)", hr);
765 if (vlc_FromWave(pwf, fmt))
768 msg_Err(aout, "unsupported audio format");
771 msg_Dbg(aout, "modified format");
776 sys->chans_to_reorder = aout_CheckChannelReorder(chans_in, chans_out,
777 fmt->i_physical_channels,
779 sys->bits = fmt->i_bitspersample;
781 hr = IAudioClient_Initialize(sys->client, AUDCLNT_SHAREMODE_SHARED, 0,
782 AOUT_MAX_PREPARE_TIME * 10, 0,
783 (hr == S_OK) ? &wf.Format : pwf,
788 msg_Err(aout, "cannot initialize audio client (error 0x%lx)", hr);
792 hr = IAudioClient_GetBufferSize(sys->client, &sys->frames);
795 msg_Err(aout, "cannot get buffer size (error 0x%lx)", hr);
799 sys->ready = CreateSemaphore(NULL, 0, 1, NULL);
800 sys->done = CreateSemaphore(NULL, 0, 1, NULL);
801 if (unlikely(sys->ready == NULL || sys->done == NULL))
803 /* Note: thread handle released by CRT, ignore it. */
804 if (_beginthread(MTAThread, 0, aout) == (uintptr_t)-1)
807 WaitForSingleObject(sys->ready, INFINITE);
808 if (sys->render == NULL)
813 sys->rate = fmt->i_rate;
814 sys->bytes_per_frame = fmt->i_bytes_per_frame;
815 aout->time_get = TimeGet;
819 if (likely(sys->control != NULL))
820 IAudioSessionControl_RegisterAudioSessionNotification(sys->control,
822 var_AddCallback (aout, "audio-device", DeviceChanged, NULL);
826 if (sys->done != NULL)
827 CloseHandle(sys->done);
828 if (sys->ready != NULL)
829 CloseHandle(sys->done);
830 if (sys->client != NULL)
831 IAudioClient_Release(sys->client);
832 if (hr == AUDCLNT_E_DEVICE_INVALIDATED)
834 var_SetString(aout, "audio-device", "");
835 msg_Warn(aout, "device invalidated, retrying");
842 static void Stop(audio_output_t *aout)
844 aout_sys_t *sys = aout->sys;
847 if (likely(sys->control != NULL))
848 IAudioSessionControl_UnregisterAudioSessionNotification(sys->control,
850 ReleaseSemaphore(sys->done, 1, NULL); /* tell MTA thread to finish */
851 WaitForSingleObject(sys->ready, INFINITE); /* wait for that ^ */
852 IAudioClient_Stop(sys->client); /* should not be needed */
853 IAudioClient_Release(sys->client);
856 var_DelCallback (aout, "audio-device", DeviceChanged, NULL);
858 CloseHandle(sys->done);
859 CloseHandle(sys->ready);
862 static int Open(vlc_object_t *obj)
864 audio_output_t *aout = (audio_output_t *)obj;
868 if (!aout->b_force && var_InheritBool(aout, "spdif"))
869 /* Fallback to other plugin until pass-through is implemented */
872 aout_sys_t *sys = malloc(sizeof (*sys));
873 if (unlikely(sys == NULL))
880 hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
881 &IID_IMMDeviceEnumerator, &pv);
884 msg_Dbg(aout, "cannot create device enumerator (error 0x%lx)", hr);
889 GetDevices(obj, sys->it);
895 aout->volume_set = SimpleVolumeSet; /* FIXME */
896 aout->mute_set = SimpleMuteSet;
903 static void Close(vlc_object_t *obj)
905 audio_output_t *aout = (audio_output_t *)obj;
906 aout_sys_t *sys = aout->sys;
908 var_Destroy (aout, "audio-device");
911 IMMDeviceEnumerator_Release(sys->it);