Commit bc70c4da authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winealsa: Move release_capture_buffer to the unixlib.

parent bb43ae25
......@@ -1752,6 +1752,34 @@ static NTSTATUS get_capture_buffer(void *args)
return alsa_unlock_result(stream, &params->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, &params->result, S_OK);
}
if(!stream->getbuf_last)
return alsa_unlock_result(stream, &params->result, AUDCLNT_E_OUT_OF_ORDER);
if(stream->getbuf_last != done)
return alsa_unlock_result(stream, &params->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, &params->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);
if(!done){
stream->getbuf_last = 0;
alsa_unlock(stream);
return S_OK;
}
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;
}
params.stream = This->stream;
params.done = done;
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_CALL(release_capture_buffer, &params);
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,
......
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