[PATCH v5 3/3] winepulse: Return device-specific values for GetDevicePeriod
Claire Girka
wine at gitlab.winehq.org
Mon Jul 4 06:13:13 CDT 2022
From: Claire Girka <claire at sitedethib.com>
---
dlls/winepulse.drv/mmdevdrv.c | 14 ++++++---
dlls/winepulse.drv/pulse.c | 58 +++++++++++++++++++++++++++++++++++
dlls/winepulse.drv/unixlib.h | 11 +++++++
3 files changed, 78 insertions(+), 5 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 0d975dab24e..6ed02cd0b9d 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -1160,6 +1160,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);
@@ -1167,12 +1168,15 @@ 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.config = &pulse_config;
+ 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 ecae0e0072f..42979d54896 100644
--- a/dlls/winepulse.drv/pulse.c
+++ b/dlls/winepulse.drv/pulse.c
@@ -760,6 +760,38 @@ static NTSTATUS pulse_get_mix_format(void *args)
params->fmt = config->modes[params->flow == eCapture].format;
params->result = S_OK;
+ return STATUS_SUCCESS;
+}
+
+static NTSTATUS pulse_get_device_period(void *args)
+{
+ struct get_device_period_params *params = args;
+ struct pulse_config *config = params->config;
+ struct list *list = (params->flow == eRender) ? &g_phys_speakers : &g_phys_sources;
+ PhysDevice *dev;
+
+ if (!params->def_period && !params->min_period) {
+ params->result = E_POINTER;
+ return STATUS_SUCCESS;
+ }
+
+ LIST_FOR_EACH_ENTRY(dev, list, PhysDevice, entry) {
+ if (strcmp(params->pulse_name, dev->pulse_name))
+ continue;
+
+ if (params->def_period)
+ *params->def_period = dev->def_period;
+ if (params->min_period)
+ *params->min_period = dev->min_period;
+ params->result = S_OK;
+
+ return STATUS_SUCCESS;
+ }
+
+ if (params->def_period)
+ *params->def_period = config->modes[params->flow == eCapture].def_period;
+ if (params->min_period)
+ *params->min_period = config->modes[params->flow == eCapture].min_period;
params->result = S_OK;
return STATUS_SUCCESS;
@@ -2343,6 +2375,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
pulse_is_started,
pulse_get_prop_value,
pulse_get_mix_format,
+ pulse_get_device_period,
};
#ifdef _WIN64
@@ -2719,6 +2752,30 @@ 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;
+ PTR32 config;
+ EDataFlow flow;
+ HRESULT result;
+ PTR32 def_period;
+ PTR32 min_period;
+ } *params32 = args;
+ struct get_device_period_params params =
+ {
+ .pulse_name = ULongToPtr(params32->pulse_name),
+ .config = ULongToPtr(params32->config), /* struct pulse_config is identical */
+ .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;
+}
+
const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
{
pulse_process_attach,
@@ -2747,6 +2804,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
pulse_is_started,
pulse_wow64_get_prop_value,
pulse_wow64_get_mix_format,
+ pulse_wow64_get_device_period,
};
#endif /* _WIN64 */
diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h
index 99e9b228429..05ffa71fde5 100644
--- a/dlls/winepulse.drv/unixlib.h
+++ b/dlls/winepulse.drv/unixlib.h
@@ -168,6 +168,16 @@ struct get_mix_format_params
WAVEFORMATEXTENSIBLE fmt;
};
+struct get_device_period_params
+{
+ const char *pulse_name;
+ struct pulse_config *config;
+ EDataFlow flow;
+ HRESULT result;
+ REFERENCE_TIME *def_period;
+ REFERENCE_TIME *min_period;
+};
+
struct get_next_packet_size_params
{
stream_handle stream;
@@ -262,4 +272,5 @@ enum unix_funcs
is_started,
get_prop_value,
get_mix_format,
+ get_device_period,
};
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/337
More information about the wine-devel
mailing list