[PATCH 7/8] wineoss: Move stop to the unixlib.

Huw Davies huw at codeweavers.com
Wed Apr 13 01:38:50 CDT 2022


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/wineoss.drv/mmdevdrv.c | 17 ++++-------------
 dlls/wineoss.drv/oss.c      | 17 +++++++++++++++++
 dlls/wineoss.drv/unixlib.h  |  7 +++++++
 3 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
index e50a7b32338..75661f917cc 100644
--- a/dlls/wineoss.drv/mmdevdrv.c
+++ b/dlls/wineoss.drv/mmdevdrv.c
@@ -961,26 +961,17 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
 static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
 {
     ACImpl *This = impl_from_IAudioClient3(iface);
-    struct oss_stream *stream = This->stream;
+    struct stop_params params;
 
     TRACE("(%p)\n", This);
 
     if(!This->stream)
         return AUDCLNT_E_NOT_INITIALIZED;
 
-    oss_lock(stream);
-
-    if(!stream->playing){
-        oss_unlock(stream);
-        return S_FALSE;
-    }
-
-    stream->playing = FALSE;
-    stream->in_oss_frames = 0;
-
-    oss_unlock(stream);
+    params.stream = This->stream;
+    OSS_CALL(stop, &params);
 
-    return S_OK;
+    return params.result;
 }
 
 static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface)
diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c
index 241b6d014ec..bcd07c2d2fc 100644
--- a/dlls/wineoss.drv/oss.c
+++ b/dlls/wineoss.drv/oss.c
@@ -645,6 +645,22 @@ static NTSTATUS start(void *args)
     return oss_unlock_result(stream, &params->result, S_OK);
 }
 
+static NTSTATUS stop(void *args)
+{
+    struct stop_params *params = args;
+    struct oss_stream *stream = params->stream;
+
+    oss_lock(stream);
+
+    if(!stream->playing)
+        return oss_unlock_result(stream, &params->result, S_FALSE);
+
+    stream->playing = FALSE;
+    stream->in_oss_frames = 0;
+
+    return oss_unlock_result(stream, &params->result, S_OK);
+}
+
 static void silence_buffer(struct oss_stream *stream, BYTE *buffer, UINT32 frames)
 {
     WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)stream->fmt;
@@ -1008,6 +1024,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
     create_stream,
     release_stream,
     start,
+    stop,
     timer_loop,
     is_format_supported,
     get_mix_format,
diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h
index 7418261282d..c69ef1c3e4b 100644
--- a/dlls/wineoss.drv/unixlib.h
+++ b/dlls/wineoss.drv/unixlib.h
@@ -96,6 +96,12 @@ struct start_params
     HRESULT result;
 };
 
+struct stop_params
+{
+    struct oss_stream *stream;
+    HRESULT result;
+};
+
 struct timer_loop_params
 {
     struct oss_stream *stream;
@@ -147,6 +153,7 @@ enum oss_funcs
     oss_create_stream,
     oss_release_stream,
     oss_start,
+    oss_stop,
     oss_timer_loop,
     oss_is_format_supported,
     oss_get_mix_format,
-- 
2.25.1




More information about the wine-devel mailing list