Module: wine Branch: master Commit: be356451fc64439abfcc5a2db9f466b1d0c28824 URL: https://gitlab.winehq.org/wine/wine/-/commit/be356451fc64439abfcc5a2db9f466b...
Author: Davide Beatrici git@davidebeatrici.dev Date: Thu Jun 8 01:50:57 2023 +0200
wineoss: Use mmdevapi's AudioClient's GetDevicePeriod, GetMixFormat, IsFormatSupported.
---
dlls/wineoss.drv/mmdevdrv.c | 89 +++++---------------------------------------- 1 file changed, 9 insertions(+), 80 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index a25b03676f2..dc76574c979 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -686,86 +686,15 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, return params.result; }
-static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface, +extern HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *fmt, - WAVEFORMATEX **out) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct is_format_supported_params params; - - TRACE("(%p)->(%x, %p, %p)\n", This, mode, fmt, out); - if(fmt) dump_fmt(fmt); - - params.device = This->device_name; - params.flow = This->dataflow; - params.share = mode; - params.fmt_in = fmt; - params.fmt_out = NULL; - - if(out){ - *out = NULL; - if(mode == AUDCLNT_SHAREMODE_SHARED) - params.fmt_out = CoTaskMemAlloc(sizeof(*params.fmt_out)); - } - OSS_CALL(is_format_supported, ¶ms); - - if(params.result == S_FALSE) - *out = ¶ms.fmt_out->Format; - else - CoTaskMemFree(params.fmt_out); - - return params.result; -} - -static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, - WAVEFORMATEX **pwfx) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct get_mix_format_params params; - - TRACE("(%p)->(%p)\n", This, pwfx); - - if(!pwfx) - return E_POINTER; - *pwfx = NULL; - - params.device = This->device_name; - params.flow = This->dataflow; - params.fmt = CoTaskMemAlloc(sizeof(WAVEFORMATEXTENSIBLE)); - if(!params.fmt) - return E_OUTOFMEMORY; + WAVEFORMATEX **out);
- OSS_CALL(get_mix_format, ¶ms); +extern HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, + WAVEFORMATEX **pwfx);
- if(SUCCEEDED(params.result)){ - *pwfx = ¶ms.fmt->Format; - dump_fmt(*pwfx); - } else - CoTaskMemFree(params.fmt); - - return params.result; -} - -static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct get_device_period_params params; - - TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); - - if (!defperiod && !minperiod) - return E_POINTER; - - params.device = This->device_name; - params.flow = This->dataflow; - params.def_period = defperiod; - params.min_period = minperiod; - - OSS_CALL(get_device_period, ¶ms); - - return params.result; -} +extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, + REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod);
extern HRESULT WINAPI client_Start(IAudioClient3 *iface);
@@ -809,9 +738,9 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_GetBufferSize, AudioClient_GetStreamLatency, AudioClient_GetCurrentPadding, - AudioClient_IsFormatSupported, - AudioClient_GetMixFormat, - AudioClient_GetDevicePeriod, + client_IsFormatSupported, + client_GetMixFormat, + client_GetDevicePeriod, client_Start, client_Stop, client_Reset,