From 2127a8a0d74cc81e15a34068ffc986c30f8a75e3 Mon Sep 17 00:00:00 2001 From: Davide Beatrici Date: Tue, 23 May 2023 10:17:10 +0200 Subject: [PATCH] wineoss: Implement get_device_period in unixlib. --- dlls/wineoss.drv/mmdevdrv.c | 15 +++++++++------ dlls/wineoss.drv/oss.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index dac5790e384..c55176307f0 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -785,18 +785,21 @@ 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) + if (!defperiod && !minperiod) return E_POINTER; - if(defperiod) - *defperiod = DefaultPeriod; - if(minperiod) - *minperiod = MinimumPeriod; + params.device = This->device_name; + params.flow = This->dataflow; + params.def_period = defperiod; + params.min_period = minperiod; - return S_OK; + OSS_CALL(get_device_period, ¶ms); + + return params.result; } static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index d8225b65889..585df97bc43 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -69,6 +69,9 @@ struct oss_stream WINE_DEFAULT_DEBUG_CHANNEL(oss); +static const REFERENCE_TIME def_period = 100000; +static const REFERENCE_TIME min_period = 50000; + static NTSTATUS oss_not_implemented(void *args) { return STATUS_SUCCESS; @@ -1245,6 +1248,20 @@ static NTSTATUS oss_get_mix_format(void *args) return STATUS_SUCCESS; } +static NTSTATUS oss_get_device_period(void *args) +{ + struct get_device_period_params *params = args; + + if (params->def_period) + *params->def_period = def_period; + if (params->min_period) + *params->min_period = min_period; + + params->result = S_OK; + + return STATUS_SUCCESS; +} + static NTSTATUS oss_get_buffer_size(void *args) { struct get_buffer_size_params *params = args; @@ -1649,7 +1666,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = oss_release_capture_buffer, oss_is_format_supported, oss_get_mix_format, - oss_not_implemented, + oss_get_device_period, oss_get_buffer_size, oss_get_latency, oss_get_current_padding, @@ -1860,6 +1877,28 @@ static NTSTATUS oss_wow64_get_mix_format(void *args) return STATUS_SUCCESS; } +static NTSTATUS oss_wow64_get_device_period(void *args) +{ + struct + { + PTR32 device; + EDataFlow flow; + HRESULT result; + PTR32 def_period; + PTR32 min_period; + } *params32 = args; + struct get_device_period_params params = + { + .device = ULongToPtr(params32->device), + .flow = params32->flow, + .def_period = ULongToPtr(params32->def_period), + .min_period = ULongToPtr(params32->min_period), + }; + oss_get_device_period(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + static NTSTATUS oss_wow64_get_buffer_size(void *args) { struct @@ -2051,7 +2090,7 @@ unixlib_entry_t __wine_unix_call_wow64_funcs[] = oss_release_capture_buffer, oss_wow64_is_format_supported, oss_wow64_get_mix_format, - oss_not_implemented, + oss_wow64_get_device_period, oss_wow64_get_buffer_size, oss_wow64_get_latency, oss_wow64_get_current_padding, -- 2.11.4.GIT