wineoss: 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
07f22e20d7
commit
aa9d07e630
|
@ -783,7 +783,7 @@ static HRESULT WINAPI AudioClient_GetBufferSize(IAudioClient3 *iface,
|
|||
UINT32 *frames)
|
||||
{
|
||||
ACImpl *This = impl_from_IAudioClient3(iface);
|
||||
struct oss_stream *stream = This->stream;
|
||||
struct get_buffer_size_params params;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, frames);
|
||||
|
||||
|
@ -793,15 +793,13 @@ static HRESULT WINAPI AudioClient_GetBufferSize(IAudioClient3 *iface,
|
|||
if(!This->stream)
|
||||
return AUDCLNT_E_NOT_INITIALIZED;
|
||||
|
||||
oss_lock(stream);
|
||||
|
||||
*frames = stream->bufsize_frames;
|
||||
params.stream = This->stream;
|
||||
params.size = frames;
|
||||
|
||||
OSS_CALL(get_buffer_size, ¶ms);
|
||||
TRACE("buffer size: %u\n", *frames);
|
||||
|
||||
oss_unlock(stream);
|
||||
|
||||
return S_OK;
|
||||
return params.result;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
|
||||
|
|
|
@ -70,6 +70,24 @@ static int muldiv( int a, int b, int c )
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void oss_lock(struct oss_stream *stream)
|
||||
{
|
||||
pthread_mutex_lock(&stream->lock);
|
||||
}
|
||||
|
||||
static void oss_unlock(struct oss_stream *stream)
|
||||
{
|
||||
pthread_mutex_unlock(&stream->lock);
|
||||
}
|
||||
|
||||
static NTSTATUS oss_unlock_result(struct oss_stream *stream,
|
||||
HRESULT *result, HRESULT value)
|
||||
{
|
||||
*result = value;
|
||||
oss_unlock(stream);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS test_connect(void *args)
|
||||
{
|
||||
struct test_connect_params *params = args;
|
||||
|
@ -732,6 +750,18 @@ static NTSTATUS get_mix_format(void *args)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS get_buffer_size(void *args)
|
||||
{
|
||||
struct get_buffer_size_params *params = args;
|
||||
struct oss_stream *stream = params->stream;
|
||||
|
||||
oss_lock(stream);
|
||||
|
||||
*params->size = stream->bufsize_frames;
|
||||
|
||||
return oss_unlock_result(stream, ¶ms->result, S_OK);
|
||||
}
|
||||
|
||||
unixlib_entry_t __wine_unix_call_funcs[] =
|
||||
{
|
||||
test_connect,
|
||||
|
@ -740,4 +770,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
|
|||
release_stream,
|
||||
is_format_supported,
|
||||
get_mix_format,
|
||||
get_buffer_size,
|
||||
};
|
||||
|
|
|
@ -106,6 +106,13 @@ struct get_mix_format_params
|
|||
HRESULT result;
|
||||
};
|
||||
|
||||
struct get_buffer_size_params
|
||||
{
|
||||
struct oss_stream *stream;
|
||||
HRESULT result;
|
||||
UINT32 *size;
|
||||
};
|
||||
|
||||
enum oss_funcs
|
||||
{
|
||||
oss_test_connect,
|
||||
|
@ -114,6 +121,7 @@ enum oss_funcs
|
|||
oss_release_stream,
|
||||
oss_is_format_supported,
|
||||
oss_get_mix_format,
|
||||
oss_get_buffer_size,
|
||||
};
|
||||
|
||||
extern unixlib_handle_t oss_handle;
|
||||
|
|
Loading…
Reference in New Issue