Jacek Caban : winepulse: Move pulse_is_started to unix lib.
Alexandre Julliard
julliard at winehq.org
Tue May 25 16:08:15 CDT 2021
Module: wine
Branch: master
Commit: aba40bd50a065b3ac913dbc1263c38535fb5d9e7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=aba40bd50a065b3ac913dbc1263c38535fb5d9e7
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon May 24 18:21:56 2021 +0200
winepulse: Move pulse_is_started to unix lib.
And move pulse_stream to pulse.c since it's accessed only from unix lib now.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winepulse.drv/mmdevdrv.c | 2 +-
dlls/winepulse.drv/pulse.c | 36 ++++++++++++++++++++++++++++++++++++
dlls/winepulse.drv/unixlib.h | 32 +++-----------------------------
3 files changed, 40 insertions(+), 30 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 8e717f9d18f..cac169567ea 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -1611,7 +1611,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface,
goto out;
}
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) {
- if (client->pulse_stream->started) {
+ if (client->pulse_stream && pulse->is_started(client->pulse_stream)) {
*state = AudioSessionStateActive;
goto out;
}
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c
index 063c92605b6..05e1dacd68e 100644
--- a/dlls/winepulse.drv/pulse.c
+++ b/dlls/winepulse.drv/pulse.c
@@ -43,6 +43,36 @@
WINE_DEFAULT_DEBUG_CHANNEL(pulse);
+struct pulse_stream
+{
+ EDataFlow dataflow;
+
+ pa_stream *stream;
+ pa_sample_spec ss;
+ pa_channel_map map;
+ pa_buffer_attr attr;
+
+ DWORD flags;
+ AUDCLNT_SHAREMODE share;
+ HANDLE event;
+ float vol[PA_CHANNELS_MAX];
+ BOOL mute;
+
+ INT32 locked;
+ UINT32 bufsize_frames, real_bufsize_bytes, period_bytes;
+ UINT32 started, peek_ofs, read_offs_bytes, lcl_offs_bytes, pa_offs_bytes;
+ UINT32 tmp_buffer_bytes, held_bytes, peek_len, peek_buffer_len, pa_held_bytes;
+ BYTE *local_buffer, *tmp_buffer, *peek_buffer;
+ void *locked_ptr;
+ BOOL please_quit, just_started, just_underran;
+ pa_usec_t last_time, mmdev_period_usec;
+
+ INT64 clock_lastpos, clock_written;
+
+ struct list packet_free_head;
+ struct list packet_filled_head;
+};
+
typedef struct _ACPacket
{
struct list entry;
@@ -1770,6 +1800,11 @@ static HRESULT WINAPI pulse_set_event_handle(struct pulse_stream *stream, HANDLE
return hr;
}
+static BOOL WINAPI pulse_is_started(struct pulse_stream *stream)
+{
+ return pulse_stream_valid(stream) && stream->started;
+}
+
static const struct unix_funcs unix_funcs =
{
pulse_lock,
@@ -1795,6 +1830,7 @@ static const struct unix_funcs unix_funcs =
pulse_set_volumes,
pulse_set_event_handle,
pulse_test_connect,
+ pulse_is_started,
};
NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)
diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h
index f1546d42d76..13793c734cd 100644
--- a/dlls/winepulse.drv/unixlib.h
+++ b/dlls/winepulse.drv/unixlib.h
@@ -18,6 +18,8 @@
#include "wine/list.h"
+struct pulse_stream;
+
struct pulse_config
{
struct
@@ -29,35 +31,6 @@ struct pulse_config
unsigned int speakers_mask;
};
-struct pulse_stream
-{
- EDataFlow dataflow;
-
- pa_stream *stream;
- pa_sample_spec ss;
- pa_channel_map map;
- pa_buffer_attr attr;
-
- DWORD flags;
- AUDCLNT_SHAREMODE share;
- HANDLE event;
- float vol[PA_CHANNELS_MAX];
-
- INT32 locked;
- UINT32 bufsize_frames, real_bufsize_bytes, period_bytes;
- UINT32 started, peek_ofs, read_offs_bytes, lcl_offs_bytes, pa_offs_bytes;
- UINT32 tmp_buffer_bytes, held_bytes, peek_len, peek_buffer_len, pa_held_bytes;
- BYTE *local_buffer, *tmp_buffer, *peek_buffer;
- void *locked_ptr;
- BOOL please_quit, just_started, just_underran;
- pa_usec_t last_time, mmdev_period_usec;
-
- INT64 clock_lastpos, clock_written;
-
- struct list packet_free_head;
- struct list packet_filled_head;
-};
-
struct unix_funcs
{
void (WINAPI *lock)(void);
@@ -89,4 +62,5 @@ struct unix_funcs
const float *volumes, const float *session_volumes);
HRESULT (WINAPI *set_event_handle)(struct pulse_stream *stream, HANDLE event);
HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);
+ BOOL (WINAPI *is_started)(struct pulse_stream *stream);
};
More information about the wine-cvs
mailing list