Huw Davies : winecoreaudio: Move stop to the unixlib.

Alexandre Julliard julliard at winehq.org
Tue Nov 23 16:03:30 CST 2021


Module: wine
Branch: master
Commit: ac960ef94d08b86a8b6a62ac57f668c91853346a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ac960ef94d08b86a8b6a62ac57f668c91853346a

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Nov 23 07:55:04 2021 +0000

winecoreaudio: Move stop 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 | 20 ++++++++++++++++++++
 dlls/winecoreaudio.drv/mmdevdrv.c  | 16 ++++------------
 dlls/winecoreaudio.drv/unixlib.h   |  7 +++++++
 3 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c
index 133ab3da124..5a49a786f48 100644
--- a/dlls/winecoreaudio.drv/coreaudio.c
+++ b/dlls/winecoreaudio.drv/coreaudio.c
@@ -1256,12 +1256,32 @@ static NTSTATUS start(void *args)
     return STATUS_SUCCESS;
 }
 
+static NTSTATUS stop(void *args)
+{
+    struct stop_params *params = args;
+    struct coreaudio_stream *stream = params->stream;
+
+    OSSpinLockLock(&stream->lock);
+
+    if(!stream->playing)
+        params->result = S_FALSE;
+    else{
+        stream->playing = FALSE;
+        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,
+    stop,
     get_mix_format,
     is_format_supported,
     get_buffer_size,
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c
index 30858931338..e214a85c0d3 100644
--- a/dlls/winecoreaudio.drv/mmdevdrv.c
+++ b/dlls/winecoreaudio.drv/mmdevdrv.c
@@ -1026,24 +1026,16 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
 static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
 {
     ACImpl *This = impl_from_IAudioClient3(iface);
+    struct stop_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 S_FALSE;
-    }
-
-    This->stream->playing = FALSE;
-
-    OSSpinLockUnlock(&This->stream->lock);
-
-    return S_OK;
+    params.stream = This->stream;
+    UNIX_CALL(stop, &params);
+    return params.result;
 }
 
 static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface)
diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h
index b4e9e5bf950..c3da84c2c7a 100644
--- a/dlls/winecoreaudio.drv/unixlib.h
+++ b/dlls/winecoreaudio.drv/unixlib.h
@@ -81,6 +81,12 @@ struct start_params
     HRESULT result;
 };
 
+struct stop_params
+{
+    struct coreaudio_stream *stream;
+    HRESULT result;
+};
+
 struct get_mix_format_params
 {
     EDataFlow flow;
@@ -127,6 +133,7 @@ enum unix_funcs
     unix_create_stream,
     unix_release_stream,
     unix_start,
+    unix_stop,
     unix_get_mix_format,
     unix_is_format_supported,
     unix_get_buffer_size,




More information about the wine-cvs mailing list