winealsa: Move release_capture_buffer 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
bb43ae25f9
commit
bc70c4dabf
|
@ -1752,6 +1752,34 @@ static NTSTATUS get_capture_buffer(void *args)
|
|||
return alsa_unlock_result(stream, ¶ms->result, *frames ? S_OK : AUDCLNT_S_BUFFER_EMPTY);
|
||||
}
|
||||
|
||||
static NTSTATUS release_capture_buffer(void *args)
|
||||
{
|
||||
struct release_capture_buffer_params *params = args;
|
||||
struct alsa_stream *stream = params->stream;
|
||||
UINT32 done = params->done;
|
||||
|
||||
alsa_lock(stream);
|
||||
|
||||
if(!done){
|
||||
stream->getbuf_last = 0;
|
||||
return alsa_unlock_result(stream, ¶ms->result, S_OK);
|
||||
}
|
||||
|
||||
if(!stream->getbuf_last)
|
||||
return alsa_unlock_result(stream, ¶ms->result, AUDCLNT_E_OUT_OF_ORDER);
|
||||
|
||||
if(stream->getbuf_last != done)
|
||||
return alsa_unlock_result(stream, ¶ms->result, AUDCLNT_E_INVALID_SIZE);
|
||||
|
||||
stream->written_frames += done;
|
||||
stream->held_frames -= done;
|
||||
stream->lcl_offs_frames += done;
|
||||
stream->lcl_offs_frames %= stream->bufsize_frames;
|
||||
stream->getbuf_last = 0;
|
||||
|
||||
return alsa_unlock_result(stream, ¶ms->result, S_OK);
|
||||
}
|
||||
|
||||
static NTSTATUS is_format_supported(void *args)
|
||||
{
|
||||
struct is_format_supported_params *params = args;
|
||||
|
@ -2086,6 +2114,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
|
|||
get_render_buffer,
|
||||
release_render_buffer,
|
||||
get_capture_buffer,
|
||||
release_capture_buffer,
|
||||
is_format_supported,
|
||||
get_mix_format,
|
||||
get_buffer_size,
|
||||
|
|
|
@ -1398,37 +1398,16 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
|
|||
IAudioCaptureClient *iface, UINT32 done)
|
||||
{
|
||||
ACImpl *This = impl_from_IAudioCaptureClient(iface);
|
||||
struct alsa_stream *stream = This->stream;
|
||||
struct release_capture_buffer_params params;
|
||||
|
||||
TRACE("(%p)->(%u)\n", This, done);
|
||||
|
||||
alsa_lock(stream);
|
||||
params.stream = This->stream;
|
||||
params.done = done;
|
||||
|
||||
if(!done){
|
||||
stream->getbuf_last = 0;
|
||||
alsa_unlock(stream);
|
||||
return S_OK;
|
||||
}
|
||||
ALSA_CALL(release_capture_buffer, ¶ms);
|
||||
|
||||
if(!stream->getbuf_last){
|
||||
alsa_unlock(stream);
|
||||
return AUDCLNT_E_OUT_OF_ORDER;
|
||||
}
|
||||
|
||||
if(stream->getbuf_last != done){
|
||||
alsa_unlock(stream);
|
||||
return AUDCLNT_E_INVALID_SIZE;
|
||||
}
|
||||
|
||||
stream->written_frames += done;
|
||||
stream->held_frames -= done;
|
||||
stream->lcl_offs_frames += done;
|
||||
stream->lcl_offs_frames %= stream->bufsize_frames;
|
||||
stream->getbuf_last = 0;
|
||||
|
||||
alsa_unlock(stream);
|
||||
|
||||
return S_OK;
|
||||
return params.result;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
|
||||
|
|
|
@ -141,6 +141,13 @@ struct get_capture_buffer_params
|
|||
UINT64 *qpcpos;
|
||||
};
|
||||
|
||||
struct release_capture_buffer_params
|
||||
{
|
||||
struct alsa_stream *stream;
|
||||
UINT32 done;
|
||||
HRESULT result;
|
||||
};
|
||||
|
||||
struct is_format_supported_params
|
||||
{
|
||||
const char *alsa_name;
|
||||
|
@ -199,6 +206,7 @@ enum alsa_funcs
|
|||
alsa_get_render_buffer,
|
||||
alsa_release_render_buffer,
|
||||
alsa_get_capture_buffer,
|
||||
alsa_release_capture_buffer,
|
||||
alsa_is_format_supported,
|
||||
alsa_get_mix_format,
|
||||
alsa_get_buffer_size,
|
||||
|
|
Loading…
Reference in New Issue