Commit 227724e0 authored by Claire Girka's avatar Claire Girka Committed by Alexandre Julliard

winepulse: Return device-specific values for GetMixFormat.

When GetMixFormat is used, return values specific to the selected device instead of those of the default one. This is especially useful when the default audio device features less channels than one specifically selected by the application.
parent 5302181e
...@@ -1136,17 +1136,30 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, ...@@ -1136,17 +1136,30 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface,
WAVEFORMATEX **pwfx) WAVEFORMATEX **pwfx)
{ {
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
struct get_mix_format_params params;
TRACE("(%p)->(%p)\n", This, pwfx); TRACE("(%p)->(%p)\n", This, pwfx);
if (!pwfx) if (!pwfx)
return E_POINTER; return E_POINTER;
*pwfx = NULL;
*pwfx = clone_format(&pulse_config.modes[This->dataflow == eCapture].format.Format); params.pulse_name = This->pulse_name;
if (!*pwfx) params.flow = This->dataflow;
params.fmt = CoTaskMemAlloc(sizeof(WAVEFORMATEXTENSIBLE));
if (!params.fmt)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
dump_fmt(*pwfx);
return S_OK; pulse_call(get_mix_format, &params);
if (SUCCEEDED(params.result)) {
*pwfx = &params.fmt->Format;
dump_fmt(*pwfx);
} else {
CoTaskMemFree(params.fmt);
}
return params.result;
} }
static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface,
......
...@@ -2032,6 +2032,26 @@ static NTSTATUS pulse_release_capture_buffer(void *args) ...@@ -2032,6 +2032,26 @@ static NTSTATUS pulse_release_capture_buffer(void *args)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
static NTSTATUS pulse_get_mix_format(void *args)
{
struct get_mix_format_params *params = args;
struct list *list = (params->flow == eRender) ? &g_phys_speakers : &g_phys_sources;
PhysDevice *dev;
LIST_FOR_EACH_ENTRY(dev, list, PhysDevice, entry) {
if (strcmp(params->pulse_name, dev->pulse_name))
continue;
*params->fmt = dev->fmt;
params->result = S_OK;
return STATUS_SUCCESS;
}
params->result = E_FAIL;
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;
...@@ -2311,6 +2331,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = ...@@ -2311,6 +2331,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
pulse_release_render_buffer, pulse_release_render_buffer,
pulse_get_capture_buffer, pulse_get_capture_buffer,
pulse_release_capture_buffer, pulse_release_capture_buffer,
pulse_get_mix_format,
pulse_get_buffer_size, pulse_get_buffer_size,
pulse_get_latency, pulse_get_latency,
pulse_get_current_padding, pulse_get_current_padding,
...@@ -2466,6 +2487,26 @@ static NTSTATUS pulse_wow64_get_capture_buffer(void *args) ...@@ -2466,6 +2487,26 @@ static NTSTATUS pulse_wow64_get_capture_buffer(void *args)
return STATUS_SUCCESS; return STATUS_SUCCESS;
}; };
static NTSTATUS pulse_wow64_get_mix_format(void *args)
{
struct
{
PTR32 pulse_name;
EDataFlow flow;
PTR32 fmt;
HRESULT result;
} *params32 = args;
struct get_mix_format_params params =
{
.pulse_name = ULongToPtr(params32->pulse_name),
.flow = params32->flow,
.fmt = ULongToPtr(params32->fmt),
};
pulse_get_mix_format(&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
...@@ -2692,6 +2733,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = ...@@ -2692,6 +2733,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
pulse_release_render_buffer, pulse_release_render_buffer,
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_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,
......
...@@ -138,6 +138,14 @@ struct release_capture_buffer_params ...@@ -138,6 +138,14 @@ struct release_capture_buffer_params
HRESULT result; HRESULT result;
}; };
struct get_mix_format_params
{
const char *pulse_name;
EDataFlow flow;
WAVEFORMATEXTENSIBLE *fmt;
HRESULT result;
};
struct get_buffer_size_params struct get_buffer_size_params
{ {
stream_handle stream; stream_handle stream;
...@@ -241,6 +249,7 @@ enum unix_funcs ...@@ -241,6 +249,7 @@ enum unix_funcs
release_render_buffer, release_render_buffer,
get_capture_buffer, get_capture_buffer,
release_capture_buffer, release_capture_buffer,
get_mix_format,
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