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:
parent
2dd83eed7b
commit
272a7b0ba5
|
@ -1237,11 +1237,31 @@ static NTSTATUS get_current_padding(void *args)
|
||||||
return STATUS_SUCCESS;
|
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[] =
|
unixlib_entry_t __wine_unix_call_funcs[] =
|
||||||
{
|
{
|
||||||
get_endpoint_ids,
|
get_endpoint_ids,
|
||||||
create_stream,
|
create_stream,
|
||||||
release_stream,
|
release_stream,
|
||||||
|
start,
|
||||||
get_mix_format,
|
get_mix_format,
|
||||||
is_format_supported,
|
is_format_supported,
|
||||||
get_buffer_size,
|
get_buffer_size,
|
||||||
|
|
|
@ -996,38 +996,31 @@ void CALLBACK ca_period_cb(void *user, BOOLEAN timer)
|
||||||
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 start_params params;
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
TRACE("(%p)\n", This);
|
||||||
|
|
||||||
if(!This->stream)
|
if(!This->stream)
|
||||||
return AUDCLNT_E_NOT_INITIALIZED;
|
return AUDCLNT_E_NOT_INITIALIZED;
|
||||||
|
|
||||||
OSSpinLockLock(&This->stream->lock);
|
if((This->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !This->event)
|
||||||
|
|
||||||
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);
|
|
||||||
return AUDCLNT_E_EVENTHANDLE_NOT_SET;
|
return AUDCLNT_E_EVENTHANDLE_NOT_SET;
|
||||||
}
|
|
||||||
|
|
||||||
if(This->event && !This->timer)
|
params.stream = This->stream;
|
||||||
if(!CreateTimerQueueTimer(&This->timer, g_timer_q, ca_period_cb,
|
UNIX_CALL(start, ¶ms);
|
||||||
This, 0, This->period_ms, WT_EXECUTEINTIMERTHREAD)){
|
|
||||||
|
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;
|
This->timer = NULL;
|
||||||
OSSpinLockUnlock(&This->stream->lock);
|
IAudioClient3_Stop(iface);
|
||||||
WARN("Unable to create timer: %u\n", GetLastError());
|
WARN("Unable to create timer: %u\n", GetLastError());
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
This->stream->playing = TRUE;
|
}
|
||||||
|
return params.result;
|
||||||
OSSpinLockUnlock(&This->stream->lock);
|
|
||||||
|
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
|
static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
|
||||||
|
|
|
@ -75,6 +75,12 @@ struct release_stream_params
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct start_params
|
||||||
|
{
|
||||||
|
struct coreaudio_stream *stream;
|
||||||
|
HRESULT result;
|
||||||
|
};
|
||||||
|
|
||||||
struct get_mix_format_params
|
struct get_mix_format_params
|
||||||
{
|
{
|
||||||
EDataFlow flow;
|
EDataFlow flow;
|
||||||
|
@ -120,6 +126,7 @@ enum unix_funcs
|
||||||
unix_get_endpoint_ids,
|
unix_get_endpoint_ids,
|
||||||
unix_create_stream,
|
unix_create_stream,
|
||||||
unix_release_stream,
|
unix_release_stream,
|
||||||
|
unix_start,
|
||||||
unix_get_mix_format,
|
unix_get_mix_format,
|
||||||
unix_is_format_supported,
|
unix_is_format_supported,
|
||||||
unix_get_buffer_size,
|
unix_get_buffer_size,
|
||||||
|
|
Loading…
Reference in New Issue