winepulse: Use syscall interface to call unix lib.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f77af3dd63
commit
2e64d91428
|
@ -1,6 +1,6 @@
|
|||
MODULE = winepulse.drv
|
||||
IMPORTS = dxguid uuid winmm user32 advapi32 ole32
|
||||
EXTRALIBS = $(PULSE_LIBS) $(PTHREAD_LIBS)
|
||||
EXTRALIBS = $(PULSE_LIBS) $(PTHREAD_LIBS) -Wl,--subsystem,native
|
||||
EXTRAINCL = $(PULSE_CFLAGS)
|
||||
|
||||
EXTRADLLFLAGS = -mno-cygwin
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define COBJMACROS
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
@ -46,7 +47,7 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(pulse);
|
||||
|
||||
static const struct unix_funcs *pulse;
|
||||
static UINT64 pulse_handle;
|
||||
|
||||
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
|
||||
|
||||
|
@ -81,7 +82,7 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
|
|||
{
|
||||
if (reason == DLL_PROCESS_ATTACH) {
|
||||
DisableThreadLibraryCalls(dll);
|
||||
if (__wine_init_unix_lib(dll, reason, NULL, &pulse))
|
||||
if (__wine_init_unix_lib(dll, reason, NULL, &pulse_handle))
|
||||
return FALSE;
|
||||
} else if (reason == DLL_PROCESS_DETACH) {
|
||||
__wine_init_unix_lib(dll, reason, NULL, NULL);
|
||||
|
@ -202,19 +203,26 @@ static inline ACImpl *impl_from_IAudioStreamVolume(IAudioStreamVolume *iface)
|
|||
return CONTAINING_RECORD(iface, ACImpl, IAudioStreamVolume_iface);
|
||||
}
|
||||
|
||||
static void pulse_call(enum unix_funcs code, void *params)
|
||||
{
|
||||
NTSTATUS status;
|
||||
status = __wine_unix_call(pulse_handle, code, params);
|
||||
assert(!status);
|
||||
}
|
||||
|
||||
static void pulse_release_stream(struct pulse_stream *stream, HANDLE timer)
|
||||
{
|
||||
struct release_stream_params params;
|
||||
params.stream = stream;
|
||||
params.timer = timer;
|
||||
pulse->release_stream(¶ms);
|
||||
pulse_call(release_stream, ¶ms);
|
||||
}
|
||||
|
||||
static DWORD CALLBACK pulse_mainloop_thread(void *event)
|
||||
{
|
||||
struct main_loop_params params;
|
||||
params.event = event;
|
||||
pulse->main_loop(¶ms);
|
||||
pulse_call(main_loop, ¶ms);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -242,7 +250,7 @@ static DWORD WINAPI pulse_timer_cb(void *user)
|
|||
struct timer_loop_params params;
|
||||
ACImpl *This = user;
|
||||
params.stream = This->pulse_stream;
|
||||
pulse->timer_loop(¶ms);
|
||||
pulse_call(timer_loop, ¶ms);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -253,7 +261,7 @@ static void set_stream_volumes(ACImpl *This)
|
|||
params.master_volume = This->session->mute ? 0.0f : This->session->master_vol;
|
||||
params.volumes = This->vol;
|
||||
params.session_volumes = This->session->channel_vols;
|
||||
pulse->set_volumes(¶ms);
|
||||
pulse_call(set_volumes, ¶ms);
|
||||
}
|
||||
|
||||
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, const WCHAR ***ids, GUID **keys,
|
||||
|
@ -298,7 +306,7 @@ int WINAPI AUDDRV_GetPriority(void)
|
|||
|
||||
params.name = name = get_application_name();
|
||||
params.config = &pulse_config;
|
||||
pulse->test_connect(¶ms);
|
||||
pulse_call(test_connect, ¶ms);
|
||||
free(name);
|
||||
return SUCCEEDED(params.result) ? Priority_Preferred : Priority_Unavailable;
|
||||
}
|
||||
|
@ -605,7 +613,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
|
|||
params.fmt = fmt;
|
||||
params.stream = &stream;
|
||||
params.channel_count = &channel_count;
|
||||
pulse->create_stream(¶ms);
|
||||
pulse_call(create_stream, ¶ms);
|
||||
free(name);
|
||||
if (FAILED(hr = params.result))
|
||||
{
|
||||
|
@ -656,7 +664,7 @@ static HRESULT WINAPI AudioClient_GetBufferSize(IAudioClient3 *iface,
|
|||
|
||||
params.stream = This->pulse_stream;
|
||||
params.size = out;
|
||||
pulse->get_buffer_size(¶ms);
|
||||
pulse_call(get_buffer_size, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -675,7 +683,7 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
|
|||
|
||||
params.stream = This->pulse_stream;
|
||||
params.latency = latency;
|
||||
pulse->get_latency(¶ms);
|
||||
pulse_call(get_latency, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -694,7 +702,7 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
|
|||
|
||||
params.stream = This->pulse_stream;
|
||||
params.padding = out;
|
||||
pulse->get_current_padding(¶ms);
|
||||
pulse_call(get_current_padding, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -898,7 +906,7 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
|
|||
return AUDCLNT_E_NOT_INITIALIZED;
|
||||
|
||||
params.stream = This->pulse_stream;
|
||||
pulse->start(¶ms);
|
||||
pulse_call(start, ¶ms);
|
||||
if (FAILED(hr = params.result))
|
||||
return hr;
|
||||
|
||||
|
@ -921,7 +929,7 @@ static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
|
|||
return AUDCLNT_E_NOT_INITIALIZED;
|
||||
|
||||
params.stream = This->pulse_stream;
|
||||
pulse->stop(¶ms);
|
||||
pulse_call(stop, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -936,7 +944,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface)
|
|||
return AUDCLNT_E_NOT_INITIALIZED;
|
||||
|
||||
params.stream = This->pulse_stream;
|
||||
pulse->reset(¶ms);
|
||||
pulse_call(reset, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -955,7 +963,7 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface,
|
|||
|
||||
params.stream = This->pulse_stream;
|
||||
params.event = event;
|
||||
pulse->set_event_handle(¶ms);
|
||||
pulse_call(set_event_handle, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1180,7 +1188,7 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
|
|||
params.stream = This->pulse_stream;
|
||||
params.frames = frames;
|
||||
params.data = data;
|
||||
pulse->get_render_buffer(¶ms);
|
||||
pulse_call(get_render_buffer, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1198,7 +1206,7 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
|
|||
params.stream = This->pulse_stream;
|
||||
params.written_frames = written_frames;
|
||||
params.flags = flags;
|
||||
pulse->release_render_buffer(¶ms);
|
||||
pulse_call(release_render_buffer, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1271,7 +1279,7 @@ static HRESULT WINAPI AudioCaptureClient_GetBuffer(IAudioCaptureClient *iface,
|
|||
params.flags = flags;
|
||||
params.devpos = devpos;
|
||||
params.qpcpos = qpcpos;
|
||||
pulse->get_capture_buffer(¶ms);
|
||||
pulse_call(get_capture_buffer, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1288,7 +1296,7 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer(
|
|||
|
||||
params.stream = This->pulse_stream;
|
||||
params.done = done;
|
||||
pulse->release_capture_buffer(¶ms);
|
||||
pulse_call(release_capture_buffer, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1307,7 +1315,7 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
|
|||
|
||||
params.stream = This->pulse_stream;
|
||||
params.frames = frames;
|
||||
pulse->get_next_packet_size(¶ms);
|
||||
pulse_call(get_next_packet_size, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1372,7 +1380,7 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq)
|
|||
|
||||
params.stream = This->pulse_stream;
|
||||
params.freq = freq;
|
||||
pulse->get_frequency(¶ms);
|
||||
pulse_call(get_frequency, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1393,7 +1401,7 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos,
|
|||
params.device = FALSE;
|
||||
params.pos = pos;
|
||||
params.qpctime = qpctime;
|
||||
pulse->get_position(¶ms);
|
||||
pulse_call(get_position, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1458,7 +1466,7 @@ static HRESULT WINAPI AudioClock2_GetDevicePosition(IAudioClock2 *iface,
|
|||
params.device = TRUE;
|
||||
params.pos = pos;
|
||||
params.qpctime = qpctime;
|
||||
pulse->get_position(¶ms);
|
||||
pulse_call(get_position, ¶ms);
|
||||
return params.result;
|
||||
}
|
||||
|
||||
|
@ -1725,7 +1733,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface,
|
|||
continue;
|
||||
|
||||
params.stream = client->pulse_stream;
|
||||
pulse->is_started(¶ms);
|
||||
pulse_call(is_started, ¶ms);
|
||||
if (params.started) {
|
||||
*state = AudioSessionStateActive;
|
||||
goto out;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#pragma makedep unix
|
||||
#endif
|
||||
|
||||
#define _NTSYSTEM_
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <pthread.h>
|
||||
#include <math.h>
|
||||
|
@ -176,8 +178,9 @@ static int pulse_poll_func(struct pollfd *ufds, unsigned long nfds, int timeout,
|
|||
return r;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_main_loop(struct main_loop_params *params)
|
||||
static NTSTATUS pulse_main_loop(void *args)
|
||||
{
|
||||
struct main_loop_params *params = args;
|
||||
int ret;
|
||||
pulse_lock();
|
||||
pulse_ml = pa_mainloop_new();
|
||||
|
@ -186,6 +189,7 @@ static void WINAPI pulse_main_loop(struct main_loop_params *params)
|
|||
pa_mainloop_run(pulse_ml, &ret);
|
||||
pa_mainloop_free(pulse_ml);
|
||||
pulse_unlock();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void pulse_contextcallback(pa_context *c, void *userdata)
|
||||
|
@ -506,8 +510,9 @@ static void pulse_probe_settings(int render, WAVEFORMATEXTENSIBLE *fmt) {
|
|||
* have to do as much as possible without creating a new thread. this function
|
||||
* sets up a synchronous connection to verify the server is running and query
|
||||
* static data. */
|
||||
static void WINAPI pulse_test_connect(struct test_connect_params *params)
|
||||
static NTSTATUS pulse_test_connect(void *args)
|
||||
{
|
||||
struct test_connect_params *params = args;
|
||||
struct pulse_config *config = params->config;
|
||||
pa_operation *o;
|
||||
int ret;
|
||||
|
@ -524,7 +529,7 @@ static void WINAPI pulse_test_connect(struct test_connect_params *params)
|
|||
pulse_ml = NULL;
|
||||
pulse_unlock();
|
||||
params->result = E_FAIL;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
pa_context_set_state_callback(pulse_ctx, pulse_contextcallback, NULL);
|
||||
|
@ -579,7 +584,7 @@ static void WINAPI pulse_test_connect(struct test_connect_params *params)
|
|||
pulse_unlock();
|
||||
|
||||
params->result = S_OK;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
fail:
|
||||
pa_context_unref(pulse_ctx);
|
||||
|
@ -588,6 +593,7 @@ fail:
|
|||
pulse_ml = NULL;
|
||||
pulse_unlock();
|
||||
params->result = E_FAIL;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static DWORD get_channel_mask(unsigned int channels)
|
||||
|
@ -793,8 +799,9 @@ static HRESULT pulse_stream_connect(struct pulse_stream *stream, UINT32 period_b
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_create_stream(struct create_stream_params *params)
|
||||
static NTSTATUS pulse_create_stream(void *args)
|
||||
{
|
||||
struct create_stream_params *params = args;
|
||||
REFERENCE_TIME period, duration = params->duration;
|
||||
struct pulse_stream *stream;
|
||||
unsigned int i, bufsize_bytes;
|
||||
|
@ -805,14 +812,14 @@ static void WINAPI pulse_create_stream(struct create_stream_params *params)
|
|||
if (FAILED(params->result = pulse_connect(params->name)))
|
||||
{
|
||||
pulse_unlock();
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!(stream = calloc(1, sizeof(*stream))))
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = E_OUTOFMEMORY;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
stream->dataflow = params->dataflow;
|
||||
|
@ -893,10 +900,12 @@ exit:
|
|||
}
|
||||
|
||||
pulse_unlock();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_release_stream(struct release_stream_params *params)
|
||||
static NTSTATUS pulse_release_stream(void *args)
|
||||
{
|
||||
struct release_stream_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
|
||||
if(params->timer) {
|
||||
|
@ -922,6 +931,7 @@ static void WINAPI pulse_release_stream(struct release_stream_params *params)
|
|||
&stream->alloc_size, MEM_RELEASE);
|
||||
free(stream->peek_buffer);
|
||||
free(stream);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static int write_buffer(const struct pulse_stream *stream, BYTE *buffer, UINT32 bytes)
|
||||
|
@ -1209,8 +1219,9 @@ static void pulse_read(struct pulse_stream *stream)
|
|||
}
|
||||
}
|
||||
|
||||
static void WINAPI pulse_timer_loop(struct timer_loop_params *params)
|
||||
static NTSTATUS pulse_timer_loop(void *args)
|
||||
{
|
||||
struct timer_loop_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
LARGE_INTEGER delay;
|
||||
UINT32 adv_bytes;
|
||||
|
@ -1311,10 +1322,13 @@ static void WINAPI pulse_timer_loop(struct timer_loop_params *params)
|
|||
|
||||
pulse_unlock();
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_start(struct start_params *params)
|
||||
static NTSTATUS pulse_start(void *args)
|
||||
{
|
||||
struct start_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
int success;
|
||||
pa_operation *o;
|
||||
|
@ -1325,21 +1339,21 @@ static void WINAPI pulse_start(struct start_params *params)
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = S_OK;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if ((stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !stream->event)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_EVENTHANDLE_NOT_SET;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stream->started)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_NOT_STOPPED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
pulse_write(stream);
|
||||
|
@ -1365,10 +1379,12 @@ static void WINAPI pulse_start(struct start_params *params)
|
|||
stream->just_started = TRUE;
|
||||
}
|
||||
pulse_unlock();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_stop(struct stop_params *params)
|
||||
static NTSTATUS pulse_stop(void *args)
|
||||
{
|
||||
struct stop_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
pa_operation *o;
|
||||
int success;
|
||||
|
@ -1378,14 +1394,14 @@ static void WINAPI pulse_stop(struct stop_params *params)
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!stream->started)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = S_FALSE;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
params->result = S_OK;
|
||||
|
@ -1406,10 +1422,12 @@ static void WINAPI pulse_stop(struct stop_params *params)
|
|||
if (SUCCEEDED(params->result))
|
||||
stream->started = FALSE;
|
||||
pulse_unlock();
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_reset(struct reset_params *params)
|
||||
static NTSTATUS pulse_reset(void *args)
|
||||
{
|
||||
struct reset_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
|
||||
pulse_lock();
|
||||
|
@ -1417,21 +1435,21 @@ static void WINAPI pulse_reset(struct reset_params *params)
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stream->started)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_NOT_STOPPED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stream->locked)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_BUFFER_OPERATION_PENDING;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stream->dataflow == eRender)
|
||||
|
@ -1470,6 +1488,7 @@ static void WINAPI pulse_reset(struct reset_params *params)
|
|||
}
|
||||
pulse_unlock();
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static BOOL alloc_tmp_buffer(struct pulse_stream *stream, SIZE_T bytes)
|
||||
|
@ -1509,8 +1528,9 @@ static UINT32 pulse_capture_padding(struct pulse_stream *stream)
|
|||
return stream->held_bytes / pa_frame_size(&stream->ss);
|
||||
}
|
||||
|
||||
static void WINAPI pulse_get_render_buffer(struct get_render_buffer_params *params)
|
||||
static NTSTATUS pulse_get_render_buffer(void *args)
|
||||
{
|
||||
struct get_render_buffer_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
size_t bytes;
|
||||
UINT32 wri_offs_bytes;
|
||||
|
@ -1520,14 +1540,14 @@ static void WINAPI pulse_get_render_buffer(struct get_render_buffer_params *para
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stream->locked)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_OUT_OF_ORDER;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!params->frames)
|
||||
|
@ -1535,14 +1555,14 @@ static void WINAPI pulse_get_render_buffer(struct get_render_buffer_params *para
|
|||
pulse_unlock();
|
||||
*params->data = NULL;
|
||||
params->result = S_OK;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stream->held_bytes / pa_frame_size(&stream->ss) + params->frames > stream->bufsize_frames)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_BUFFER_TOO_LARGE;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
bytes = params->frames * pa_frame_size(&stream->ss);
|
||||
|
@ -1553,7 +1573,7 @@ static void WINAPI pulse_get_render_buffer(struct get_render_buffer_params *para
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = E_OUTOFMEMORY;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
*params->data = stream->tmp_buffer;
|
||||
stream->locked = -bytes;
|
||||
|
@ -1568,6 +1588,7 @@ static void WINAPI pulse_get_render_buffer(struct get_render_buffer_params *para
|
|||
|
||||
pulse_unlock();
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void pulse_wrap_buffer(struct pulse_stream *stream, BYTE *buffer, UINT32 written_bytes)
|
||||
|
@ -1586,8 +1607,9 @@ static void pulse_wrap_buffer(struct pulse_stream *stream, BYTE *buffer, UINT32
|
|||
}
|
||||
}
|
||||
|
||||
static void WINAPI pulse_release_render_buffer(struct release_render_buffer_params *params)
|
||||
static NTSTATUS pulse_release_render_buffer(void *args)
|
||||
{
|
||||
struct release_render_buffer_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
UINT32 written_bytes;
|
||||
BYTE *buffer;
|
||||
|
@ -1598,7 +1620,7 @@ static void WINAPI pulse_release_render_buffer(struct release_render_buffer_para
|
|||
stream->locked = 0;
|
||||
pulse_unlock();
|
||||
params->result = params->written_frames ? AUDCLNT_E_OUT_OF_ORDER : S_OK;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (params->written_frames * pa_frame_size(&stream->ss) >
|
||||
|
@ -1606,7 +1628,7 @@ static void WINAPI pulse_release_render_buffer(struct release_render_buffer_para
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_INVALID_SIZE;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stream->locked >= 0)
|
||||
|
@ -1636,10 +1658,12 @@ static void WINAPI pulse_release_render_buffer(struct release_render_buffer_para
|
|||
|
||||
pulse_unlock();
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_get_capture_buffer(struct get_capture_buffer_params *params)
|
||||
static NTSTATUS pulse_get_capture_buffer(void *args)
|
||||
{
|
||||
struct get_capture_buffer_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
ACPacket *packet;
|
||||
|
||||
|
@ -1648,13 +1672,13 @@ static void WINAPI pulse_get_capture_buffer(struct get_capture_buffer_params *pa
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
if (stream->locked)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_OUT_OF_ORDER;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
pulse_capture_padding(stream);
|
||||
|
@ -1680,10 +1704,12 @@ static void WINAPI pulse_get_capture_buffer(struct get_capture_buffer_params *pa
|
|||
stream->locked = *params->frames;
|
||||
pulse_unlock();
|
||||
params->result = *params->frames ? S_OK : AUDCLNT_S_BUFFER_EMPTY;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_release_capture_buffer(struct release_capture_buffer_params *params)
|
||||
static NTSTATUS pulse_release_capture_buffer(void *args)
|
||||
{
|
||||
struct release_capture_buffer_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
|
||||
pulse_lock();
|
||||
|
@ -1691,13 +1717,13 @@ static void WINAPI pulse_release_capture_buffer(struct release_capture_buffer_pa
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_OUT_OF_ORDER;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
if (params->done && stream->locked != params->done)
|
||||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_INVALID_SIZE;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
if (params->done)
|
||||
{
|
||||
|
@ -1713,10 +1739,13 @@ static void WINAPI pulse_release_capture_buffer(struct release_capture_buffer_pa
|
|||
stream->locked = 0;
|
||||
pulse_unlock();
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_get_buffer_size(struct get_buffer_size_params *params)
|
||||
static NTSTATUS pulse_get_buffer_size(void *args)
|
||||
{
|
||||
struct get_buffer_size_params *params = args;
|
||||
|
||||
params->result = S_OK;
|
||||
|
||||
pulse_lock();
|
||||
|
@ -1725,10 +1754,13 @@ static void WINAPI pulse_get_buffer_size(struct get_buffer_size_params *params)
|
|||
else
|
||||
*params->size = params->stream->bufsize_frames;
|
||||
pulse_unlock();
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_get_latency(struct get_latency_params *params)
|
||||
static NTSTATUS pulse_get_latency(void *args)
|
||||
{
|
||||
struct get_latency_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
const pa_buffer_attr *attr;
|
||||
REFERENCE_TIME lat;
|
||||
|
@ -1737,7 +1769,7 @@ static void WINAPI pulse_get_latency(struct get_latency_params *params)
|
|||
if (!pulse_stream_valid(stream)) {
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
attr = pa_stream_get_buffer_attr(stream->stream);
|
||||
if (stream->dataflow == eRender)
|
||||
|
@ -1748,10 +1780,12 @@ static void WINAPI pulse_get_latency(struct get_latency_params *params)
|
|||
pulse_unlock();
|
||||
TRACE("Latency: %u ms\n", (DWORD)(*params->latency / 10000));
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_get_current_padding(struct get_current_padding_params *params)
|
||||
static NTSTATUS pulse_get_current_padding(void *args)
|
||||
{
|
||||
struct get_current_padding_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
|
||||
pulse_lock();
|
||||
|
@ -1759,7 +1793,7 @@ static void WINAPI pulse_get_current_padding(struct get_current_padding_params *
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (stream->dataflow == eRender)
|
||||
|
@ -1771,10 +1805,12 @@ static void WINAPI pulse_get_current_padding(struct get_current_padding_params *
|
|||
TRACE("%p Pad: %u ms (%u)\n", stream, muldiv(*params->padding, 1000, stream->ss.rate),
|
||||
*params->padding);
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_get_next_packet_size(struct get_next_packet_size_params *params)
|
||||
static NTSTATUS pulse_get_next_packet_size(void *args)
|
||||
{
|
||||
struct get_next_packet_size_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
|
||||
pulse_lock();
|
||||
|
@ -1785,10 +1821,13 @@ static void WINAPI pulse_get_next_packet_size(struct get_next_packet_size_params
|
|||
*params->frames = 0;
|
||||
pulse_unlock();
|
||||
params->result = S_OK;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_get_frequency(struct get_frequency_params *params)
|
||||
static NTSTATUS pulse_get_frequency(void *args)
|
||||
{
|
||||
struct get_frequency_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
|
||||
pulse_lock();
|
||||
|
@ -1796,7 +1835,7 @@ static void WINAPI pulse_get_frequency(struct get_frequency_params *params)
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
*params->freq = stream->ss.rate;
|
||||
|
@ -1804,10 +1843,12 @@ static void WINAPI pulse_get_frequency(struct get_frequency_params *params)
|
|||
*params->freq *= pa_frame_size(&stream->ss);
|
||||
pulse_unlock();
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_get_position(struct get_position_params *params)
|
||||
static NTSTATUS pulse_get_position(void *args)
|
||||
{
|
||||
struct get_position_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
|
||||
pulse_lock();
|
||||
|
@ -1815,7 +1856,7 @@ static void WINAPI pulse_get_position(struct get_position_params *params)
|
|||
{
|
||||
pulse_unlock();
|
||||
params->result = AUDCLNT_E_DEVICE_INVALIDATED;
|
||||
return;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
*params->pos = stream->clock_written - stream->held_bytes;
|
||||
|
@ -1840,19 +1881,24 @@ static void WINAPI pulse_get_position(struct get_position_params *params)
|
|||
}
|
||||
|
||||
params->result = S_OK;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_set_volumes(struct set_volumes_params *params)
|
||||
static NTSTATUS pulse_set_volumes(void *args)
|
||||
{
|
||||
struct set_volumes_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < stream->ss.channels; i++)
|
||||
stream->vol[i] = params->volumes[i] * params->master_volume * params->session_volumes[i];
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_set_event_handle(struct set_event_handle_params *params)
|
||||
static NTSTATUS pulse_set_event_handle(void *args)
|
||||
{
|
||||
struct set_event_handle_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
|
@ -1868,18 +1914,22 @@ static void WINAPI pulse_set_event_handle(struct set_event_handle_params *params
|
|||
pulse_unlock();
|
||||
|
||||
params->result = hr;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void WINAPI pulse_is_started(struct is_started_params *params)
|
||||
static NTSTATUS pulse_is_started(void *args)
|
||||
{
|
||||
struct is_started_params *params = args;
|
||||
struct pulse_stream *stream = params->stream;
|
||||
|
||||
pulse_lock();
|
||||
params->started = pulse_stream_valid(stream) && stream->started;
|
||||
pulse_unlock();
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static const struct unix_funcs unix_funcs =
|
||||
static const unixlib_entry_t unix_funcs[] =
|
||||
{
|
||||
pulse_main_loop,
|
||||
pulse_create_stream,
|
||||
|
@ -1917,7 +1967,7 @@ NTSTATUS CDECL __wine_init_unix_lib(HMODULE module, DWORD reason, const void *pt
|
|||
if (pthread_mutex_init(&pulse_mutex, &attr) != 0)
|
||||
pthread_mutex_init(&pulse_mutex, NULL);
|
||||
|
||||
*(const struct unix_funcs **)ptr_out = &unix_funcs;
|
||||
*(UINT64 *)ptr_out = (UINT_PTR)&unix_funcs;
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
if (pulse_ctx)
|
||||
|
|
|
@ -185,27 +185,27 @@ struct is_started_params
|
|||
BOOL started;
|
||||
};
|
||||
|
||||
struct unix_funcs
|
||||
enum unix_funcs
|
||||
{
|
||||
void (WINAPI *main_loop)(struct main_loop_params *params);
|
||||
void (WINAPI *create_stream)(struct create_stream_params *params);
|
||||
void (WINAPI *release_stream)(struct release_stream_params *params);
|
||||
void (WINAPI *start)(struct start_params *params);
|
||||
void (WINAPI *stop)(struct stop_params *params);
|
||||
void (WINAPI *reset)(struct reset_params *params);
|
||||
void (WINAPI *timer_loop)(struct timer_loop_params *params);
|
||||
void (WINAPI *get_render_buffer)(struct get_render_buffer_params *params);
|
||||
void (WINAPI *release_render_buffer)(struct release_render_buffer_params *params);
|
||||
void (WINAPI *get_capture_buffer)(struct get_capture_buffer_params *params);
|
||||
void (WINAPI *release_capture_buffer)(struct release_capture_buffer_params *params);
|
||||
void (WINAPI *get_buffer_size)(struct get_buffer_size_params *params);
|
||||
void (WINAPI *get_latency)(struct get_latency_params *params);
|
||||
void (WINAPI *get_current_padding)(struct get_current_padding_params *params);
|
||||
void (WINAPI *get_next_packet_size)(struct get_next_packet_size_params *params);
|
||||
void (WINAPI *get_frequency)(struct get_frequency_params *params);
|
||||
void (WINAPI *get_position)(struct get_position_params *params);
|
||||
void (WINAPI *set_volumes)(struct set_volumes_params *params);
|
||||
void (WINAPI *set_event_handle)(struct set_event_handle_params *params);
|
||||
void (WINAPI *test_connect)(struct test_connect_params *params);
|
||||
void (WINAPI *is_started)(struct is_started_params *params);
|
||||
main_loop,
|
||||
create_stream,
|
||||
release_stream,
|
||||
start,
|
||||
stop,
|
||||
reset,
|
||||
timer_loop,
|
||||
get_render_buffer,
|
||||
release_render_buffer,
|
||||
get_capture_buffer,
|
||||
release_capture_buffer,
|
||||
get_buffer_size,
|
||||
get_latency,
|
||||
get_current_padding,
|
||||
get_next_packet_size,
|
||||
get_frequency,
|
||||
get_position,
|
||||
set_volumes,
|
||||
set_event_handle,
|
||||
test_connect,
|
||||
is_started,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue