Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/winealsa.drv/alsa.c | 43 ++++++++++++++++++++---------------- dlls/winealsa.drv/mmdevdrv.c | 6 ++--- dlls/winealsa.drv/unixlib.h | 40 ++++++++++++++++----------------- 3 files changed, 47 insertions(+), 42 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index e5f755b69ed..9cf99f5b459 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -215,6 +215,11 @@ static NTSTATUS alsa_unlock_result(struct alsa_stream *stream, return STATUS_SUCCESS; }
+static struct alsa_stream *handle_get_stream(stream_handle h) +{ + return (struct alsa_stream *)(UINT_PTR)h; +} + static BOOL alsa_try_open(const char *devnode, EDataFlow flow) { snd_pcm_t *handle; @@ -985,7 +990,7 @@ exit: free(stream->vols); free(stream); }else{ - *params->stream = stream; + *params->stream = (stream_handle)(UINT_PTR)stream; }
return STATUS_SUCCESS; @@ -994,7 +999,7 @@ exit: static NTSTATUS release_stream(void *args) { struct release_stream_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); SIZE_T size;
if(params->timer_thread){ @@ -1490,7 +1495,7 @@ static int alsa_rewind_best_effort(struct alsa_stream *stream) static NTSTATUS start(void *args) { struct start_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
@@ -1536,7 +1541,7 @@ static NTSTATUS start(void *args) static NTSTATUS stop(void *args) { struct stop_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
@@ -1554,7 +1559,7 @@ static NTSTATUS stop(void *args) static NTSTATUS reset(void *args) { struct reset_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
@@ -1589,7 +1594,7 @@ static NTSTATUS reset(void *args) static NTSTATUS timer_loop(void *args) { struct timer_loop_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); LARGE_INTEGER delay, next; int adjust;
@@ -1627,7 +1632,7 @@ static NTSTATUS timer_loop(void *args) static NTSTATUS get_render_buffer(void *args) { struct get_render_buffer_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); UINT32 write_pos, frames = params->frames; SIZE_T size;
@@ -1691,7 +1696,7 @@ static void alsa_wrap_buffer(struct alsa_stream *stream, BYTE *buffer, UINT32 wr static NTSTATUS release_render_buffer(void *args) { struct release_render_buffer_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); UINT32 written_frames = params->written_frames; BYTE *buffer;
@@ -1731,7 +1736,7 @@ static NTSTATUS release_render_buffer(void *args) static NTSTATUS get_capture_buffer(void *args) { struct get_capture_buffer_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); UINT32 *frames = params->frames; SIZE_T size;
@@ -1792,7 +1797,7 @@ static NTSTATUS get_capture_buffer(void *args) static NTSTATUS release_capture_buffer(void *args) { struct release_capture_buffer_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); UINT32 done = params->done;
alsa_lock(stream); @@ -2076,7 +2081,7 @@ exit: static NTSTATUS get_buffer_size(void *args) { struct get_buffer_size_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
@@ -2088,7 +2093,7 @@ static NTSTATUS get_buffer_size(void *args) static NTSTATUS get_latency(void *args) { struct get_latency_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
@@ -2109,7 +2114,7 @@ static NTSTATUS get_latency(void *args) static NTSTATUS get_current_padding(void *args) { struct get_current_padding_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
@@ -2122,7 +2127,7 @@ static NTSTATUS get_current_padding(void *args) static NTSTATUS get_next_packet_size(void *args) { struct get_next_packet_size_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
@@ -2134,7 +2139,7 @@ static NTSTATUS get_next_packet_size(void *args) static NTSTATUS get_frequency(void *args) { struct get_frequency_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); UINT64 *freq = params->freq;
alsa_lock(stream); @@ -2150,7 +2155,7 @@ static NTSTATUS get_frequency(void *args) static NTSTATUS get_position(void *args) { struct get_position_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); UINT64 position; snd_pcm_state_t alsa_state;
@@ -2202,7 +2207,7 @@ static NTSTATUS get_position(void *args) static NTSTATUS set_volumes(void *args) { struct set_volumes_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream); unsigned int i;
for(i = 0; i < stream->fmt->nChannels; i++) @@ -2214,7 +2219,7 @@ static NTSTATUS set_volumes(void *args) static NTSTATUS set_event_handle(void *args) { struct set_event_handle_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
@@ -2234,7 +2239,7 @@ static NTSTATUS set_event_handle(void *args) static NTSTATUS is_started(void *args) { struct is_started_params *params = args; - struct alsa_stream *stream = params->stream; + struct alsa_stream *stream = handle_get_stream(params->stream);
alsa_lock(stream);
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 81967f9ffe0..24e778db931 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -99,7 +99,7 @@ struct ACImpl { EDataFlow dataflow; float *vols; UINT32 channel_count; - struct alsa_stream *stream; + stream_handle stream;
HANDLE timer_thread;
@@ -229,7 +229,7 @@ int WINAPI AUDDRV_GetPriority(void) return Priority_Neutral; }
-static HRESULT alsa_stream_release(struct alsa_stream *stream, HANDLE timer_thread) +static HRESULT alsa_stream_release(stream_handle stream, HANDLE timer_thread) { struct release_stream_params params;
@@ -680,7 +680,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, { ACImpl *This = impl_from_IAudioClient3(iface); struct create_stream_params params; - struct alsa_stream *stream; + stream_handle stream; unsigned int i;
TRACE("(%p)->(%x, %x, %s, %s, %p, %s)\n", This, mode, flags, diff --git a/dlls/winealsa.drv/unixlib.h b/dlls/winealsa.drv/unixlib.h index 7d7be1e140d..ed769d81948 100644 --- a/dlls/winealsa.drv/unixlib.h +++ b/dlls/winealsa.drv/unixlib.h @@ -18,7 +18,7 @@
#include "audioclient.h"
-struct alsa_stream; +typedef UINT64 stream_handle;
struct endpoint { @@ -46,42 +46,42 @@ struct create_stream_params REFERENCE_TIME period; const WAVEFORMATEX *fmt; HRESULT result; - struct alsa_stream **stream; + stream_handle *stream; };
struct release_stream_params { - struct alsa_stream *stream; + stream_handle stream; HANDLE timer_thread; HRESULT result; };
struct start_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; };
struct stop_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; };
struct reset_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; };
struct timer_loop_params { - struct alsa_stream *stream; + stream_handle stream; };
struct get_render_buffer_params { - struct alsa_stream *stream; + stream_handle stream; UINT32 frames; HRESULT result; BYTE **data; @@ -89,7 +89,7 @@ struct get_render_buffer_params
struct release_render_buffer_params { - struct alsa_stream *stream; + stream_handle stream; UINT32 written_frames; UINT flags; HRESULT result; @@ -97,7 +97,7 @@ struct release_render_buffer_params
struct get_capture_buffer_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; BYTE **data; UINT32 *frames; @@ -108,7 +108,7 @@ struct get_capture_buffer_params
struct release_capture_buffer_params { - struct alsa_stream *stream; + stream_handle stream; UINT32 done; HRESULT result; }; @@ -133,42 +133,42 @@ struct get_mix_format_params
struct get_buffer_size_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; UINT32 *size; };
struct get_latency_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; REFERENCE_TIME *latency; };
struct get_current_padding_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; UINT32 *padding; };
struct get_next_packet_size_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; UINT32 *frames; };
struct get_frequency_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; UINT64 *freq; };
struct get_position_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; UINT64 *pos; UINT64 *qpctime; @@ -176,7 +176,7 @@ struct get_position_params
struct set_volumes_params { - struct alsa_stream *stream; + stream_handle stream; float master_volume; const float *volumes; const float *session_volumes; @@ -184,14 +184,14 @@ struct set_volumes_params
struct set_event_handle_params { - struct alsa_stream *stream; + stream_handle stream; HANDLE event; HRESULT result; };
struct is_started_params { - struct alsa_stream *stream; + stream_handle stream; HRESULT result; };