winecoreaudio: Move reset 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
ac960ef94d
commit
5e97e50e95
|
@ -1275,6 +1275,34 @@ static NTSTATUS stop(void *args)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS reset(void *args)
|
||||
{
|
||||
struct reset_params *params = args;
|
||||
struct coreaudio_stream *stream = params->stream;
|
||||
|
||||
OSSpinLockLock(&stream->lock);
|
||||
|
||||
if(stream->playing)
|
||||
params->result = AUDCLNT_E_NOT_STOPPED;
|
||||
else if(stream->getbuf_last)
|
||||
params->result = AUDCLNT_E_BUFFER_OPERATION_PENDING;
|
||||
else{
|
||||
if(stream->flow == eRender)
|
||||
stream->written_frames = 0;
|
||||
else
|
||||
stream->written_frames += stream->held_frames;
|
||||
stream->held_frames = 0;
|
||||
stream->lcl_offs_frames = 0;
|
||||
stream->wri_offs_frames = 0;
|
||||
stream->cap_offs_frames = 0;
|
||||
stream->cap_held_frames = 0;
|
||||
params->result = S_OK;
|
||||
}
|
||||
|
||||
OSSpinLockUnlock(&stream->lock);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
unixlib_entry_t __wine_unix_call_funcs[] =
|
||||
{
|
||||
get_endpoint_ids,
|
||||
|
@ -1282,6 +1310,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
|
|||
release_stream,
|
||||
start,
|
||||
stop,
|
||||
reset,
|
||||
get_mix_format,
|
||||
is_format_supported,
|
||||
get_buffer_size,
|
||||
|
|
|
@ -1041,39 +1041,16 @@ static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
|
|||
static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface)
|
||||
{
|
||||
ACImpl *This = impl_from_IAudioClient3(iface);
|
||||
struct reset_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->stream->getbuf_last){
|
||||
OSSpinLockUnlock(&This->stream->lock);
|
||||
return AUDCLNT_E_BUFFER_OPERATION_PENDING;
|
||||
}
|
||||
|
||||
if(This->dataflow == eRender){
|
||||
This->stream->written_frames = 0;
|
||||
}else{
|
||||
This->stream->written_frames += This->stream->held_frames;
|
||||
}
|
||||
|
||||
This->stream->held_frames = 0;
|
||||
This->stream->lcl_offs_frames = 0;
|
||||
This->stream->wri_offs_frames = 0;
|
||||
This->stream->cap_offs_frames = 0;
|
||||
This->stream->cap_held_frames = 0;
|
||||
|
||||
OSSpinLockUnlock(&This->stream->lock);
|
||||
|
||||
return S_OK;
|
||||
params.stream = This->stream;
|
||||
UNIX_CALL(reset, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface,
|
||||
|
|
|
@ -87,6 +87,12 @@ struct stop_params
|
|||
HRESULT result;
|
||||
};
|
||||
|
||||
struct reset_params
|
||||
{
|
||||
struct coreaudio_stream *stream;
|
||||
HRESULT result;
|
||||
};
|
||||
|
||||
struct get_mix_format_params
|
||||
{
|
||||
EDataFlow flow;
|
||||
|
@ -134,6 +140,7 @@ enum unix_funcs
|
|||
unix_release_stream,
|
||||
unix_start,
|
||||
unix_stop,
|
||||
unix_reset,
|
||||
unix_get_mix_format,
|
||||
unix_is_format_supported,
|
||||
unix_get_buffer_size,
|
||||
|
|
Loading…
Reference in New Issue