winmm: Call IsFormatSupported for WAVE_FORMAT_QUERY only.
This commit is contained in:
parent
e3e0bfca20
commit
f5628373e5
|
@ -920,7 +920,7 @@ static MMRESULT WINMM_MapDevice(WINMM_OpenInfo *info, BOOL is_out)
|
||||||
static LRESULT WINMM_OpenDevice(WINMM_Device *device, WINMM_MMDevice *mmdevice,
|
static LRESULT WINMM_OpenDevice(WINMM_Device *device, WINMM_MMDevice *mmdevice,
|
||||||
WINMM_OpenInfo *info)
|
WINMM_OpenInfo *info)
|
||||||
{
|
{
|
||||||
WAVEFORMATEX *closer_fmt = NULL, fmt, *passed_fmt;
|
WAVEFORMATEX fmt, *passed_fmt;
|
||||||
LRESULT ret = MMSYSERR_NOMEM;
|
LRESULT ret = MMSYSERR_NOMEM;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -967,21 +967,14 @@ static LRESULT WINMM_OpenDevice(WINMM_Device *device, WINMM_MMDevice *mmdevice,
|
||||||
}else
|
}else
|
||||||
passed_fmt = info->format;
|
passed_fmt = info->format;
|
||||||
|
|
||||||
|
if(info->flags & WAVE_FORMAT_QUERY){
|
||||||
|
WAVEFORMATEX *closer_fmt = NULL;
|
||||||
|
|
||||||
hr = IAudioClient_IsFormatSupported(device->client,
|
hr = IAudioClient_IsFormatSupported(device->client,
|
||||||
AUDCLNT_SHAREMODE_SHARED, passed_fmt, &closer_fmt);
|
AUDCLNT_SHAREMODE_SHARED, passed_fmt, &closer_fmt);
|
||||||
if(closer_fmt)
|
if(closer_fmt)
|
||||||
CoTaskMemFree(closer_fmt);
|
CoTaskMemFree(closer_fmt);
|
||||||
if(FAILED(hr) && hr != AUDCLNT_E_UNSUPPORTED_FORMAT){
|
ret = hr == S_FALSE ? WAVERR_BADFORMAT : hr2mmr(hr);
|
||||||
WARN("IsFormatSupported failed: %08x\n", hr);
|
|
||||||
ret = hr2mmr(hr);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
if(hr == S_FALSE || hr == AUDCLNT_E_UNSUPPORTED_FORMAT){
|
|
||||||
ret = WAVERR_BADFORMAT;
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
if(info->flags & WAVE_FORMAT_QUERY){
|
|
||||||
ret = MMSYSERR_NOERROR;
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -990,6 +983,7 @@ static LRESULT WINMM_OpenDevice(WINMM_Device *device, WINMM_MMDevice *mmdevice,
|
||||||
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST,
|
||||||
10 * 100000, 50000, passed_fmt, &device->parent->session);
|
10 * 100000, 50000, passed_fmt, &device->parent->session);
|
||||||
if(FAILED(hr)){
|
if(FAILED(hr)){
|
||||||
|
if(hr != AUDCLNT_E_UNSUPPORTED_FORMAT)
|
||||||
WARN("Initialize failed: %08x\n", hr);
|
WARN("Initialize failed: %08x\n", hr);
|
||||||
ret = hr2mmr(hr);
|
ret = hr2mmr(hr);
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Reference in New Issue