winealsa: Move get_buffer_size 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:
parent
125f5b7210
commit
413b3c59e5
|
@ -160,6 +160,24 @@ static int muldiv( int a, int b, int c )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void alsa_lock(struct alsa_stream *stream)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&stream->lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void alsa_unlock(struct alsa_stream *stream)
|
||||||
|
{
|
||||||
|
pthread_mutex_unlock(&stream->lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static NTSTATUS alsa_unlock_result(struct alsa_stream *stream,
|
||||||
|
HRESULT *result, HRESULT value)
|
||||||
|
{
|
||||||
|
*result = value;
|
||||||
|
alsa_unlock(stream);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL alsa_try_open(const char *devnode, EDataFlow flow)
|
static BOOL alsa_try_open(const char *devnode, EDataFlow flow)
|
||||||
{
|
{
|
||||||
snd_pcm_t *handle;
|
snd_pcm_t *handle;
|
||||||
|
@ -1220,6 +1238,18 @@ exit:
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS get_buffer_size(void *args)
|
||||||
|
{
|
||||||
|
struct get_buffer_size_params *params = args;
|
||||||
|
struct alsa_stream *stream = params->stream;
|
||||||
|
|
||||||
|
alsa_lock(stream);
|
||||||
|
|
||||||
|
*params->size = stream->bufsize_frames;
|
||||||
|
|
||||||
|
return alsa_unlock_result(stream, ¶ms->result, S_OK);
|
||||||
|
}
|
||||||
|
|
||||||
unixlib_entry_t __wine_unix_call_funcs[] =
|
unixlib_entry_t __wine_unix_call_funcs[] =
|
||||||
{
|
{
|
||||||
get_endpoint_ids,
|
get_endpoint_ids,
|
||||||
|
@ -1227,4 +1257,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
|
||||||
release_stream,
|
release_stream,
|
||||||
is_format_supported,
|
is_format_supported,
|
||||||
get_mix_format,
|
get_mix_format,
|
||||||
|
get_buffer_size,
|
||||||
};
|
};
|
||||||
|
|
|
@ -827,7 +827,7 @@ static HRESULT WINAPI AudioClient_GetBufferSize(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_buffer_size_params params;
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, out);
|
TRACE("(%p)->(%p)\n", This, out);
|
||||||
|
|
||||||
|
@ -837,13 +837,12 @@ static HRESULT WINAPI AudioClient_GetBufferSize(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.size = out;
|
||||||
|
|
||||||
*out = stream->bufsize_frames;
|
ALSA_CALL(get_buffer_size, ¶ms);
|
||||||
|
|
||||||
alsa_unlock(stream);
|
return params.result;
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
|
static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
|
||||||
|
|
|
@ -108,6 +108,13 @@ struct get_mix_format_params
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct get_buffer_size_params
|
||||||
|
{
|
||||||
|
struct alsa_stream *stream;
|
||||||
|
HRESULT result;
|
||||||
|
UINT32 *size;
|
||||||
|
};
|
||||||
|
|
||||||
enum alsa_funcs
|
enum alsa_funcs
|
||||||
{
|
{
|
||||||
alsa_get_endpoint_ids,
|
alsa_get_endpoint_ids,
|
||||||
|
@ -115,6 +122,7 @@ enum alsa_funcs
|
||||||
alsa_release_stream,
|
alsa_release_stream,
|
||||||
alsa_is_format_supported,
|
alsa_is_format_supported,
|
||||||
alsa_get_mix_format,
|
alsa_get_mix_format,
|
||||||
|
alsa_get_buffer_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern unixlib_handle_t alsa_handle;
|
extern unixlib_handle_t alsa_handle;
|
||||||
|
|
Loading…
Reference in New Issue