mmdevapi: Support device ID paths in ActivateAudioInterfaceAsync.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
80276752d1
commit
6de9bd06ba
@ -413,6 +413,7 @@ static HRESULT get_mmdevice_by_activatepath(const WCHAR *path, IMMDevice **mmdev
|
||||
|
||||
static const WCHAR DEVINTERFACE_AUDIO_RENDER_WSTR[] = L"{E6327CAD-DCEC-4949-AE8A-991E976A79D2}";
|
||||
static const WCHAR DEVINTERFACE_AUDIO_CAPTURE_WSTR[] = L"{2EEF81BE-33FA-4800-9670-1CD474972C3F}";
|
||||
static const WCHAR MMDEV_PATH_PREFIX[] = L"\\\\?\\SWD#MMDEVAPI#";
|
||||
|
||||
hr = MMDevEnum_Create(&IID_IMMDeviceEnumerator, (void**)&devenum);
|
||||
if (FAILED(hr)) {
|
||||
@ -424,8 +425,15 @@ static HRESULT get_mmdevice_by_activatepath(const WCHAR *path, IMMDevice **mmdev
|
||||
hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum, eRender, eMultimedia, mmdev);
|
||||
} else if (!lstrcmpiW(path, DEVINTERFACE_AUDIO_CAPTURE_WSTR)){
|
||||
hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum, eCapture, eMultimedia, mmdev);
|
||||
} else if (!memcmp(path, MMDEV_PATH_PREFIX, sizeof(MMDEV_PATH_PREFIX) - sizeof(WCHAR))) {
|
||||
WCHAR device_id[56]; /* == strlen("{0.0.1.00000000}.{fd47d9cc-4218-4135-9ce2-0c195c87405b}") + 1 */
|
||||
|
||||
wcsncpy(device_id, path + (ARRAY_SIZE(MMDEV_PATH_PREFIX) - 1), ARRAY_SIZE(device_id));
|
||||
device_id[ARRAY_SIZE(device_id) - 1] = 0;
|
||||
|
||||
hr = IMMDeviceEnumerator_GetDevice(devenum, device_id, mmdev);
|
||||
} else {
|
||||
FIXME("How to map path to device id? %s\n", debugstr_w(path));
|
||||
FIXME("Unrecognized device id format: %s\n", debugstr_w(path));
|
||||
hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user