Commit 90e9379f authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winecoreaudio: Use UINT64 handles to represent the stream.

parent c66d694c
...@@ -107,6 +107,11 @@ static HRESULT osstatus_to_hresult(OSStatus sc) ...@@ -107,6 +107,11 @@ static HRESULT osstatus_to_hresult(OSStatus sc)
return E_FAIL; return E_FAIL;
} }
static struct coreaudio_stream *handle_get_stream(stream_handle h)
{
return (struct coreaudio_stream *)(UINT_PTR)h;
}
/* copied from kernelbase */ /* copied from kernelbase */
static int muldiv( int a, int b, int c ) static int muldiv( int a, int b, int c )
{ {
...@@ -700,7 +705,7 @@ end: ...@@ -700,7 +705,7 @@ end:
free(stream->fmt); free(stream->fmt);
free(stream); free(stream);
} else } else
*params->stream = stream; *params->stream = (stream_handle)(UINT_PTR)stream;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -708,7 +713,7 @@ end: ...@@ -708,7 +713,7 @@ end:
static NTSTATUS release_stream( void *args ) static NTSTATUS release_stream( void *args )
{ {
struct release_stream_params *params = args; struct release_stream_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
SIZE_T size; SIZE_T size;
if(stream->unit){ if(stream->unit){
...@@ -1148,7 +1153,7 @@ static void capture_resample(struct coreaudio_stream *stream) ...@@ -1148,7 +1153,7 @@ static void capture_resample(struct coreaudio_stream *stream)
static NTSTATUS get_buffer_size(void *args) static NTSTATUS get_buffer_size(void *args)
{ {
struct get_buffer_size_params *params = args; struct get_buffer_size_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
*params->frames = stream->bufsize_frames; *params->frames = stream->bufsize_frames;
...@@ -1212,7 +1217,7 @@ static HRESULT ca_get_max_stream_latency(struct coreaudio_stream *stream, UInt32 ...@@ -1212,7 +1217,7 @@ static HRESULT ca_get_max_stream_latency(struct coreaudio_stream *stream, UInt32
static NTSTATUS get_latency(void *args) static NTSTATUS get_latency(void *args)
{ {
struct get_latency_params *params = args; struct get_latency_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
UInt32 latency, stream_latency, size; UInt32 latency, stream_latency, size;
AudioObjectPropertyAddress addr; AudioObjectPropertyAddress addr;
OSStatus sc; OSStatus sc;
...@@ -1258,7 +1263,7 @@ static UINT32 get_current_padding_nolock(struct coreaudio_stream *stream) ...@@ -1258,7 +1263,7 @@ static UINT32 get_current_padding_nolock(struct coreaudio_stream *stream)
static NTSTATUS get_current_padding(void *args) static NTSTATUS get_current_padding(void *args)
{ {
struct get_current_padding_params *params = args; struct get_current_padding_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
*params->padding = get_current_padding_nolock(stream); *params->padding = get_current_padding_nolock(stream);
...@@ -1270,7 +1275,7 @@ static NTSTATUS get_current_padding(void *args) ...@@ -1270,7 +1275,7 @@ static NTSTATUS get_current_padding(void *args)
static NTSTATUS start(void *args) static NTSTATUS start(void *args)
{ {
struct start_params *params = args; struct start_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
...@@ -1289,7 +1294,7 @@ static NTSTATUS start(void *args) ...@@ -1289,7 +1294,7 @@ static NTSTATUS start(void *args)
static NTSTATUS stop(void *args) static NTSTATUS stop(void *args)
{ {
struct stop_params *params = args; struct stop_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
...@@ -1308,7 +1313,7 @@ static NTSTATUS stop(void *args) ...@@ -1308,7 +1313,7 @@ static NTSTATUS stop(void *args)
static NTSTATUS reset(void *args) static NTSTATUS reset(void *args)
{ {
struct reset_params *params = args; struct reset_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
...@@ -1336,7 +1341,7 @@ static NTSTATUS reset(void *args) ...@@ -1336,7 +1341,7 @@ static NTSTATUS reset(void *args)
static NTSTATUS get_render_buffer(void *args) static NTSTATUS get_render_buffer(void *args)
{ {
struct get_render_buffer_params *params = args; struct get_render_buffer_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
SIZE_T size; SIZE_T size;
UINT32 pad; UINT32 pad;
...@@ -1393,7 +1398,7 @@ end: ...@@ -1393,7 +1398,7 @@ end:
static NTSTATUS release_render_buffer(void *args) static NTSTATUS release_render_buffer(void *args)
{ {
struct release_render_buffer_params *params = args; struct release_render_buffer_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
BYTE *buffer; BYTE *buffer;
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
...@@ -1437,7 +1442,7 @@ static NTSTATUS release_render_buffer(void *args) ...@@ -1437,7 +1442,7 @@ static NTSTATUS release_render_buffer(void *args)
static NTSTATUS get_capture_buffer(void *args) static NTSTATUS get_capture_buffer(void *args)
{ {
struct get_capture_buffer_params *params = args; struct get_capture_buffer_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
UINT32 chunk_bytes, chunk_frames; UINT32 chunk_bytes, chunk_frames;
LARGE_INTEGER stamp, freq; LARGE_INTEGER stamp, freq;
SIZE_T size; SIZE_T size;
...@@ -1493,7 +1498,7 @@ end: ...@@ -1493,7 +1498,7 @@ end:
static NTSTATUS release_capture_buffer(void *args) static NTSTATUS release_capture_buffer(void *args)
{ {
struct release_capture_buffer_params *params = args; struct release_capture_buffer_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
...@@ -1521,7 +1526,7 @@ static NTSTATUS release_capture_buffer(void *args) ...@@ -1521,7 +1526,7 @@ static NTSTATUS release_capture_buffer(void *args)
static NTSTATUS get_next_packet_size(void *args) static NTSTATUS get_next_packet_size(void *args)
{ {
struct get_next_packet_size_params *params = args; struct get_next_packet_size_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
...@@ -1541,7 +1546,7 @@ static NTSTATUS get_next_packet_size(void *args) ...@@ -1541,7 +1546,7 @@ static NTSTATUS get_next_packet_size(void *args)
static NTSTATUS get_position(void *args) static NTSTATUS get_position(void *args)
{ {
struct get_position_params *params = args; struct get_position_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
LARGE_INTEGER stamp, freq; LARGE_INTEGER stamp, freq;
OSSpinLockLock(&stream->lock); OSSpinLockLock(&stream->lock);
...@@ -1565,7 +1570,7 @@ static NTSTATUS get_position(void *args) ...@@ -1565,7 +1570,7 @@ static NTSTATUS get_position(void *args)
static NTSTATUS get_frequency(void *args) static NTSTATUS get_frequency(void *args)
{ {
struct get_frequency_params *params = args; struct get_frequency_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
if(stream->share == AUDCLNT_SHAREMODE_SHARED) if(stream->share == AUDCLNT_SHAREMODE_SHARED)
*params->freq = (UINT64)stream->fmt->nSamplesPerSec * stream->fmt->nBlockAlign; *params->freq = (UINT64)stream->fmt->nSamplesPerSec * stream->fmt->nBlockAlign;
...@@ -1579,7 +1584,7 @@ static NTSTATUS get_frequency(void *args) ...@@ -1579,7 +1584,7 @@ static NTSTATUS get_frequency(void *args)
static NTSTATUS is_started(void *args) static NTSTATUS is_started(void *args)
{ {
struct is_started_params *params = args; struct is_started_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
if(stream->playing) if(stream->playing)
params->result = S_OK; params->result = S_OK;
...@@ -1592,7 +1597,7 @@ static NTSTATUS is_started(void *args) ...@@ -1592,7 +1597,7 @@ static NTSTATUS is_started(void *args)
static NTSTATUS set_volumes(void *args) static NTSTATUS set_volumes(void *args)
{ {
struct set_volumes_params *params = args; struct set_volumes_params *params = args;
struct coreaudio_stream *stream = params->stream; struct coreaudio_stream *stream = handle_get_stream(params->stream);
Float32 level = 1.0, tmp; Float32 level = 1.0, tmp;
OSStatus sc; OSStatus sc;
UINT32 i; UINT32 i;
......
...@@ -103,7 +103,7 @@ struct ACImpl { ...@@ -103,7 +103,7 @@ struct ACImpl {
AudioSession *session; AudioSession *session;
AudioSessionWrapper *session_wrapper; AudioSessionWrapper *session_wrapper;
struct coreaudio_stream *stream; stream_handle stream;
struct list entry; struct list entry;
}; };
...@@ -666,7 +666,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, ...@@ -666,7 +666,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
ACImpl *This = impl_from_IAudioClient3(iface); ACImpl *This = impl_from_IAudioClient3(iface);
struct release_stream_params release_params; struct release_stream_params release_params;
struct create_stream_params params; struct create_stream_params params;
struct coreaudio_stream *stream; stream_handle stream;
UINT32 i; UINT32 i;
TRACE("(%p)->(%x, %x, %s, %s, %p, %s)\n", This, mode, flags, TRACE("(%p)->(%x, %x, %s, %s, %p, %s)\n", This, mode, flags,
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
#include "mmddk.h" #include "mmddk.h"
struct coreaudio_stream; typedef UINT64 stream_handle;
struct endpoint struct endpoint
{ {
...@@ -46,36 +46,36 @@ struct create_stream_params ...@@ -46,36 +46,36 @@ struct create_stream_params
REFERENCE_TIME period; REFERENCE_TIME period;
const WAVEFORMATEX *fmt; const WAVEFORMATEX *fmt;
HRESULT result; HRESULT result;
struct coreaudio_stream **stream; stream_handle *stream;
}; };
struct release_stream_params struct release_stream_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
}; };
struct start_params struct start_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
}; };
struct stop_params struct stop_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
}; };
struct reset_params struct reset_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
}; };
struct get_render_buffer_params struct get_render_buffer_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
UINT32 frames; UINT32 frames;
HRESULT result; HRESULT result;
BYTE **data; BYTE **data;
...@@ -83,7 +83,7 @@ struct get_render_buffer_params ...@@ -83,7 +83,7 @@ struct get_render_buffer_params
struct release_render_buffer_params struct release_render_buffer_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
UINT32 frames; UINT32 frames;
DWORD flags; DWORD flags;
HRESULT result; HRESULT result;
...@@ -91,7 +91,7 @@ struct release_render_buffer_params ...@@ -91,7 +91,7 @@ struct release_render_buffer_params
struct get_capture_buffer_params struct get_capture_buffer_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
BYTE **data; BYTE **data;
UINT32 *frames; UINT32 *frames;
...@@ -102,7 +102,7 @@ struct get_capture_buffer_params ...@@ -102,7 +102,7 @@ struct get_capture_buffer_params
struct release_capture_buffer_params struct release_capture_buffer_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
UINT32 done; UINT32 done;
HRESULT result; HRESULT result;
}; };
...@@ -127,35 +127,35 @@ struct is_format_supported_params ...@@ -127,35 +127,35 @@ struct is_format_supported_params
struct get_buffer_size_params struct get_buffer_size_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
UINT32 *frames; UINT32 *frames;
}; };
struct get_latency_params struct get_latency_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
REFERENCE_TIME *latency; REFERENCE_TIME *latency;
}; };
struct get_current_padding_params struct get_current_padding_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
UINT32 *padding; UINT32 *padding;
}; };
struct get_next_packet_size_params struct get_next_packet_size_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
UINT32 *frames; UINT32 *frames;
}; };
struct get_position_params struct get_position_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
UINT64 *pos; UINT64 *pos;
UINT64 *qpctime; UINT64 *qpctime;
...@@ -163,20 +163,20 @@ struct get_position_params ...@@ -163,20 +163,20 @@ struct get_position_params
struct get_frequency_params struct get_frequency_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
UINT64 *freq; UINT64 *freq;
}; };
struct is_started_params struct is_started_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
HRESULT result; HRESULT result;
}; };
struct set_volumes_params struct set_volumes_params
{ {
struct coreaudio_stream *stream; stream_handle stream;
float master_volume; float master_volume;
const float *volumes; const float *volumes;
const float *session_volumes; const float *session_volumes;
......
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