winecoreaudio: 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 2021-11-23 07:55:03 +00:00 committed by Alexandre Julliard
parent 2dd83eed7b
commit 272a7b0ba5
3 changed files with 43 additions and 23 deletions

View File

@ -1237,11 +1237,31 @@ static NTSTATUS get_current_padding(void *args)
return STATUS_SUCCESS;
}
static NTSTATUS start(void *args)
{
struct start_params *params = args;
struct coreaudio_stream *stream = params->stream;
OSSpinLockLock(&stream->lock);
if(stream->playing)
params->result = AUDCLNT_E_NOT_STOPPED;
else{
stream->playing = TRUE;
params->result = S_OK;
}
OSSpinLockUnlock(&stream->lock);
return STATUS_SUCCESS;
}
unixlib_entry_t __wine_unix_call_funcs[] =
{
get_endpoint_ids,
create_stream,
release_stream,
start,
get_mix_format,
is_format_supported,
get_buffer_size,

View File

@ -996,38 +996,31 @@ void CALLBACK ca_period_cb(void *user, BOOLEAN timer)
static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
{
ACImpl *This = impl_from_IAudioClient3(iface);
struct start_params params;
TRACE("(%p)\n", This);
if(!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
OSSpinLockLock(&This->stream->lock);
if(This->stream->playing){
OSSpinLockUnlock(&This->stream->lock);
return AUDCLNT_E_NOT_STOPPED;
}
if((This->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !This->event){
OSSpinLockUnlock(&This->stream->lock);
if((This->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !This->event)
return AUDCLNT_E_EVENTHANDLE_NOT_SET;
}
if(This->event && !This->timer)
if(!CreateTimerQueueTimer(&This->timer, g_timer_q, ca_period_cb,
This, 0, This->period_ms, WT_EXECUTEINTIMERTHREAD)){
This->timer = NULL;
OSSpinLockUnlock(&This->stream->lock);
WARN("Unable to create timer: %u\n", GetLastError());
return E_OUTOFMEMORY;
params.stream = This->stream;
UNIX_CALL(start, &params);
if(SUCCEEDED(params.result)){
if(This->event && !This->timer){
if(!CreateTimerQueueTimer(&This->timer, g_timer_q, ca_period_cb, This, 0,
This->period_ms, WT_EXECUTEINTIMERTHREAD)){
This->timer = NULL;
IAudioClient3_Stop(iface);
WARN("Unable to create timer: %u\n", GetLastError());
return E_OUTOFMEMORY;
}
}
This->stream->playing = TRUE;
OSSpinLockUnlock(&This->stream->lock);
return S_OK;
}
return params.result;
}
static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)

View File

@ -75,6 +75,12 @@ struct release_stream_params
HRESULT result;
};
struct start_params
{
struct coreaudio_stream *stream;
HRESULT result;
};
struct get_mix_format_params
{
EDataFlow flow;
@ -120,6 +126,7 @@ enum unix_funcs
unix_get_endpoint_ids,
unix_create_stream,
unix_release_stream,
unix_start,
unix_get_mix_format,
unix_is_format_supported,
unix_get_buffer_size,