wineoss: 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:
Huw Davies 2022-04-15 07:59:58 +01:00 committed by Alexandre Julliard
parent c35189de91
commit 2bb465fca1
3 changed files with 42 additions and 27 deletions

View File

@ -1349,37 +1349,15 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
IAudioCaptureClient *iface, UINT32 done)
{
ACImpl *This = impl_from_IAudioCaptureClient(iface);
struct oss_stream *stream = This->stream;
struct release_capture_buffer_params params;
TRACE("(%p)->(%u)\n", This, done);
oss_lock(stream);
params.stream = This->stream;
params.done = done;
OSS_CALL(release_capture_buffer, &params);
if(!done){
stream->getbuf_last = 0;
oss_unlock(stream);
return S_OK;
}
if(!stream->getbuf_last){
oss_unlock(stream);
return AUDCLNT_E_OUT_OF_ORDER;
}
if(stream->getbuf_last != done){
oss_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;
oss_unlock(stream);
return S_OK;
return params.result;
}
static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(

View File

@ -1048,6 +1048,34 @@ static NTSTATUS get_capture_buffer(void *args)
return oss_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 oss_stream *stream = params->stream;
UINT32 done = params->done;
oss_lock(stream);
if(!done){
stream->getbuf_last = 0;
return oss_unlock_result(stream, &params->result, S_OK);
}
if(!stream->getbuf_last)
return oss_unlock_result(stream, &params->result, AUDCLNT_E_OUT_OF_ORDER);
if(stream->getbuf_last != done)
return oss_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 oss_unlock_result(stream, &params->result, S_OK);
}
static NTSTATUS is_format_supported(void *args)
{
struct is_format_supported_params *params = args;
@ -1248,6 +1276,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,

View File

@ -140,6 +140,13 @@ struct get_capture_buffer_params
UINT64 *qpcpos;
};
struct release_capture_buffer_params
{
struct oss_stream *stream;
UINT32 done;
HRESULT result;
};
struct is_format_supported_params
{
const char *device;
@ -199,6 +206,7 @@ enum oss_funcs
oss_get_render_buffer,
oss_release_render_buffer,
oss_get_capture_buffer,
oss_release_capture_buffer,
oss_is_format_supported,
oss_get_mix_format,
oss_get_buffer_size,