Commit 7a742c49 authored by Claire Girka's avatar Claire Girka Committed by Alexandre Julliard

winepulse: Return device-specific values for GetDevicePeriod.

parent 227724e0
...@@ -1165,6 +1165,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, ...@@ -1165,6 +1165,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface,
static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface,
REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod)
{ {
struct get_device_period_params params;
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod);
...@@ -1172,12 +1173,14 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, ...@@ -1172,12 +1173,14 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface,
if (!defperiod && !minperiod) if (!defperiod && !minperiod)
return E_POINTER; return E_POINTER;
if (defperiod) params.flow = This->dataflow;
*defperiod = pulse_config.modes[This->dataflow == eCapture].def_period; params.pulse_name = This->pulse_name;
if (minperiod) params.def_period = defperiod;
*minperiod = pulse_config.modes[This->dataflow == eCapture].min_period; params.min_period = minperiod;
return S_OK; pulse_call(get_device_period, &params);
return params.result;
} }
static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
......
...@@ -1075,6 +1075,29 @@ static ULONG_PTR zero_bits(void) ...@@ -1075,6 +1075,29 @@ static ULONG_PTR zero_bits(void)
#endif #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) static NTSTATUS pulse_create_stream(void *args)
{ {
struct create_stream_params *params = args; struct create_stream_params *params = args;
...@@ -2052,6 +2075,14 @@ static NTSTATUS pulse_get_mix_format(void *args) ...@@ -2052,6 +2075,14 @@ static NTSTATUS pulse_get_mix_format(void *args)
return STATUS_SUCCESS; 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) static NTSTATUS pulse_get_buffer_size(void *args)
{ {
struct get_buffer_size_params *params = args; struct get_buffer_size_params *params = args;
...@@ -2332,6 +2363,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = ...@@ -2332,6 +2363,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
pulse_get_capture_buffer, pulse_get_capture_buffer,
pulse_release_capture_buffer, pulse_release_capture_buffer,
pulse_get_mix_format, pulse_get_mix_format,
pulse_get_device_period,
pulse_get_buffer_size, pulse_get_buffer_size,
pulse_get_latency, pulse_get_latency,
pulse_get_current_padding, pulse_get_current_padding,
...@@ -2507,6 +2539,28 @@ static NTSTATUS pulse_wow64_get_mix_format(void *args) ...@@ -2507,6 +2539,28 @@ static NTSTATUS pulse_wow64_get_mix_format(void *args)
return STATUS_SUCCESS; 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(&params);
params32->result = params.result;
return STATUS_SUCCESS;
}
static NTSTATUS pulse_wow64_get_buffer_size(void *args) static NTSTATUS pulse_wow64_get_buffer_size(void *args)
{ {
struct struct
...@@ -2734,6 +2788,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = ...@@ -2734,6 +2788,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
pulse_wow64_get_capture_buffer, pulse_wow64_get_capture_buffer,
pulse_release_capture_buffer, pulse_release_capture_buffer,
pulse_wow64_get_mix_format, pulse_wow64_get_mix_format,
pulse_wow64_get_device_period,
pulse_wow64_get_buffer_size, pulse_wow64_get_buffer_size,
pulse_wow64_get_latency, pulse_wow64_get_latency,
pulse_wow64_get_current_padding, pulse_wow64_get_current_padding,
......
...@@ -146,6 +146,15 @@ struct get_mix_format_params ...@@ -146,6 +146,15 @@ struct get_mix_format_params
HRESULT result; 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 struct get_buffer_size_params
{ {
stream_handle stream; stream_handle stream;
...@@ -250,6 +259,7 @@ enum unix_funcs ...@@ -250,6 +259,7 @@ enum unix_funcs
get_capture_buffer, get_capture_buffer,
release_capture_buffer, release_capture_buffer,
get_mix_format, get_mix_format,
get_device_period,
get_buffer_size, get_buffer_size,
get_latency, get_latency,
get_current_padding, get_current_padding,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment