Jacek Caban : winepulse: Move pulse_set_event_handle to unix lib.
Alexandre Julliard
julliard at winehq.org
Wed May 19 14:55:12 CDT 2021
Module: wine
Branch: master
Commit: a5997bece730beb8ab72d66b824ed2a1cb92c254
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a5997bece730beb8ab72d66b824ed2a1cb92c254
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue May 18 16:59:16 2021 +0200
winepulse: Move pulse_set_event_handle to unix lib.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winepulse.drv/mmdevdrv.c | 19 +++----------------
dlls/winepulse.drv/pulse.c | 19 +++++++++++++++++++
dlls/winepulse.drv/unixlib.h | 1 +
3 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
index 40391e19641..292d85a1c1f 100644
--- a/dlls/winepulse.drv/mmdevdrv.c
+++ b/dlls/winepulse.drv/mmdevdrv.c
@@ -943,28 +943,15 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface,
HANDLE event)
{
ACImpl *This = impl_from_IAudioClient3(iface);
- HRESULT hr;
TRACE("(%p)->(%p)\n", This, event);
if (!event)
return E_INVALIDARG;
+ if (!This->pulse_stream)
+ return AUDCLNT_E_NOT_INITIALIZED;
- pulse->lock();
- hr = pulse_stream_valid(This);
- if (FAILED(hr)) {
- pulse->unlock();
- return hr;
- }
-
- if (!(This->pulse_stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK))
- hr = AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED;
- else if (This->pulse_stream->event)
- hr = HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
- else
- This->pulse_stream->event = event;
- pulse->unlock();
- return hr;
+ return pulse->set_event_handle(This->pulse_stream, event);
}
static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid,
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c
index b115ae76a43..3fc238faf39 100644
--- a/dlls/winepulse.drv/pulse.c
+++ b/dlls/winepulse.drv/pulse.c
@@ -1541,6 +1541,24 @@ static void WINAPI pulse_set_volumes(struct pulse_stream *stream, float master_v
stream->vol[i] = volumes[i] * master_volume * session_volumes[i];
}
+static HRESULT WINAPI pulse_set_event_handle(struct pulse_stream *stream, HANDLE event)
+{
+ HRESULT hr = S_OK;
+
+ pulse_lock();
+ if (!pulse_stream_valid(stream))
+ hr = AUDCLNT_E_DEVICE_INVALIDATED;
+ else if (!(stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK))
+ hr = AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED;
+ else if (stream->event)
+ hr = HRESULT_FROM_WIN32(ERROR_INVALID_NAME);
+ else
+ stream->event = event;
+ pulse_unlock();
+
+ return hr;
+}
+
static const struct unix_funcs unix_funcs =
{
pulse_lock,
@@ -1556,6 +1574,7 @@ static const struct unix_funcs unix_funcs =
pulse_get_render_buffer,
pulse_release_render_buffer,
pulse_set_volumes,
+ pulse_set_event_handle,
pulse_test_connect,
};
diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h
index 6ec7cdc7fcc..9242cb3856b 100644
--- a/dlls/winepulse.drv/unixlib.h
+++ b/dlls/winepulse.drv/unixlib.h
@@ -86,5 +86,6 @@ struct unix_funcs
DWORD flags);
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);
HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);
};
More information about the wine-cvs
mailing list