winealsa: 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:
parent
3ddb038513
commit
7977f53219
|
@ -2182,6 +2182,16 @@ static NTSTATUS set_event_handle(void *args)
|
||||||
return alsa_unlock_result(stream, ¶ms->result, S_OK);
|
return alsa_unlock_result(stream, ¶ms->result, S_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NTSTATUS is_started(void *args)
|
||||||
|
{
|
||||||
|
struct is_started_params *params = args;
|
||||||
|
struct alsa_stream *stream = params->stream;
|
||||||
|
|
||||||
|
alsa_lock(stream);
|
||||||
|
|
||||||
|
return alsa_unlock_result(stream, ¶ms->result, stream->started ? S_OK : S_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
unixlib_entry_t __wine_unix_call_funcs[] =
|
unixlib_entry_t __wine_unix_call_funcs[] =
|
||||||
{
|
{
|
||||||
get_endpoint_ids,
|
get_endpoint_ids,
|
||||||
|
@ -2204,4 +2214,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
|
||||||
get_frequency,
|
get_frequency,
|
||||||
get_position,
|
get_position,
|
||||||
set_event_handle,
|
set_event_handle,
|
||||||
|
is_started,
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
|
@ -237,16 +236,6 @@ int WINAPI AUDDRV_GetPriority(void)
|
||||||
return Priority_Neutral;
|
return Priority_Neutral;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 HRESULT alsa_stream_release(struct alsa_stream *stream, HANDLE timer_thread)
|
static HRESULT alsa_stream_release(struct alsa_stream *stream, HANDLE timer_thread)
|
||||||
{
|
{
|
||||||
struct release_stream_params params;
|
struct release_stream_params params;
|
||||||
|
@ -1640,6 +1629,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface,
|
||||||
AudioSessionState *state)
|
AudioSessionState *state)
|
||||||
{
|
{
|
||||||
AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface);
|
AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface);
|
||||||
|
struct is_started_params params;
|
||||||
ACImpl *client;
|
ACImpl *client;
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, state);
|
TRACE("(%p)->(%p)\n", This, state);
|
||||||
|
@ -1656,14 +1646,13 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface,
|
||||||
}
|
}
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){
|
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){
|
||||||
alsa_lock(client->stream);
|
params.stream = client->stream;
|
||||||
if(client->stream->started){
|
ALSA_CALL(is_started, ¶ms);
|
||||||
|
if(params.result == S_OK){
|
||||||
*state = AudioSessionStateActive;
|
*state = AudioSessionStateActive;
|
||||||
alsa_unlock(client->stream);
|
|
||||||
LeaveCriticalSection(&g_sessions_lock);
|
LeaveCriticalSection(&g_sessions_lock);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
alsa_unlock(client->stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaveCriticalSection(&g_sessions_lock);
|
LeaveCriticalSection(&g_sessions_lock);
|
||||||
|
|
|
@ -216,6 +216,12 @@ struct set_event_handle_params
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct is_started_params
|
||||||
|
{
|
||||||
|
struct alsa_stream *stream;
|
||||||
|
HRESULT result;
|
||||||
|
};
|
||||||
|
|
||||||
enum alsa_funcs
|
enum alsa_funcs
|
||||||
{
|
{
|
||||||
alsa_get_endpoint_ids,
|
alsa_get_endpoint_ids,
|
||||||
|
@ -238,6 +244,7 @@ enum alsa_funcs
|
||||||
alsa_get_frequency,
|
alsa_get_frequency,
|
||||||
alsa_get_position,
|
alsa_get_position,
|
||||||
alsa_set_event_handle,
|
alsa_set_event_handle,
|
||||||
|
alsa_is_started,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern unixlib_handle_t alsa_handle;
|
extern unixlib_handle_t alsa_handle;
|
||||||
|
|
Loading…
Reference in New Issue