winecoreaudio: Move get_position to the unixlib.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5ff056f399
commit
46f5083e23
|
@ -1503,6 +1503,30 @@ static NTSTATUS get_next_packet_size(void *args)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS get_position(void *args)
|
||||
{
|
||||
struct get_position_params *params = args;
|
||||
struct coreaudio_stream *stream = params->stream;
|
||||
LARGE_INTEGER stamp, freq;
|
||||
|
||||
OSSpinLockLock(&stream->lock);
|
||||
|
||||
*params->pos = stream->written_frames - stream->held_frames;
|
||||
|
||||
if(stream->share == AUDCLNT_SHAREMODE_SHARED)
|
||||
*params->pos *= stream->fmt->nBlockAlign;
|
||||
|
||||
if(params->qpctime){
|
||||
NtQueryPerformanceCounter(&stamp, &freq);
|
||||
*params->qpctime = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart;
|
||||
}
|
||||
|
||||
OSSpinLockUnlock(&stream->lock);
|
||||
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
unixlib_entry_t __wine_unix_call_funcs[] =
|
||||
{
|
||||
get_endpoint_ids,
|
||||
|
@ -1521,4 +1545,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
|
|||
get_latency,
|
||||
get_current_padding,
|
||||
get_next_packet_size,
|
||||
get_position,
|
||||
};
|
||||
|
|
|
@ -1469,42 +1469,22 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT AudioClock_GetPosition_nolock(ACImpl *This,
|
||||
UINT64 *pos, UINT64 *qpctime)
|
||||
{
|
||||
*pos = This->stream->written_frames - This->stream->held_frames;
|
||||
|
||||
if(This->stream->share == AUDCLNT_SHAREMODE_SHARED)
|
||||
*pos *= This->stream->fmt->nBlockAlign;
|
||||
|
||||
if(qpctime){
|
||||
LARGE_INTEGER stamp, freq;
|
||||
QueryPerformanceCounter(&stamp);
|
||||
QueryPerformanceFrequency(&freq);
|
||||
*qpctime = (stamp.QuadPart * (INT64)10000000) / freq.QuadPart;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
|
||||
UINT64 *qpctime)
|
||||
{
|
||||
ACImpl *This = impl_from_IAudioClock(iface);
|
||||
HRESULT hr;
|
||||
struct get_position_params params;
|
||||
|
||||
TRACE("(%p)->(%p, %p)\n", This, pos, qpctime);
|
||||
|
||||
if(!pos)
|
||||
return E_POINTER;
|
||||
|
||||
OSSpinLockLock(&This->stream->lock);
|
||||
|
||||
hr = AudioClock_GetPosition_nolock(This, pos, qpctime);
|
||||
|
||||
OSSpinLockUnlock(&This->stream->lock);
|
||||
|
||||
return hr;
|
||||
params.stream = This->stream;
|
||||
params.pos = pos;
|
||||
params.qpctime = qpctime;
|
||||
UNIX_CALL(get_position, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioClock_GetCharacteristics(IAudioClock *iface,
|
||||
|
|
|
@ -173,6 +173,14 @@ struct get_next_packet_size_params
|
|||
UINT32 *frames;
|
||||
};
|
||||
|
||||
struct get_position_params
|
||||
{
|
||||
struct coreaudio_stream *stream;
|
||||
HRESULT result;
|
||||
UINT64 *pos;
|
||||
UINT64 *qpctime;
|
||||
};
|
||||
|
||||
enum unix_funcs
|
||||
{
|
||||
unix_get_endpoint_ids,
|
||||
|
@ -191,6 +199,7 @@ enum unix_funcs
|
|||
unix_get_latency,
|
||||
unix_get_current_padding,
|
||||
unix_get_next_packet_size,
|
||||
unix_get_position,
|
||||
};
|
||||
|
||||
extern unixlib_handle_t coreaudio_handle;
|
||||
|
|
Loading…
Reference in New Issue