winecoreaudio: Move is_started 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 2021-11-24 11:26:47 +00:00 committed by Alexandre Julliard
parent b884ca314d
commit 22981cc913
3 changed files with 25 additions and 4 deletions

View File

@ -1541,6 +1541,19 @@ static NTSTATUS get_frequency(void *args)
return STATUS_SUCCESS;
}
static NTSTATUS is_started(void *args)
{
struct is_started_params *params = args;
struct coreaudio_stream *stream = params->stream;
if(stream->playing)
params->result = S_OK;
else
params->result = S_FALSE;
return STATUS_SUCCESS;
}
unixlib_entry_t __wine_unix_call_funcs[] =
{
get_endpoint_ids,
@ -1561,4 +1574,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_next_packet_size,
get_position,
get_frequency,
is_started,
};

View File

@ -1628,6 +1628,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface,
AudioSessionState *state)
{
AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface);
struct is_started_params params;
ACImpl *client;
TRACE("(%p)->(%p)\n", This, state);
@ -1644,14 +1645,13 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface,
}
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){
OSSpinLockLock(&client->stream->lock);
if(client->stream->playing){
params.stream = client->stream;
UNIX_CALL(is_started, &params);
if(params.result == S_OK){
*state = AudioSessionStateActive;
OSSpinLockUnlock(&client->stream->lock);
LeaveCriticalSection(&g_sessions_lock);
return S_OK;
}
OSSpinLockUnlock(&client->stream->lock);
}
LeaveCriticalSection(&g_sessions_lock);

View File

@ -188,6 +188,12 @@ struct get_frequency_params
UINT64 *freq;
};
struct is_started_params
{
struct coreaudio_stream *stream;
HRESULT result;
};
enum unix_funcs
{
unix_get_endpoint_ids,
@ -208,6 +214,7 @@ enum unix_funcs
unix_get_next_packet_size,
unix_get_position,
unix_get_frequency,
unix_is_started,
};
extern unixlib_handle_t coreaudio_handle;