Commit 94d3e2b3 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winepulse: Use UINT64 handles to represent the stream.

parent 457291c7
......@@ -156,7 +156,7 @@ struct ACImpl {
UINT32 channel_count;
HANDLE timer;
struct pulse_stream *pulse_stream;
stream_handle pulse_stream;
AudioSession *session;
AudioSessionWrapper *session_wrapper;
......@@ -228,7 +228,7 @@ static void pulse_call(enum unix_funcs code, void *params)
assert(!status);
}
static void pulse_release_stream(struct pulse_stream *stream, HANDLE timer)
static void pulse_release_stream(stream_handle stream, HANDLE timer)
{
struct release_stream_params params;
params.stream = stream;
......@@ -668,7 +668,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface)
if (!ref) {
if (This->pulse_stream) {
pulse_release_stream(This->pulse_stream, This->timer);
This->pulse_stream = NULL;
This->pulse_stream = 0;
EnterCriticalSection(&session_cs);
list_remove(&This->entry);
LeaveCriticalSection(&session_cs);
......@@ -822,7 +822,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
ACImpl *This = impl_from_IAudioClient3(iface);
struct create_stream_params params;
unsigned int i, channel_count;
struct pulse_stream *stream;
stream_handle stream;
char *name;
HRESULT hr;
......
......@@ -131,6 +131,11 @@ static void pulse_broadcast(void)
pthread_cond_broadcast(&pulse_cond);
}
static struct pulse_stream *handle_get_stream(stream_handle h)
{
return (struct pulse_stream *)(UINT_PTR)h;
}
static void dump_attr(const pa_buffer_attr *attr)
{
TRACE("maxlength: %u\n", attr->maxlength);
......@@ -1067,7 +1072,7 @@ static NTSTATUS pulse_create_stream(void *args)
}
*params->channel_count = stream->ss.channels;
*params->stream = stream;
*params->stream = (stream_handle)(UINT_PTR)stream;
exit:
if (FAILED(params->result = hr)) {
......@@ -1086,7 +1091,7 @@ exit:
static NTSTATUS pulse_release_stream(void *args)
{
struct release_stream_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
SIZE_T size;
if(params->timer) {
......@@ -1407,7 +1412,7 @@ static void pulse_read(struct pulse_stream *stream)
static NTSTATUS pulse_timer_loop(void *args)
{
struct timer_loop_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
LARGE_INTEGER delay;
pa_usec_t last_time;
UINT32 adv_bytes;
......@@ -1515,7 +1520,7 @@ static NTSTATUS pulse_timer_loop(void *args)
static NTSTATUS pulse_start(void *args)
{
struct start_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
int success;
pa_operation *o;
......@@ -1571,7 +1576,7 @@ static NTSTATUS pulse_start(void *args)
static NTSTATUS pulse_stop(void *args)
{
struct stop_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
pa_operation *o;
int success;
......@@ -1614,7 +1619,7 @@ static NTSTATUS pulse_stop(void *args)
static NTSTATUS pulse_reset(void *args)
{
struct reset_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
pulse_lock();
if (!pulse_stream_valid(stream))
......@@ -1720,7 +1725,7 @@ static UINT32 pulse_capture_padding(struct pulse_stream *stream)
static NTSTATUS pulse_get_render_buffer(void *args)
{
struct get_render_buffer_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
size_t bytes;
UINT32 wri_offs_bytes;
......@@ -1799,7 +1804,7 @@ static void pulse_wrap_buffer(struct pulse_stream *stream, BYTE *buffer, UINT32
static NTSTATUS pulse_release_render_buffer(void *args)
{
struct release_render_buffer_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
UINT32 written_bytes;
BYTE *buffer;
......@@ -1856,7 +1861,7 @@ static NTSTATUS pulse_release_render_buffer(void *args)
static NTSTATUS pulse_get_capture_buffer(void *args)
{
struct get_capture_buffer_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
ACPacket *packet;
pulse_lock();
......@@ -1902,7 +1907,7 @@ static NTSTATUS pulse_get_capture_buffer(void *args)
static NTSTATUS pulse_release_capture_buffer(void *args)
{
struct release_capture_buffer_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
pulse_lock();
if (!stream->locked && params->done)
......@@ -1937,14 +1942,15 @@ static NTSTATUS pulse_release_capture_buffer(void *args)
static NTSTATUS pulse_get_buffer_size(void *args)
{
struct get_buffer_size_params *params = args;
struct pulse_stream *stream = handle_get_stream(params->stream);
params->result = S_OK;
pulse_lock();
if (!pulse_stream_valid(params->stream))
if (!pulse_stream_valid(stream))
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
else
*params->size = params->stream->bufsize_frames;
*params->size = stream->bufsize_frames;
pulse_unlock();
return STATUS_SUCCESS;
......@@ -1953,7 +1959,7 @@ static NTSTATUS pulse_get_buffer_size(void *args)
static NTSTATUS pulse_get_latency(void *args)
{
struct get_latency_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
const pa_buffer_attr *attr;
REFERENCE_TIME lat;
......@@ -1978,7 +1984,7 @@ static NTSTATUS pulse_get_latency(void *args)
static NTSTATUS pulse_get_current_padding(void *args)
{
struct get_current_padding_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
pulse_lock();
if (!pulse_stream_valid(stream))
......@@ -2003,7 +2009,7 @@ static NTSTATUS pulse_get_current_padding(void *args)
static NTSTATUS pulse_get_next_packet_size(void *args)
{
struct get_next_packet_size_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
pulse_lock();
pulse_capture_padding(stream);
......@@ -2020,7 +2026,7 @@ static NTSTATUS pulse_get_next_packet_size(void *args)
static NTSTATUS pulse_get_frequency(void *args)
{
struct get_frequency_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
pulse_lock();
if (!pulse_stream_valid(stream))
......@@ -2041,7 +2047,7 @@ static NTSTATUS pulse_get_frequency(void *args)
static NTSTATUS pulse_get_position(void *args)
{
struct get_position_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
pulse_lock();
if (!pulse_stream_valid(stream))
......@@ -2079,7 +2085,7 @@ static NTSTATUS pulse_get_position(void *args)
static NTSTATUS pulse_set_volumes(void *args)
{
struct set_volumes_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
unsigned int i;
for (i = 0; i < stream->ss.channels; i++)
......@@ -2091,7 +2097,7 @@ static NTSTATUS pulse_set_volumes(void *args)
static NTSTATUS pulse_set_event_handle(void *args)
{
struct set_event_handle_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
HRESULT hr = S_OK;
pulse_lock();
......@@ -2112,7 +2118,7 @@ static NTSTATUS pulse_set_event_handle(void *args)
static NTSTATUS pulse_is_started(void *args)
{
struct is_started_params *params = args;
struct pulse_stream *stream = params->stream;
struct pulse_stream *stream = handle_get_stream(params->stream);
pulse_lock();
params->started = pulse_stream_valid(stream) && stream->started;
......
......@@ -21,7 +21,7 @@
#define MAX_PULSE_NAME_LEN 256
struct pulse_stream;
typedef UINT64 stream_handle;
enum phys_device_bus_type {
phys_device_bus_invalid = -1,
......@@ -71,42 +71,42 @@ struct create_stream_params
const WAVEFORMATEX *fmt;
HRESULT result;
UINT32 *channel_count;
struct pulse_stream **stream;
stream_handle *stream;
};
struct release_stream_params
{
struct pulse_stream *stream;
stream_handle stream;
HANDLE timer;
HRESULT result;
};
struct start_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
};
struct stop_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
};
struct reset_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
};
struct timer_loop_params
{
struct pulse_stream *stream;
stream_handle stream;
};
struct get_render_buffer_params
{
struct pulse_stream *stream;
stream_handle stream;
UINT32 frames;
HRESULT result;
BYTE **data;
......@@ -114,7 +114,7 @@ struct get_render_buffer_params
struct release_render_buffer_params
{
struct pulse_stream *stream;
stream_handle stream;
UINT32 written_frames;
DWORD flags;
HRESULT result;
......@@ -122,7 +122,7 @@ struct release_render_buffer_params
struct get_capture_buffer_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
BYTE **data;
UINT32 *frames;
......@@ -133,49 +133,49 @@ struct get_capture_buffer_params
struct release_capture_buffer_params
{
struct pulse_stream *stream;
stream_handle stream;
BOOL done;
HRESULT result;
};
struct get_buffer_size_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
UINT32 *size;
};
struct get_latency_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
REFERENCE_TIME *latency;
};
struct get_current_padding_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
UINT32 *padding;
};
struct get_next_packet_size_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
UINT32 *frames;
};
struct get_frequency_params
{
struct pulse_stream *stream;
stream_handle stream;
HRESULT result;
UINT64 *freq;
};
struct get_position_params
{
struct pulse_stream *stream;
stream_handle stream;
BOOL device;
HRESULT result;
UINT64 *pos;
......@@ -184,7 +184,7 @@ struct get_position_params
struct set_volumes_params
{
struct pulse_stream *stream;
stream_handle stream;
float master_volume;
const float *volumes;
const float *session_volumes;
......@@ -192,7 +192,7 @@ struct set_volumes_params
struct set_event_handle_params
{
struct pulse_stream *stream;
stream_handle stream;
HANDLE event;
HRESULT result;
};
......@@ -206,7 +206,7 @@ struct test_connect_params
struct is_started_params
{
struct pulse_stream *stream;
stream_handle stream;
BOOL started;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment