From: Claire Girka claire@sitedethib.com
--- dlls/winepulse.drv/mmdevdrv.c | 13 +++++---- dlls/winepulse.drv/pulse.c | 55 +++++++++++++++++++++++++++++++++++ dlls/winepulse.drv/unixlib.h | 10 +++++++ 3 files changed, 73 insertions(+), 5 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 61875b7352d..6b78a56388b 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -1165,6 +1165,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) { + struct get_device_period_params params; ACImpl *This = impl_from_IAudioClient3(iface);
TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); @@ -1172,12 +1173,14 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, if (!defperiod && !minperiod) return E_POINTER;
- if (defperiod) - *defperiod = pulse_config.modes[This->dataflow == eCapture].def_period; - if (minperiod) - *minperiod = pulse_config.modes[This->dataflow == eCapture].min_period; + params.flow = This->dataflow; + params.pulse_name = This->pulse_name; + params.def_period = defperiod; + params.min_period = minperiod;
- return S_OK; + pulse_call(get_device_period, ¶ms); + + return params.result; }
static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 2e2d94d2d1f..70a05656e5e 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -1075,6 +1075,29 @@ static ULONG_PTR zero_bits(void) #endif }
+static HRESULT get_device_period_helper(EDataFlow flow, const char *pulse_name, REFERENCE_TIME *def, REFERENCE_TIME *min) +{ + struct list *list = (flow == eRender) ? &g_phys_speakers : &g_phys_sources; + PhysDevice *dev; + + if (!def && !min) { + return E_POINTER; + } + + LIST_FOR_EACH_ENTRY(dev, list, PhysDevice, entry) { + if (strcmp(pulse_name, dev->pulse_name)) + continue; + + if (def) + *def = dev->def_period; + if (min) + *min = dev->min_period; + return S_OK; + } + + return E_FAIL; +} + static NTSTATUS pulse_create_stream(void *args) { struct create_stream_params *params = args; @@ -2052,6 +2075,14 @@ static NTSTATUS pulse_get_mix_format(void *args) return STATUS_SUCCESS; }
+static NTSTATUS pulse_get_device_period(void *args) +{ + struct get_device_period_params *params = args; + + params->result = get_device_period_helper(params->flow, params->pulse_name, params->def_period, params->min_period); + return STATUS_SUCCESS; +} + static NTSTATUS pulse_get_buffer_size(void *args) { struct get_buffer_size_params *params = args; @@ -2332,6 +2363,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = pulse_get_capture_buffer, pulse_release_capture_buffer, pulse_get_mix_format, + pulse_get_device_period, pulse_get_buffer_size, pulse_get_latency, pulse_get_current_padding, @@ -2507,6 +2539,28 @@ static NTSTATUS pulse_wow64_get_mix_format(void *args) return STATUS_SUCCESS; }
+static NTSTATUS pulse_wow64_get_device_period(void *args) +{ + struct + { + PTR32 pulse_name; + EDataFlow flow; + HRESULT result; + PTR32 def_period; + PTR32 min_period; + } *params32 = args; + struct get_device_period_params params = + { + .pulse_name = ULongToPtr(params32->pulse_name), + .flow = params32->flow, + .def_period = ULongToPtr(params32->def_period), + .min_period = ULongToPtr(params32->min_period), + }; + pulse_get_device_period(¶ms); + params32->result = params.result; + return STATUS_SUCCESS; +} + static NTSTATUS pulse_wow64_get_buffer_size(void *args) { struct @@ -2734,6 +2788,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = pulse_wow64_get_capture_buffer, pulse_release_capture_buffer, pulse_wow64_get_mix_format, + pulse_wow64_get_device_period, pulse_wow64_get_buffer_size, pulse_wow64_get_latency, pulse_wow64_get_current_padding, diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index b6a19ddeb96..2eebc20297c 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -146,6 +146,15 @@ struct get_mix_format_params HRESULT result; };
+struct get_device_period_params +{ + const char *pulse_name; + EDataFlow flow; + HRESULT result; + REFERENCE_TIME *def_period; + REFERENCE_TIME *min_period; +}; + struct get_buffer_size_params { stream_handle stream; @@ -250,6 +259,7 @@ enum unix_funcs get_capture_buffer, release_capture_buffer, get_mix_format, + get_device_period, get_buffer_size, get_latency, get_current_padding,