mmdevapi: IsFormatSupported EXCLUSIVE mode never returns S_FALSE.

This commit is contained in:
Jörg Höhle 2011-09-08 15:21:52 +02:00 committed by Alexandre Julliard
parent 41c6ffea44
commit 00684f84a5
3 changed files with 19 additions and 13 deletions

View File

@ -1204,8 +1204,11 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
dump_fmt(fmt);
if(out)
if(out){
*out = NULL;
if(mode != AUDCLNT_SHAREMODE_SHARED)
out = NULL;
}
EnterCriticalSection(&This->lock);
@ -1339,6 +1342,9 @@ exit:
LeaveCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, formats);
if(hr == S_FALSE && !out)
hr = AUDCLNT_E_UNSUPPORTED_FORMAT;
if(hr == S_FALSE && out) {
closest->nBlockAlign =
closest->nChannels * closest->wBitsPerSample / 8;

View File

@ -1145,6 +1145,9 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
dump_fmt(pwfx);
if(outpwfx)
*outpwfx = NULL;
if(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
fmtex->dwChannelMask != 0 &&
fmtex->dwChannelMask != get_channel_mask(pwfx->nChannels))
@ -1156,17 +1159,12 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
if(SUCCEEDED(hr)){
AudioQueueDispose(aqueue, 1);
OSSpinLockUnlock(&This->lock);
if(outpwfx)
*outpwfx = NULL;
TRACE("returning %08x\n", S_OK);
return S_OK;
}
OSSpinLockUnlock(&This->lock);
if(outpwfx)
*outpwfx = NULL;
TRACE("returning %08x\n", AUDCLNT_E_UNSUPPORTED_FORMAT);
return AUDCLNT_E_UNSUPPORTED_FORMAT;
}

View File

@ -714,9 +714,6 @@ static HRESULT setup_oss_device(int fd, const WAVEFORMATEX *fmt,
WAVEFORMATEXTENSIBLE *fmtex = (void*)fmt;
WAVEFORMATEX *closest = NULL;
if(out)
*out = NULL;
tmp = oss_format = get_oss_format(fmt);
if(oss_format < 0)
return AUDCLNT_E_UNSUPPORTED_FORMAT;
@ -767,6 +764,9 @@ static HRESULT setup_oss_device(int fd, const WAVEFORMATEX *fmt,
ret = S_FALSE;
}
if(ret == S_FALSE && !out)
ret = AUDCLNT_E_UNSUPPORTED_FORMAT;
if(ret == S_FALSE && out){
closest->nBlockAlign =
closest->nChannels * closest->wBitsPerSample / 8;
@ -901,10 +901,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
}
hr = setup_oss_device(This->fd, fmt, NULL, FALSE);
if(hr == S_FALSE){
LeaveCriticalSection(&This->lock);
return AUDCLNT_E_UNSUPPORTED_FORMAT;
}
if(FAILED(hr)){
LeaveCriticalSection(&This->lock);
return hr;
@ -1137,6 +1133,12 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
dump_fmt(pwfx);
if(outpwfx){
*outpwfx = NULL;
if(mode != AUDCLNT_SHAREMODE_SHARED)
outpwfx = NULL;
}
if(This->dataflow == eRender)
fd = open(This->devnode, O_WRONLY, 0);
else if(This->dataflow == eCapture)