Commit 45f1cbe4 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winealsa: Move get_current_padding to the unixlib.

parent 5516e83f
...@@ -1271,6 +1271,19 @@ static NTSTATUS get_latency(void *args) ...@@ -1271,6 +1271,19 @@ static NTSTATUS get_latency(void *args)
return alsa_unlock_result(stream, &params->result, S_OK); return alsa_unlock_result(stream, &params->result, S_OK);
} }
static NTSTATUS get_current_padding(void *args)
{
struct get_current_padding_params *params = args;
struct alsa_stream *stream = params->stream;
alsa_lock(stream);
/* padding is solely updated at callback time in shared mode */
*params->padding = stream->held_frames;
return alsa_unlock_result(stream, &params->result, S_OK);
}
unixlib_entry_t __wine_unix_call_funcs[] = unixlib_entry_t __wine_unix_call_funcs[] =
{ {
get_endpoint_ids, get_endpoint_ids,
...@@ -1280,4 +1293,5 @@ unixlib_entry_t __wine_unix_call_funcs[] = ...@@ -1280,4 +1293,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_mix_format, get_mix_format,
get_buffer_size, get_buffer_size,
get_latency, get_latency,
get_current_padding,
}; };
...@@ -871,7 +871,7 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, ...@@ -871,7 +871,7 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
UINT32 *out) UINT32 *out)
{ {
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
struct alsa_stream *stream = This->stream; struct get_current_padding_params params;
TRACE("(%p)->(%p)\n", This, out); TRACE("(%p)->(%p)\n", This, out);
...@@ -881,16 +881,14 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, ...@@ -881,16 +881,14 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
if(!This->stream) if(!This->stream)
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
alsa_lock(stream); params.stream = This->stream;
params.padding = out;
/* padding is solely updated at callback time in shared mode */ ALSA_CALL(get_current_padding, &params);
*out = stream->held_frames;
alsa_unlock(stream);
TRACE("pad: %u\n", *out); TRACE("pad: %u\n", *out);
return S_OK; return params.result;
} }
static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface, static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface,
......
...@@ -122,6 +122,13 @@ struct get_latency_params ...@@ -122,6 +122,13 @@ struct get_latency_params
REFERENCE_TIME *latency; REFERENCE_TIME *latency;
}; };
struct get_current_padding_params
{
struct alsa_stream *stream;
HRESULT result;
UINT32 *padding;
};
enum alsa_funcs enum alsa_funcs
{ {
alsa_get_endpoint_ids, alsa_get_endpoint_ids,
...@@ -131,6 +138,7 @@ enum alsa_funcs ...@@ -131,6 +138,7 @@ enum alsa_funcs
alsa_get_mix_format, alsa_get_mix_format,
alsa_get_buffer_size, alsa_get_buffer_size,
alsa_get_latency, alsa_get_latency,
alsa_get_current_padding,
}; };
extern unixlib_handle_t alsa_handle; extern unixlib_handle_t alsa_handle;
......
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