Module: wine Branch: master Commit: 854066a589a834a635dd065b3e484b9cb679bd69 URL: https://gitlab.winehq.org/wine/wine/-/commit/854066a589a834a635dd065b3e484b9...
Author: Davide Beatrici git@davidebeatrici.dev Date: Tue Apr 11 08:58:56 2023 +0200
winecoreaudio: Use mmdevdrv structs from mmdevapi.
---
dlls/winecoreaudio.drv/mmdevdrv.c | 84 +++++---------------------------------- 1 file changed, 11 insertions(+), 73 deletions(-)
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 97492440535..2fea175df63 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -42,6 +42,8 @@ #include "audiopolicy.h" #include "unixlib.h"
+#include "../mmdevapi/mmdevdrv.h" + WINE_DEFAULT_DEBUG_CHANNEL(coreaudio);
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER) @@ -49,62 +51,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(coreaudio); static const REFERENCE_TIME DefaultPeriod = 100000; static const REFERENCE_TIME MinimumPeriod = 50000;
-struct ACImpl; -typedef struct ACImpl ACImpl; - -typedef struct _AudioSession { - GUID guid; - struct list clients; - - IMMDevice *device; - - float master_vol; - UINT32 channel_count; - float *channel_vols; - BOOL mute; - - struct list entry; -} AudioSession; - -typedef struct _AudioSessionWrapper { - IAudioSessionControl2 IAudioSessionControl2_iface; - IChannelAudioVolume IChannelAudioVolume_iface; - ISimpleAudioVolume ISimpleAudioVolume_iface; - - LONG ref; - - ACImpl *client; - AudioSession *session; -} AudioSessionWrapper; - -struct ACImpl { - IAudioClient3 IAudioClient3_iface; - IAudioRenderClient IAudioRenderClient_iface; - IAudioCaptureClient IAudioCaptureClient_iface; - IAudioClock IAudioClock_iface; - IAudioClock2 IAudioClock2_iface; - IAudioStreamVolume IAudioStreamVolume_iface; - - LONG ref; - - IMMDevice *parent; - IUnknown *pUnkFTMarshal; - - EDataFlow dataflow; - UINT32 channel_count; - float *vols; - - HANDLE timer; - - AudioSession *session; - AudioSessionWrapper *session_wrapper; - - stream_handle stream; - struct list entry; - - char device_name[1]; -}; - static const IAudioClient3Vtbl AudioClient3_Vtbl; static const IAudioRenderClientVtbl AudioRenderClient_Vtbl; static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; @@ -116,14 +62,6 @@ static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; static const IAudioSessionManager2Vtbl AudioSessionManager2_Vtbl;
-typedef struct _SessionMgr { - IAudioSessionManager2 IAudioSessionManager2_iface; - - LONG ref; - - IMMDevice *device; -} SessionMgr; - static WCHAR drv_key_devicesW[256];
static CRITICAL_SECTION g_sessions_lock; @@ -457,7 +395,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient This->dataflow = dataflow; memcpy(This->device_name, name, name_len + 1);
- hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->pUnkFTMarshal); + hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal); if (FAILED(hr)) { HeapFree(GetProcessHeap(), 0, This); return hr; @@ -487,7 +425,7 @@ static HRESULT WINAPI AudioClient_QueryInterface(IAudioClient3 *iface, IsEqualIID(riid, &IID_IAudioClient3)) *ppv = iface; else if(IsEqualIID(riid, &IID_IMarshal)) - return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv); + return IUnknown_QueryInterface(This->marshal, riid, ppv);
if(*ppv){ IUnknown_AddRef((IUnknown*)*ppv); @@ -516,7 +454,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) if(This->stream){ struct release_stream_params params; params.stream = This->stream; - params.timer_thread = This->timer; + params.timer_thread = This->timer_thread; UNIX_CALL(release_stream, ¶ms); This->stream = 0;
@@ -526,7 +464,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) } HeapFree(GetProcessHeap(), 0, This->vols); IMMDevice_Release(This->parent); - IUnknown_Release(This->pUnkFTMarshal); + IUnknown_Release(This->marshal); HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -929,9 +867,9 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) if(FAILED(hr = params.result)) return hr;
- if(!This->timer) { - This->timer = CreateThread(NULL, 0, ca_timer_thread, This, 0, NULL); - SetThreadPriority(This->timer, THREAD_PRIORITY_TIME_CRITICAL); + if(!This->timer_thread) { + This->timer_thread = CreateThread(NULL, 0, ca_timer_thread, This, 0, NULL); + SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL); }
return S_OK; @@ -1200,7 +1138,7 @@ static HRESULT WINAPI AudioRenderClient_QueryInterface( IsEqualIID(riid, &IID_IAudioRenderClient)) *ppv = iface; else if(IsEqualIID(riid, &IID_IMarshal)) - return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv); + return IUnknown_QueryInterface(This->marshal, riid, ppv);
if(*ppv){ IUnknown_AddRef((IUnknown*)*ppv); @@ -1279,7 +1217,7 @@ static HRESULT WINAPI AudioCaptureClient_QueryInterface( IsEqualIID(riid, &IID_IAudioCaptureClient)) *ppv = iface; else if(IsEqualIID(riid, &IID_IMarshal)) - return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv); + return IUnknown_QueryInterface(This->marshal, riid, ppv);
if(*ppv){ IUnknown_AddRef((IUnknown*)*ppv);