winecoreaudio: Move get_current_padding 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
881e0f18fb
commit
2dd83eed7b
|
@ -1219,6 +1219,24 @@ static NTSTATUS get_latency(void *args)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT32 get_current_padding_nolock(struct coreaudio_stream *stream)
|
||||
{
|
||||
if(stream->flow == eCapture) capture_resample(stream);
|
||||
return stream->held_frames;
|
||||
}
|
||||
|
||||
static NTSTATUS get_current_padding(void *args)
|
||||
{
|
||||
struct get_current_padding_params *params = args;
|
||||
struct coreaudio_stream *stream = params->stream;
|
||||
|
||||
if(params->lock) OSSpinLockLock(&stream->lock);
|
||||
*params->padding = get_current_padding_nolock(stream);
|
||||
if(params->lock) OSSpinLockUnlock(&stream->lock);
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
unixlib_entry_t __wine_unix_call_funcs[] =
|
||||
{
|
||||
get_endpoint_ids,
|
||||
|
@ -1228,6 +1246,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
|
|||
is_format_supported,
|
||||
get_buffer_size,
|
||||
get_latency,
|
||||
get_current_padding,
|
||||
|
||||
capture_resample /* temporary */
|
||||
};
|
||||
|
|
|
@ -874,22 +874,23 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
|
|||
static HRESULT AudioClient_GetCurrentPadding_nolock(ACImpl *This,
|
||||
UINT32 *numpad)
|
||||
{
|
||||
struct get_current_padding_params params;
|
||||
|
||||
if(!This->stream)
|
||||
return AUDCLNT_E_NOT_INITIALIZED;
|
||||
|
||||
if(This->dataflow == eCapture)
|
||||
capture_resample(This);
|
||||
|
||||
*numpad = This->stream->held_frames;
|
||||
|
||||
return S_OK;
|
||||
params.stream = This->stream;
|
||||
params.padding = numpad;
|
||||
params.lock = FALSE;
|
||||
UNIX_CALL(get_current_padding, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
|
||||
UINT32 *numpad)
|
||||
{
|
||||
ACImpl *This = impl_from_IAudioClient3(iface);
|
||||
HRESULT hr;
|
||||
struct get_current_padding_params params;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, numpad);
|
||||
|
||||
|
@ -899,13 +900,11 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
|
|||
if(!This->stream)
|
||||
return AUDCLNT_E_NOT_INITIALIZED;
|
||||
|
||||
OSSpinLockLock(&This->stream->lock);
|
||||
|
||||
hr = AudioClient_GetCurrentPadding_nolock(This, numpad);
|
||||
|
||||
OSSpinLockUnlock(&This->stream->lock);
|
||||
|
||||
return hr;
|
||||
params.stream = This->stream;
|
||||
params.padding = numpad;
|
||||
params.lock = TRUE;
|
||||
UNIX_CALL(get_current_padding, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface,
|
||||
|
|
|
@ -107,6 +107,14 @@ struct get_latency_params
|
|||
REFERENCE_TIME *latency;
|
||||
};
|
||||
|
||||
struct get_current_padding_params
|
||||
{
|
||||
struct coreaudio_stream *stream;
|
||||
BOOL lock; /* temporary */
|
||||
HRESULT result;
|
||||
UINT32 *padding;
|
||||
};
|
||||
|
||||
enum unix_funcs
|
||||
{
|
||||
unix_get_endpoint_ids,
|
||||
|
@ -116,6 +124,7 @@ enum unix_funcs
|
|||
unix_is_format_supported,
|
||||
unix_get_buffer_size,
|
||||
unix_get_latency,
|
||||
unix_get_current_padding,
|
||||
|
||||
unix_capture_resample /* temporary */
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue