winealsa: Move get_current_padding to the unixlib.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2022-02-23 09:08:23 +00:00 committed by Alexandre Julliard
parent 5516e83f9a
commit 45f1cbe476
3 changed files with 27 additions and 7 deletions

View File

@ -1271,6 +1271,19 @@ static NTSTATUS get_latency(void *args)
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[] =
{
get_endpoint_ids,
@ -1280,4 +1293,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_mix_format,
get_buffer_size,
get_latency,
get_current_padding,
};

View File

@ -871,7 +871,7 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
UINT32 *out)
{
ACImpl *This = impl_from_IAudioClient3(iface);
struct alsa_stream *stream = This->stream;
struct get_current_padding_params params;
TRACE("(%p)->(%p)\n", This, out);
@ -881,16 +881,14 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
if(!This->stream)
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 */
*out = stream->held_frames;
alsa_unlock(stream);
ALSA_CALL(get_current_padding, &params);
TRACE("pad: %u\n", *out);
return S_OK;
return params.result;
}
static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface,

View File

@ -122,6 +122,13 @@ struct get_latency_params
REFERENCE_TIME *latency;
};
struct get_current_padding_params
{
struct alsa_stream *stream;
HRESULT result;
UINT32 *padding;
};
enum alsa_funcs
{
alsa_get_endpoint_ids,
@ -131,6 +138,7 @@ enum alsa_funcs
alsa_get_mix_format,
alsa_get_buffer_size,
alsa_get_latency,
alsa_get_current_padding,
};
extern unixlib_handle_t alsa_handle;