Huw Davies : winecoreaudio: Move reset to the unixlib.
Alexandre Julliard
julliard at winehq.org
Tue Nov 23 16:03:30 CST 2021
Module: wine
Branch: master
Commit: 5e97e50e95ef204f64e7473f6eebe60a794938a7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5e97e50e95ef204f64e7473f6eebe60a794938a7
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Nov 23 07:55:05 2021 +0000
winecoreaudio: Move reset to the unixlib.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winecoreaudio.drv/coreaudio.c | 29 +++++++++++++++++++++++++++++
dlls/winecoreaudio.drv/mmdevdrv.c | 31 ++++---------------------------
dlls/winecoreaudio.drv/unixlib.h | 7 +++++++
3 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c
index 5a49a786f48..ee34cd29de1 100644
--- a/dlls/winecoreaudio.drv/coreaudio.c
+++ b/dlls/winecoreaudio.drv/coreaudio.c
@@ -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,
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c
index e214a85c0d3..cf2c23a0f40 100644
--- a/dlls/winecoreaudio.drv/mmdevdrv.c
+++ b/dlls/winecoreaudio.drv/mmdevdrv.c
@@ -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,
diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h
index c3da84c2c7a..450293052c7 100644
--- a/dlls/winecoreaudio.drv/unixlib.h
+++ b/dlls/winecoreaudio.drv/unixlib.h
@@ -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,
More information about the wine-cvs
mailing list