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@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-05-24 18:21:56 +02:00 committed by Alexandre Julliard
parent bf74f36350
commit aba40bd50a
3 changed files with 40 additions and 30 deletions

View File

@ -1611,7 +1611,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface,
goto out; goto out;
} }
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) { 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; *state = AudioSessionStateActive;
goto out; goto out;
} }

View File

@ -43,6 +43,36 @@
WINE_DEFAULT_DEBUG_CHANNEL(pulse); 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 typedef struct _ACPacket
{ {
struct list entry; struct list entry;
@ -1770,6 +1800,11 @@ static HRESULT WINAPI pulse_set_event_handle(struct pulse_stream *stream, HANDLE
return hr; 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 = static const struct unix_funcs unix_funcs =
{ {
pulse_lock, pulse_lock,
@ -1795,6 +1830,7 @@ static const struct unix_funcs unix_funcs =
pulse_set_volumes, pulse_set_volumes,
pulse_set_event_handle, pulse_set_event_handle,
pulse_test_connect, pulse_test_connect,
pulse_is_started,
}; };
NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out) NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out)

View File

@ -18,6 +18,8 @@
#include "wine/list.h" #include "wine/list.h"
struct pulse_stream;
struct pulse_config struct pulse_config
{ {
struct struct
@ -29,35 +31,6 @@ struct pulse_config
unsigned int speakers_mask; 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 struct unix_funcs
{ {
void (WINAPI *lock)(void); void (WINAPI *lock)(void);
@ -89,4 +62,5 @@ struct unix_funcs
const float *volumes, const float *session_volumes); const float *volumes, const float *session_volumes);
HRESULT (WINAPI *set_event_handle)(struct pulse_stream *stream, HANDLE event); HRESULT (WINAPI *set_event_handle)(struct pulse_stream *stream, HANDLE event);
HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config); HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);
BOOL (WINAPI *is_started)(struct pulse_stream *stream);
}; };