Commit 80b996c5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winepulse: Move pulse_release_capture_buffer to unix lib.

parent 459e911b
......@@ -1222,28 +1222,10 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
TRACE("(%p)->(%u)\n", This, done);
pulse->lock();
if (!This->pulse_stream->locked && done) {
pulse->unlock();
return AUDCLNT_E_OUT_OF_ORDER;
}
if (done && This->pulse_stream->locked != done) {
pulse->unlock();
return AUDCLNT_E_INVALID_SIZE;
}
if (done) {
ACPacket *packet = This->pulse_stream->locked_ptr;
This->pulse_stream->locked_ptr = NULL;
This->pulse_stream->held_bytes -= This->pulse_stream->period_bytes;
if (packet->discont)
This->pulse_stream->clock_written += 2 * This->pulse_stream->period_bytes;
else
This->pulse_stream->clock_written += This->pulse_stream->period_bytes;
list_add_tail(&This->pulse_stream->packet_free_head, &packet->entry);
}
This->pulse_stream->locked = 0;
pulse->unlock();
return S_OK;
if (!This->pulse_stream)
return AUDCLNT_E_NOT_INITIALIZED;
return pulse->release_capture_buffer(This->pulse_stream, done);
}
static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
......
......@@ -1591,6 +1591,35 @@ static HRESULT WINAPI pulse_get_capture_buffer(struct pulse_stream *stream, BYTE
return *frames ? S_OK : AUDCLNT_S_BUFFER_EMPTY;
}
static HRESULT WINAPI pulse_release_capture_buffer(struct pulse_stream *stream, BOOL done)
{
pulse_lock();
if (!stream->locked && done)
{
pulse_unlock();
return AUDCLNT_E_OUT_OF_ORDER;
}
if (done && stream->locked != done)
{
pulse_unlock();
return AUDCLNT_E_INVALID_SIZE;
}
if (done)
{
ACPacket *packet = stream->locked_ptr;
stream->locked_ptr = NULL;
stream->held_bytes -= stream->period_bytes;
if (packet->discont)
stream->clock_written += 2 * stream->period_bytes;
else
stream->clock_written += stream->period_bytes;
list_add_tail(&stream->packet_free_head, &packet->entry);
}
stream->locked = 0;
pulse_unlock();
return S_OK;
}
static HRESULT WINAPI pulse_get_buffer_size(struct pulse_stream *stream, UINT32 *out)
{
HRESULT hr = S_OK;
......@@ -1687,6 +1716,7 @@ static const struct unix_funcs unix_funcs =
pulse_get_render_buffer,
pulse_release_render_buffer,
pulse_get_capture_buffer,
pulse_release_capture_buffer,
pulse_get_buffer_size,
pulse_get_latency,
pulse_get_current_padding,
......
......@@ -86,6 +86,7 @@ struct unix_funcs
DWORD flags);
HRESULT (WINAPI *get_capture_buffer)(struct pulse_stream *stream, BYTE **data, UINT32 *frames,
DWORD *flags, UINT64 *devpos, UINT64 *qpcpos);
HRESULT (WINAPI *release_capture_buffer)(struct pulse_stream *stream, BOOL done);
HRESULT (WINAPI *get_buffer_size)(struct pulse_stream *stream, UINT32 *out);
HRESULT (WINAPI *get_latency)(struct pulse_stream *stream, REFERENCE_TIME *latency);
HRESULT (WINAPI *get_current_padding)(struct pulse_stream *stream, UINT32 *out);
......
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