Commit a6131544 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winepulse: Move pulse_get_next_packet_size to unix lib.

parent 80b996c5
......@@ -638,18 +638,6 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
return pulse->get_latency(This->pulse_stream, latency);
}
static void ACImpl_GetCapturePad(ACImpl *This, UINT32 *out)
{
ACPacket *packet = This->pulse_stream->locked_ptr;
if (!packet && !list_empty(&This->pulse_stream->packet_filled_head)) {
packet = (ACPacket*)list_head(&This->pulse_stream->packet_filled_head);
This->pulse_stream->locked_ptr = packet;
list_remove(&packet->entry);
}
if (out)
*out = This->pulse_stream->held_bytes / pa_frame_size(&This->pulse_stream->ss);
}
static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
UINT32 *out)
{
......@@ -1234,17 +1222,13 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
ACImpl *This = impl_from_IAudioCaptureClient(iface);
TRACE("(%p)->(%p)\n", This, frames);
if (!frames)
return E_POINTER;
if (!This->pulse_stream)
return AUDCLNT_E_NOT_INITIALIZED;
pulse->lock();
ACImpl_GetCapturePad(This, NULL);
if (This->pulse_stream->locked_ptr)
*frames = This->pulse_stream->period_bytes / pa_frame_size(&This->pulse_stream->ss);
else
*frames = 0;
pulse->unlock();
return S_OK;
return pulse->get_next_packet_size(This->pulse_stream, frames);
}
static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl =
......
......@@ -43,6 +43,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(pulse);
typedef struct _ACPacket
{
struct list entry;
UINT64 qpcpos;
BYTE *data;
UINT32 discont;
} ACPacket;
static pa_context *pulse_ctx;
static pa_mainloop *pulse_ml;
......@@ -1674,6 +1682,18 @@ static HRESULT WINAPI pulse_get_current_padding(struct pulse_stream *stream, UIN
return S_OK;
}
static HRESULT WINAPI pulse_get_next_packet_size(struct pulse_stream *stream, UINT32 *frames)
{
pulse_lock();
pulse_capture_padding(stream);
if (stream->locked_ptr)
*frames = stream->period_bytes / pa_frame_size(&stream->ss);
else
*frames = 0;
pulse_unlock();
return S_OK;
}
static void WINAPI pulse_set_volumes(struct pulse_stream *stream, float master_volume,
const float *volumes, const float *session_volumes)
{
......@@ -1720,6 +1740,7 @@ static const struct unix_funcs unix_funcs =
pulse_get_buffer_size,
pulse_get_latency,
pulse_get_current_padding,
pulse_get_next_packet_size,
pulse_set_volumes,
pulse_set_event_handle,
pulse_test_connect,
......
......@@ -29,14 +29,6 @@ struct pulse_config
unsigned int speakers_mask;
};
typedef struct _ACPacket
{
struct list entry;
UINT64 qpcpos;
BYTE *data;
UINT32 discont;
} ACPacket;
struct pulse_stream
{
EDataFlow dataflow;
......@@ -90,6 +82,7 @@ struct unix_funcs
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);
HRESULT (WINAPI *get_next_packet_size)(struct pulse_stream *stream, UINT32 *frames);
void (WINAPI *set_volumes)(struct pulse_stream *stream, float master_volume,
const float *volumes, const float *session_volumes);
HRESULT (WINAPI *set_event_handle)(struct pulse_stream *stream, HANDLE event);
......
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