Commit 2bb465fc authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineoss: Move release_capture_buffer to the unixlib.

parent c35189de
......@@ -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);
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);
params.stream = This->stream;
params.done = done;
OSS_CALL(release_capture_buffer, &params);
return S_OK;
return params.result;
}
static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
......
......@@ -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,
......
......@@ -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,
......
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