Commit cc8e8bc6 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineoss: Move start to the unixlib.

parent 93cc994b
...@@ -934,7 +934,7 @@ static void silence_buffer(struct oss_stream *stream, BYTE *buffer, UINT32 frame ...@@ -934,7 +934,7 @@ static void silence_buffer(struct oss_stream *stream, BYTE *buffer, UINT32 frame
static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
{ {
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
struct oss_stream *stream = This->stream; struct start_params params;
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
...@@ -945,31 +945,17 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) ...@@ -945,31 +945,17 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
return AUDCLNT_E_NOT_INITIALIZED; 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); This->timer_thread = CreateThread(NULL, 0, timer_thread, This->stream, 0, NULL);
SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL); SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL);
} }
stream->playing = TRUE;
oss_unlock(stream);
LeaveCriticalSection(&g_sessions_lock); LeaveCriticalSection(&g_sessions_lock);
return S_OK; return params.result;
} }
static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
......
...@@ -627,6 +627,24 @@ static NTSTATUS release_stream(void *args) ...@@ -627,6 +627,24 @@ static NTSTATUS release_stream(void *args)
return STATUS_SUCCESS; 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) static void silence_buffer(struct oss_stream *stream, BYTE *buffer, UINT32 frames)
{ {
WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)stream->fmt; WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)stream->fmt;
...@@ -989,6 +1007,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = ...@@ -989,6 +1007,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_endpoint_ids, get_endpoint_ids,
create_stream, create_stream,
release_stream, release_stream,
start,
timer_loop, timer_loop,
is_format_supported, is_format_supported,
get_mix_format, get_mix_format,
......
...@@ -90,6 +90,12 @@ struct release_stream_params ...@@ -90,6 +90,12 @@ struct release_stream_params
HRESULT result; HRESULT result;
}; };
struct start_params
{
struct oss_stream *stream;
HRESULT result;
};
struct timer_loop_params struct timer_loop_params
{ {
struct oss_stream *stream; struct oss_stream *stream;
...@@ -140,6 +146,7 @@ enum oss_funcs ...@@ -140,6 +146,7 @@ enum oss_funcs
oss_get_endpoint_ids, oss_get_endpoint_ids,
oss_create_stream, oss_create_stream,
oss_release_stream, oss_release_stream,
oss_start,
oss_timer_loop, oss_timer_loop,
oss_is_format_supported, oss_is_format_supported,
oss_get_mix_format, oss_get_mix_format,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment