[PATCH 5/5] winepulse: Move pulse_set_event_handle to unix lib.
Andrew Eikum
aeikum at codeweavers.com
Tue May 18 16:30:50 CDT 2021
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Tue, May 18, 2021 at 04:59:16PM +0200, Jacek Caban wrote:
> Signed-off-by: Jacek Caban <jacek at codeweavers.com>
> ---
> 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-devel
mailing list