2021-05-11 18:29:38 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2021 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2021-05-11 18:31:24 +02:00
|
|
|
#include "wine/list.h"
|
|
|
|
|
2021-05-11 18:30:00 +02:00
|
|
|
struct pulse_config
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
WAVEFORMATEXTENSIBLE format;
|
|
|
|
REFERENCE_TIME def_period;
|
|
|
|
REFERENCE_TIME min_period;
|
|
|
|
} modes[2];
|
|
|
|
unsigned int speakers_mask;
|
|
|
|
};
|
|
|
|
|
2021-05-11 18:31:24 +02:00
|
|
|
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;
|
2021-05-13 16:03:38 +02:00
|
|
|
float vol[PA_CHANNELS_MAX];
|
2021-05-11 18:31:24 +02:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2021-05-11 18:29:38 +02:00
|
|
|
struct unix_funcs
|
|
|
|
{
|
|
|
|
void (WINAPI *lock)(void);
|
|
|
|
void (WINAPI *unlock)(void);
|
|
|
|
int (WINAPI *cond_wait)(void);
|
2021-05-11 18:30:17 +02:00
|
|
|
void (WINAPI *main_loop)(void);
|
2021-05-11 18:31:45 +02:00
|
|
|
HRESULT (WINAPI *create_stream)(const char *name, EDataFlow dataflow, AUDCLNT_SHAREMODE mode,
|
|
|
|
DWORD flags, REFERENCE_TIME duration, REFERENCE_TIME period,
|
|
|
|
const WAVEFORMATEX *fmt, UINT32 *channel_count,
|
|
|
|
struct pulse_stream **ret);
|
2021-05-11 18:31:34 +02:00
|
|
|
void (WINAPI *release_stream)(struct pulse_stream *stream, HANDLE timer);
|
2021-05-18 16:57:18 +02:00
|
|
|
HRESULT (WINAPI *start)(struct pulse_stream *stream);
|
2021-05-13 16:03:29 +02:00
|
|
|
HRESULT (WINAPI *stop)(struct pulse_stream *stream);
|
2021-05-18 16:58:48 +02:00
|
|
|
HRESULT (WINAPI *reset)(struct pulse_stream *stream);
|
2021-05-13 16:05:06 +02:00
|
|
|
void (WINAPI *timer_loop)(struct pulse_stream *stream);
|
2021-05-18 16:58:55 +02:00
|
|
|
HRESULT (WINAPI *get_render_buffer)(struct pulse_stream *stream, UINT32 frames, BYTE **data);
|
2021-05-18 16:59:03 +02:00
|
|
|
HRESULT (WINAPI *release_render_buffer)(struct pulse_stream *stream, UINT32 written_frames,
|
|
|
|
DWORD flags);
|
2021-05-19 22:27:00 +02:00
|
|
|
HRESULT (WINAPI *get_capture_buffer)(struct pulse_stream *stream, BYTE **data, UINT32 *frames,
|
|
|
|
DWORD *flags, UINT64 *devpos, UINT64 *qpcpos);
|
2021-05-19 22:27:08 +02:00
|
|
|
HRESULT (WINAPI *release_capture_buffer)(struct pulse_stream *stream, BOOL done);
|
2021-05-19 22:24:02 +02:00
|
|
|
HRESULT (WINAPI *get_buffer_size)(struct pulse_stream *stream, UINT32 *out);
|
2021-05-19 22:24:13 +02:00
|
|
|
HRESULT (WINAPI *get_latency)(struct pulse_stream *stream, REFERENCE_TIME *latency);
|
2021-05-19 22:24:23 +02:00
|
|
|
HRESULT (WINAPI *get_current_padding)(struct pulse_stream *stream, UINT32 *out);
|
2021-05-19 22:27:30 +02:00
|
|
|
HRESULT (WINAPI *get_next_packet_size)(struct pulse_stream *stream, UINT32 *frames);
|
2021-05-19 22:27:36 +02:00
|
|
|
HRESULT (WINAPI *get_frequency)(struct pulse_stream *stream, UINT64 *freq);
|
2021-05-24 18:21:49 +02:00
|
|
|
HRESULT (WINAPI *get_position)(struct pulse_stream *stream, BOOL device, UINT64 *pos, UINT64 *qpctime);
|
2021-05-13 16:03:58 +02:00
|
|
|
void (WINAPI *set_volumes)(struct pulse_stream *stream, float master_volume,
|
2021-05-13 16:04:14 +02:00
|
|
|
const float *volumes, const float *session_volumes);
|
2021-05-18 16:59:16 +02:00
|
|
|
HRESULT (WINAPI *set_event_handle)(struct pulse_stream *stream, HANDLE event);
|
2021-05-11 18:30:00 +02:00
|
|
|
HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);
|
2021-05-11 18:29:38 +02:00
|
|
|
};
|