wineoss: Move start 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-04-13 07:38:49 +01:00 committed by Alexandre Julliard
parent 93cc994be8
commit cc8e8bc692
3 changed files with 31 additions and 19 deletions

View File

@ -934,7 +934,7 @@ static void silence_buffer(struct oss_stream *stream, BYTE *buffer, UINT32 frame
static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
{
ACImpl *This = impl_from_IAudioClient3(iface);
struct oss_stream *stream = This->stream;
struct start_params params;
TRACE("(%p)\n", This);
@ -945,31 +945,17 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
return AUDCLNT_E_NOT_INITIALIZED;
}
oss_lock(stream);
params.stream = This->stream;
OSS_CALL(start, &params);
if((stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !stream->event){
oss_unlock(stream);
LeaveCriticalSection(&g_sessions_lock);
return AUDCLNT_E_EVENTHANDLE_NOT_SET;
}
if(stream->playing){
oss_unlock(stream);
LeaveCriticalSection(&g_sessions_lock);
return AUDCLNT_E_NOT_STOPPED;
}
if(!This->timer_thread){
if(SUCCEEDED(params.result) && !This->timer_thread){
This->timer_thread = CreateThread(NULL, 0, timer_thread, This->stream, 0, NULL);
SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL);
}
stream->playing = TRUE;
oss_unlock(stream);
LeaveCriticalSection(&g_sessions_lock);
return S_OK;
return params.result;
}
static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)

View File

@ -627,6 +627,24 @@ static NTSTATUS release_stream(void *args)
return STATUS_SUCCESS;
}
static NTSTATUS start(void *args)
{
struct start_params *params = args;
struct oss_stream *stream = params->stream;
oss_lock(stream);
if((stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !stream->event)
return oss_unlock_result(stream, &params->result, AUDCLNT_E_EVENTHANDLE_NOT_SET);
if(stream->playing)
return oss_unlock_result(stream, &params->result, AUDCLNT_E_NOT_STOPPED);
stream->playing = TRUE;
return oss_unlock_result(stream, &params->result, S_OK);
}
static void silence_buffer(struct oss_stream *stream, BYTE *buffer, UINT32 frames)
{
WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)stream->fmt;
@ -989,6 +1007,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_endpoint_ids,
create_stream,
release_stream,
start,
timer_loop,
is_format_supported,
get_mix_format,

View File

@ -90,6 +90,12 @@ struct release_stream_params
HRESULT result;
};
struct start_params
{
struct oss_stream *stream;
HRESULT result;
};
struct timer_loop_params
{
struct oss_stream *stream;
@ -140,6 +146,7 @@ enum oss_funcs
oss_get_endpoint_ids,
oss_create_stream,
oss_release_stream,
oss_start,
oss_timer_loop,
oss_is_format_supported,
oss_get_mix_format,