diff options
Diffstat (limited to 'audio/out/ao_wasapi_utils.c')
-rwxr-xr-x | audio/out/ao_wasapi_utils.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index eb4350f96d..1b201f6b20 100755 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -829,20 +829,15 @@ end: return found; } -HRESULT wasapi_enumerate_devices(struct ao *ao, - struct ao_device_list *list) +void wasapi_list_devs(struct ao *ao, struct ao_device_list *list) { - IMMDeviceEnumerator *pEnumerator = NULL; + struct wasapi_state *state = (struct wasapi_state *)ao->priv; IMMDeviceCollection *pDevices = NULL; IMMDevice *pDevice = NULL; char *name = NULL, *id = NULL; - HRESULT hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, - &IID_IMMDeviceEnumerator, - (void **)&pEnumerator); - EXIT_ON_ERROR(hr); - hr = IMMDeviceEnumerator_EnumAudioEndpoints(pEnumerator, eRender, - DEVICE_STATE_ACTIVE, &pDevices); + HRESULT hr = IMMDeviceEnumerator_EnumAudioEndpoints(state->pEnumerator, eRender, + DEVICE_STATE_ACTIVE, &pDevices); EXIT_ON_ERROR(hr); int count; @@ -871,9 +866,8 @@ HRESULT wasapi_enumerate_devices(struct ao *ao, SAFE_RELEASE(pDevice, IMMDevice_Release(pDevice)); } SAFE_RELEASE(pDevices, IMMDeviceCollection_Release(pDevices)); - SAFE_RELEASE(pEnumerator, IMMDeviceEnumerator_Release(pEnumerator)); - return S_OK; + return; exit_label: MP_ERR(ao, "Error enumerating devices: %s (0x%"PRIx32")\n", wasapi_explain_err(hr), (uint32_t) hr); @@ -881,8 +875,6 @@ exit_label: talloc_free(id); SAFE_RELEASE(pDevice, IMMDevice_Release(pDevice)); SAFE_RELEASE(pDevices, IMMDeviceCollection_Release(pDevices)); - SAFE_RELEASE(pEnumerator, IMMDeviceEnumerator_Release(pEnumerator)); - return hr; } static HRESULT load_default_device(struct ao *ao, IMMDeviceEnumerator* pEnumerator, @@ -1169,30 +1161,6 @@ exit_label: return hr; } -HRESULT wasapi_hotplug_init(struct ao *ao) -{ - struct wasapi_state *state = (struct wasapi_state *)ao->priv; - HRESULT hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, - &IID_IMMDeviceEnumerator, (void **)&state->pEnumerator); - EXIT_ON_ERROR(hr); - - hr = wasapi_change_init(ao, true); - EXIT_ON_ERROR(hr); - - return S_OK; -exit_label: - MP_ERR(state, "Error setting up audio hotplug: %s (0x%"PRIx32")\n", - wasapi_explain_err(hr), (uint32_t) hr); - return hr; -} - -void wasapi_hotplug_uninit(struct ao *ao) -{ - struct wasapi_state *state = (struct wasapi_state *)ao->priv; - wasapi_change_uninit(ao); - SAFE_RELEASE(state->pEnumerator, IMMDeviceEnumerator_Release(state->pEnumerator)); -} - void wasapi_thread_uninit(struct ao *ao) { struct wasapi_state *state = (struct wasapi_state *)ao->priv; |