From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/client.c | 67 ++++++++++++++------- dlls/winealsa.drv/mmdevdrv.c | 96 +------------------------------ dlls/winecoreaudio.drv/mmdevdrv.c | 96 +------------------------------ dlls/wineoss.drv/mmdevdrv.c | 96 +------------------------------ dlls/winepulse.drv/mmdevdrv.c | 96 +------------------------------ 5 files changed, 50 insertions(+), 401 deletions(-)
diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index 8779ae1dc23..11a0a572d98 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -406,7 +406,7 @@ const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl = capture_GetNextPacketSize };
-HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, REFIID riid, void **ppv) +static HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, REFIID riid, void **ppv) { TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
@@ -431,7 +431,7 @@ HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, REFIID riid, void **p return S_OK; }
-ULONG WINAPI client_AddRef(IAudioClient3 *iface) +static ULONG WINAPI client_AddRef(IAudioClient3 *iface) { struct audio_client *This = impl_from_IAudioClient3(iface); ULONG ref = InterlockedIncrement(&This->ref); @@ -439,7 +439,7 @@ ULONG WINAPI client_AddRef(IAudioClient3 *iface) return ref; }
-ULONG WINAPI client_Release(IAudioClient3 *iface) +static ULONG WINAPI client_Release(IAudioClient3 *iface) { struct audio_client *This = impl_from_IAudioClient3(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -467,7 +467,7 @@ ULONG WINAPI client_Release(IAudioClient3 *iface) return ref; }
-HRESULT WINAPI client_Initialize(IAudioClient3 *iface, AUDCLNT_SHAREMODE mode, DWORD flags, +static HRESULT WINAPI client_Initialize(IAudioClient3 *iface, AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration, REFERENCE_TIME period, const WAVEFORMATEX *fmt, const GUID *sessionguid) { @@ -562,7 +562,7 @@ exit: return params.result; }
-HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, UINT32 *out) +static HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, UINT32 *out) { struct audio_client *This = impl_from_IAudioClient3(iface); struct get_buffer_size_params params; @@ -583,7 +583,7 @@ HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, UINT32 *out) return params.result; }
-HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface, REFERENCE_TIME *latency) +static HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface, REFERENCE_TIME *latency) { struct audio_client *This = impl_from_IAudioClient3(iface); struct get_latency_params params; @@ -604,7 +604,7 @@ HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface, REFERENCE_TIME *lat return params.result; }
-HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface, UINT32 *out) +static HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface, UINT32 *out) { struct audio_client *This = impl_from_IAudioClient3(iface); struct get_current_padding_params params; @@ -625,7 +625,7 @@ HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface, UINT32 *out) return params.result; }
-HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, AUDCLNT_SHAREMODE mode, +static HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *fmt, WAVEFORMATEX **out) { struct audio_client *This = impl_from_IAudioClient3(iface); @@ -658,7 +658,7 @@ HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, AUDCLNT_SHAREMODE return params.result; }
-HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, WAVEFORMATEX **pwfx) +static HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, WAVEFORMATEX **pwfx) { struct audio_client *This = impl_from_IAudioClient3(iface); struct get_mix_format_params params; @@ -687,7 +687,7 @@ HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, WAVEFORMATEX **pwfx) return params.result; }
-HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, REFERENCE_TIME *defperiod, +static HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) { struct audio_client *This = impl_from_IAudioClient3(iface); @@ -708,7 +708,7 @@ HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, REFERENCE_TIME *defp return params.result; }
-HRESULT WINAPI client_Start(IAudioClient3 *iface) +static HRESULT WINAPI client_Start(IAudioClient3 *iface) { struct audio_client *This = impl_from_IAudioClient3(iface); struct start_params params; @@ -739,7 +739,7 @@ HRESULT WINAPI client_Start(IAudioClient3 *iface) return params.result; }
-HRESULT WINAPI client_Stop(IAudioClient3 *iface) +static HRESULT WINAPI client_Stop(IAudioClient3 *iface) { struct audio_client *This = impl_from_IAudioClient3(iface); struct stop_params params; @@ -756,7 +756,7 @@ HRESULT WINAPI client_Stop(IAudioClient3 *iface) return params.result; }
-HRESULT WINAPI client_Reset(IAudioClient3 *iface) +static HRESULT WINAPI client_Reset(IAudioClient3 *iface) { struct audio_client *This = impl_from_IAudioClient3(iface); struct reset_params params; @@ -773,7 +773,7 @@ HRESULT WINAPI client_Reset(IAudioClient3 *iface) return params.result; }
-HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, HANDLE event) +static HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, HANDLE event) { struct audio_client *This = impl_from_IAudioClient3(iface); struct set_event_handle_params params; @@ -794,7 +794,7 @@ HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, HANDLE event) return params.result; }
-HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, void **ppv) +static HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, void **ppv) { struct audio_client *This = impl_from_IAudioClient3(iface); HRESULT hr; @@ -869,7 +869,7 @@ exit: return hr; }
-HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, AUDIO_STREAM_CATEGORY category, +static HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, AUDIO_STREAM_CATEGORY category, BOOL *offload_capable) { struct audio_client *This = impl_from_IAudioClient3(iface); @@ -884,7 +884,7 @@ HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, AUDIO_STREAM_CATEGO return S_OK; }
-HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, +static HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, const AudioClientProperties *prop) { struct audio_client *This = impl_from_IAudioClient3(iface); @@ -913,7 +913,7 @@ HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, return S_OK; }
-HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, const WAVEFORMATEX *format, +static HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, REFERENCE_TIME *max_duration) { @@ -922,7 +922,7 @@ HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, const WAVEFORMAT return E_NOTIMPL; }
-HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface, +static HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface, const WAVEFORMATEX *format, UINT32 *default_period_frames, UINT32 *unit_period_frames, @@ -936,7 +936,7 @@ HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface, return E_NOTIMPL; }
-HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, +static HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, WAVEFORMATEX **cur_format, UINT32 *cur_period_frames) { @@ -945,7 +945,7 @@ HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, return E_NOTIMPL; }
-HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, DWORD flags, +static HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, const GUID *session_guid) @@ -955,6 +955,31 @@ HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, DWORD fl return E_NOTIMPL; }
+const IAudioClient3Vtbl AudioClient3_Vtbl = +{ + client_QueryInterface, + client_AddRef, + client_Release, + client_Initialize, + client_GetBufferSize, + client_GetStreamLatency, + client_GetCurrentPadding, + client_IsFormatSupported, + client_GetMixFormat, + client_GetDevicePeriod, + client_Start, + client_Stop, + client_Reset, + client_SetEventHandle, + client_GetService, + client_IsOffloadCapable, + client_SetClientProperties, + client_GetBufferSizeLimits, + client_GetSharedModeEnginePeriod, + client_GetCurrentSharedModeEnginePeriod, + client_InitializeSharedAudioStream, +}; + static HRESULT WINAPI clock_QueryInterface(IAudioClock *iface, REFIID riid, void **ppv) { struct audio_client *This = impl_from_IAudioClock(iface); diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 507613e71ad..52a56a9c281 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -66,7 +66,7 @@ static struct list g_sessions = LIST_INIT(g_sessions); static WCHAR drv_key_devicesW[256]; static const WCHAR guidW[] = {'g','u','i','d',0};
-static const IAudioClient3Vtbl AudioClient3_Vtbl; +extern const IAudioClient3Vtbl AudioClient3_Vtbl; extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl; extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; @@ -89,11 +89,6 @@ void DECLSPEC_HIDDEN sessions_unlock(void) LeaveCriticalSection(&g_sessions_lock); }
-static inline ACImpl *impl_from_IAudioClient3(IAudioClient3 *iface) -{ - return CONTAINING_RECORD(iface, ACImpl, IAudioClient3_iface); -} - BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { switch (reason) @@ -363,13 +358,6 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient return S_OK; }
-extern HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, - REFIID riid, void **ppv); - -extern ULONG WINAPI client_AddRef(IAudioClient3 *iface); - -extern ULONG WINAPI client_Release(IAudioClient3 *iface); - static void session_init_vols(AudioSession *session, UINT channels) { if(session->channel_count < channels){ @@ -449,88 +437,6 @@ HRESULT get_audio_session(const GUID *sessionguid, return S_OK; }
-extern HRESULT WINAPI client_Initialize(IAudioClient3 *iface, - AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration, - REFERENCE_TIME period, const WAVEFORMATEX *fmt, - const GUID *sessionguid); - -extern HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, - UINT32 *out); - -extern HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface, - REFERENCE_TIME *latency); - -extern HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface, - UINT32 *out); - -extern HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, - AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *fmt, - WAVEFORMATEX **out); - -extern HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, - WAVEFORMATEX **pwfx); - -extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod); - -extern HRESULT WINAPI client_Start(IAudioClient3 *iface); - -extern HRESULT WINAPI client_Stop(IAudioClient3 *iface); - -extern HRESULT WINAPI client_Reset(IAudioClient3 *iface); - -extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, - HANDLE event); - -extern HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, - void **ppv); - -extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, - AUDIO_STREAM_CATEGORY category, BOOL *offload_capable); - -extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, - const AudioClientProperties *prop); - -extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, - const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, - REFERENCE_TIME *max_duration); - -extern HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface, - const WAVEFORMATEX *format, UINT32 *default_period_frames, UINT32 *unit_period_frames, - UINT32 *min_period_frames, UINT32 *max_period_frames); - -extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, - WAVEFORMATEX **cur_format, UINT32 *cur_period_frames); - -extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, - DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, - const GUID *session_guid); - -static const IAudioClient3Vtbl AudioClient3_Vtbl = -{ - client_QueryInterface, - client_AddRef, - client_Release, - client_Initialize, - client_GetBufferSize, - client_GetStreamLatency, - client_GetCurrentPadding, - client_IsFormatSupported, - client_GetMixFormat, - client_GetDevicePeriod, - client_Start, - client_Stop, - client_Reset, - client_SetEventHandle, - client_GetService, - client_IsOffloadCapable, - client_SetClientProperties, - client_GetBufferSizeLimits, - client_GetSharedModeEnginePeriod, - client_GetCurrentSharedModeEnginePeriod, - client_InitializeSharedAudioStream, -}; - HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) { diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index f4e3416dcc6..d88346d9fe5 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -48,7 +48,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(coreaudio);
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
-static const IAudioClient3Vtbl AudioClient3_Vtbl; +extern const IAudioClient3Vtbl AudioClient3_Vtbl; extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl; extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; @@ -83,11 +83,6 @@ void DECLSPEC_HIDDEN sessions_unlock(void) LeaveCriticalSection(&g_sessions_lock); }
-static inline ACImpl *impl_from_IAudioClient3(IAudioClient3 *iface) -{ - return CONTAINING_RECORD(iface, ACImpl, IAudioClient3_iface); -} - BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { switch (reason) @@ -359,13 +354,6 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient return S_OK; }
-extern HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, - REFIID riid, void **ppv); - -extern ULONG WINAPI client_AddRef(IAudioClient3 *iface); - -extern ULONG WINAPI client_Release(IAudioClient3 *iface); - static void session_init_vols(AudioSession *session, UINT channels) { if(session->channel_count < channels){ @@ -445,88 +433,6 @@ HRESULT get_audio_session(const GUID *sessionguid, return S_OK; }
-extern HRESULT WINAPI client_Initialize(IAudioClient3 *iface, - AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration, - REFERENCE_TIME period, const WAVEFORMATEX *fmt, - const GUID *sessionguid); - -extern HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, - UINT32 *frames); - -extern HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface, - REFERENCE_TIME *out); - -extern HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface, - UINT32 *numpad); - -extern HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, - AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *pwfx, - WAVEFORMATEX **outpwfx); - -extern HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, - WAVEFORMATEX **pwfx); - -extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod); - -extern HRESULT WINAPI client_Start(IAudioClient3 *iface); - -extern HRESULT WINAPI client_Stop(IAudioClient3 *iface); - -extern HRESULT WINAPI client_Reset(IAudioClient3 *iface); - -extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, - HANDLE event); - -extern HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, - void **ppv); - -extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, - AUDIO_STREAM_CATEGORY category, BOOL *offload_capable); - -extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, - const AudioClientProperties *prop); - -extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, - const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, - REFERENCE_TIME *max_duration); - -extern HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface, - const WAVEFORMATEX *format, UINT32 *default_period_frames, UINT32 *unit_period_frames, - UINT32 *min_period_frames, UINT32 *max_period_frames); - -extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, - WAVEFORMATEX **cur_format, UINT32 *cur_period_frames); - -extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, - DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, - const GUID *session_guid); - -static const IAudioClient3Vtbl AudioClient3_Vtbl = -{ - client_QueryInterface, - client_AddRef, - client_Release, - client_Initialize, - client_GetBufferSize, - client_GetStreamLatency, - client_GetCurrentPadding, - client_IsFormatSupported, - client_GetMixFormat, - client_GetDevicePeriod, - client_Start, - client_Stop, - client_Reset, - client_SetEventHandle, - client_GetService, - client_IsOffloadCapable, - client_SetClientProperties, - client_GetBufferSizeLimits, - client_GetSharedModeEnginePeriod, - client_GetCurrentSharedModeEnginePeriod, - client_InitializeSharedAudioStream, -}; - HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) { diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 48c600b089f..3322374cb90 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -72,7 +72,7 @@ static CRITICAL_SECTION_DEBUG g_sessions_lock_debug = static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 }; static struct list g_sessions = LIST_INIT(g_sessions);
-static const IAudioClient3Vtbl AudioClient3_Vtbl; +extern const IAudioClient3Vtbl AudioClient3_Vtbl; extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl; extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; @@ -95,11 +95,6 @@ void DECLSPEC_HIDDEN sessions_unlock(void) LeaveCriticalSection(&g_sessions_lock); }
-static inline ACImpl *impl_from_IAudioClient3(IAudioClient3 *iface) -{ - return CONTAINING_RECORD(iface, ACImpl, IAudioClient3_iface); -} - BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) { switch (reason) @@ -341,13 +336,6 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, return S_OK; }
-extern HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, - REFIID riid, void **ppv); - -extern ULONG WINAPI client_AddRef(IAudioClient3 *iface); - -extern ULONG WINAPI client_Release(IAudioClient3 *iface); - static void session_init_vols(AudioSession *session, UINT channels) { if(session->channel_count < channels){ @@ -427,88 +415,6 @@ HRESULT get_audio_session(const GUID *sessionguid, return S_OK; }
-extern HRESULT WINAPI client_Initialize(IAudioClient3 *iface, - AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration, - REFERENCE_TIME period, const WAVEFORMATEX *fmt, - const GUID *sessionguid); - -extern HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, - UINT32 *frames); - -extern HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface, - REFERENCE_TIME *latency); - -extern HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface, - UINT32 *numpad); - -extern HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, - AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *fmt, - WAVEFORMATEX **out); - -extern HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, - WAVEFORMATEX **pwfx); - -extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod); - -extern HRESULT WINAPI client_Start(IAudioClient3 *iface); - -extern HRESULT WINAPI client_Stop(IAudioClient3 *iface); - -extern HRESULT WINAPI client_Reset(IAudioClient3 *iface); - -extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, - HANDLE event); - -extern HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, - void **ppv); - -extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, - AUDIO_STREAM_CATEGORY category, BOOL *offload_capable); - -extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, - const AudioClientProperties *prop); - -extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, - const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, - REFERENCE_TIME *max_duration); - -extern HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface, - const WAVEFORMATEX *format, UINT32 *default_period_frames, UINT32 *unit_period_frames, - UINT32 *min_period_frames, UINT32 *max_period_frames); - -extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, - WAVEFORMATEX **cur_format, UINT32 *cur_period_frames); - -extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, - DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, - const GUID *session_guid); - -static const IAudioClient3Vtbl AudioClient3_Vtbl = -{ - client_QueryInterface, - client_AddRef, - client_Release, - client_Initialize, - client_GetBufferSize, - client_GetStreamLatency, - client_GetCurrentPadding, - client_IsFormatSupported, - client_GetMixFormat, - client_GetDevicePeriod, - client_Start, - client_Stop, - client_Reset, - client_SetEventHandle, - client_GetService, - client_IsOffloadCapable, - client_SetClientProperties, - client_GetBufferSizeLimits, - client_GetSharedModeEnginePeriod, - client_GetCurrentSharedModeEnginePeriod, - client_InitializeSharedAudioStream, -}; - HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) { diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index abde1c80b2a..b3b0bad2990 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -118,7 +118,7 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) return TRUE; }
-static const IAudioClient3Vtbl AudioClient3_Vtbl; +extern const IAudioClient3Vtbl AudioClient3_Vtbl; extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl; extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; @@ -131,11 +131,6 @@ extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; extern struct audio_session_wrapper *session_wrapper_create( struct audio_client *client) DECLSPEC_HIDDEN;
-static inline ACImpl *impl_from_IAudioClient3(IAudioClient3 *iface) -{ - return CONTAINING_RECORD(iface, ACImpl, IAudioClient3_iface); -} - static void pulse_call(enum unix_funcs code, void *params) { NTSTATUS status; @@ -377,13 +372,6 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient return S_OK; }
-extern HRESULT WINAPI client_QueryInterface(IAudioClient3 *iface, - REFIID riid, void **ppv); - -extern ULONG WINAPI client_AddRef(IAudioClient3 *iface); - -extern ULONG WINAPI client_Release(IAudioClient3 *iface); - static void session_init_vols(AudioSession *session, UINT channels) { if (session->channel_count < channels) { @@ -463,88 +451,6 @@ HRESULT get_audio_session(const GUID *sessionguid, return S_OK; }
-extern HRESULT WINAPI client_Initialize(IAudioClient3 *iface, - AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration, - REFERENCE_TIME period, const WAVEFORMATEX *fmt, - const GUID *sessionguid); - -extern HRESULT WINAPI client_GetBufferSize(IAudioClient3 *iface, - UINT32 *out); - -extern HRESULT WINAPI client_GetStreamLatency(IAudioClient3 *iface, - REFERENCE_TIME *latency); - -extern HRESULT WINAPI client_GetCurrentPadding(IAudioClient3 *iface, - UINT32 *out); - -extern HRESULT WINAPI client_IsFormatSupported(IAudioClient3 *iface, - AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *fmt, - WAVEFORMATEX **out); - -extern HRESULT WINAPI client_GetMixFormat(IAudioClient3 *iface, - WAVEFORMATEX **pwfx); - -extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod); - -extern HRESULT WINAPI client_Start(IAudioClient3 *iface); - -extern HRESULT WINAPI client_Stop(IAudioClient3 *iface); - -extern HRESULT WINAPI client_Reset(IAudioClient3 *iface); - -extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, - HANDLE event); - -extern HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, - void **ppv); - -extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, - AUDIO_STREAM_CATEGORY category, BOOL *offload_capable); - -extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, - const AudioClientProperties *prop); - -extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, - const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, - REFERENCE_TIME *max_duration); - -extern HRESULT WINAPI client_GetSharedModeEnginePeriod(IAudioClient3 *iface, - const WAVEFORMATEX *format, UINT32 *default_period_frames, UINT32 *unit_period_frames, - UINT32 *min_period_frames, UINT32 *max_period_frames); - -extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, - WAVEFORMATEX **cur_format, UINT32 *cur_period_frames); - -extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, - DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, - const GUID *session_guid); - -static const IAudioClient3Vtbl AudioClient3_Vtbl = -{ - client_QueryInterface, - client_AddRef, - client_Release, - client_Initialize, - client_GetBufferSize, - client_GetStreamLatency, - client_GetCurrentPadding, - client_IsFormatSupported, - client_GetMixFormat, - client_GetDevicePeriod, - client_Start, - client_Stop, - client_Reset, - client_SetEventHandle, - client_GetService, - client_IsOffloadCapable, - client_SetClientProperties, - client_GetBufferSizeLimits, - client_GetSharedModeEnginePeriod, - client_GetCurrentSharedModeEnginePeriod, - client_InitializeSharedAudioStream, -}; - HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) {
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winealsa.drv/mmdevdrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 52a56a9c281..0e40d398530 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -326,7 +326,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient return AUDCLNT_E_DEVICE_INVALIDATED;
if(dataflow != eRender && dataflow != eCapture) - return E_UNEXPECTED; + return E_INVALIDARG;
len = strlen(alsa_name); This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1]));
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/wineoss.drv/mmdevdrv.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 3322374cb90..5a1e2414806 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -306,6 +306,10 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, WARN("Unknown GUID: %s\n", debugstr_guid(guid)); return AUDCLNT_E_DEVICE_INVALIDATED; } + + if(oss_dev->flow != eRender && oss_dev->flow != eCapture) + return E_INVALIDARG; + len = strlen(oss_dev->devnode); This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1])); if(!This)
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index b3b0bad2990..246fb2847a4 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -342,6 +342,9 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient if (!get_pulse_name_by_guid(guid, pulse_name, &dataflow)) return AUDCLNT_E_DEVICE_INVALIDATED;
+ if (dataflow != eRender && dataflow != eCapture) + return E_INVALIDARG; + *out = NULL;
len = strlen(pulse_name) + 1;
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/wineoss.drv/mmdevdrv.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 5a1e2414806..826adcfde2d 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -204,18 +204,24 @@ static void get_device_guid(EDataFlow flow, const char *device, GUID *guid) RegCloseKey(key); }
-static const OSSDevice *get_ossdevice_from_guid(const GUID *guid) +static BOOL get_device_name_by_guid(const GUID *guid, char *name, const SIZE_T name_size, EDataFlow *flow) { OSSDevice *dev_item; - LIST_FOR_EACH_ENTRY(dev_item, &g_devices, OSSDevice, entry) - if(IsEqualGUID(guid, &dev_item->guid)) - return dev_item; - return NULL; + LIST_FOR_EACH_ENTRY(dev_item, &g_devices, OSSDevice, entry){ + if(IsEqualGUID(guid, &dev_item->guid)){ + if(flow) + *flow = dev_item->flow; + strncpy(name, dev_item->devnode, name_size); + return TRUE; + } + } + + return FALSE; }
static void device_add(OSSDevice *oss_dev) { - if(get_ossdevice_from_guid(&oss_dev->guid)) /* already in list */ + if(get_device_name_by_guid(&oss_dev->guid, NULL, 0, NULL)) /* already in list */ HeapFree(GetProcessHeap(), 0, oss_dev); else list_add_tail(&g_devices, &oss_dev->entry); @@ -295,22 +301,22 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out) { ACImpl *This; - const OSSDevice *oss_dev; + char name[256]; + SIZE_T len; + EDataFlow dataflow; HRESULT hr; - int len;
TRACE("%s %p %p\n", debugstr_guid(guid), dev, out);
- oss_dev = get_ossdevice_from_guid(guid); - if(!oss_dev){ + if(!get_device_name_by_guid(guid, name, sizeof(name), &dataflow)){ WARN("Unknown GUID: %s\n", debugstr_guid(guid)); return AUDCLNT_E_DEVICE_INVALIDATED; }
- if(oss_dev->flow != eRender && oss_dev->flow != eCapture) + if(dataflow != eRender && dataflow != eCapture) return E_INVALIDARG;
- len = strlen(oss_dev->devnode); + len = strlen(name); This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1])); if(!This) return E_OUTOFMEMORY; @@ -321,8 +327,8 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, return hr; }
- This->dataflow = oss_dev->flow; - strcpy(This->device_name, oss_dev->devnode); + This->dataflow = dataflow; + memcpy(This->device_name, name, len + 1);
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl; This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=134251
Your paranoid android.
=== debian11 (build log) ===
../wine/include/winbase.h:2948:24: error: unknown type name ���error���; did you mean ���errno_t���? Task: The win32 Wine build failed
=== debian11b (build log) ===
../wine/include/winbase.h:2948:24: error: unknown type name ���error���; did you mean ���errno_t���? Task: The wow64 Wine build failed
Davide Beatrici (@davidebeatrici) commented about dlls/winepulse.drv/mmdevdrv.c:
if (!get_pulse_name_by_guid(guid, pulse_name, &dataflow)) return AUDCLNT_E_DEVICE_INVALIDATED;
- if (dataflow != eRender && dataflow != eCapture)
return E_INVALIDARG;
- *out = NULL;
I wonder whether this is the actual behavior on Windows.
`winepulse` is the only driver that sets the pointer to `NULL` (and only after validating the device).
On Wed Jun 28 03:03:57 2023 +0000, Davide Beatrici wrote:
I wonder whether this is the actual behavior on Windows. `winepulse` is the only driver that sets the pointer to `NULL` (and only after validating the device).
It's rather difficult to test on Windows since the failures generally shouldn't happen. I'd probably move the `NULL` init to the beginning.
Also, I'd probably use `E_UNEXPECTED` for the `dataflow` error - again it's hard to test since this really shouldn't fail.
Huw Davies (@huw) commented about dlls/wineoss.drv/mmdevdrv.c:
RegCloseKey(key);
}
-static const OSSDevice *get_ossdevice_from_guid(const GUID *guid) +static BOOL get_device_name_by_guid(const GUID *guid, char *name, const SIZE_T name_size, EDataFlow *flow) { OSSDevice *dev_item;
- LIST_FOR_EACH_ENTRY(dev_item, &g_devices, OSSDevice, entry)
if(IsEqualGUID(guid, &dev_item->guid))
return dev_item;
- return NULL;
- LIST_FOR_EACH_ENTRY(dev_item, &g_devices, OSSDevice, entry){
if(IsEqualGUID(guid, &dev_item->guid)){
if(flow)
*flow = dev_item->flow;
strncpy(name, dev_item->devnode, name_size);
Let's please not use `strncpy()`.
On Wed Jun 28 06:21:26 2023 +0000, Huw Davies wrote:
It's rather difficult to test on Windows since the failures generally shouldn't happen. I'd probably move the `NULL` init to the beginning. Also, I'd probably use `E_UNEXPECTED` for the `dataflow` error - again it's hard to test since this really shouldn't fail.
Isn't this function a "reflection" of `IMMDeviceEnumerator::GetDefaultAudioEndpoint()`?
I tried passing a value of `2` (invalid) on Windows and got `E_INVALIDARG`.
On Wed Jun 28 06:22:09 2023 +0000, Huw Davies wrote:
Let's please not use `strncpy()`.
What's the preferred alternative?
On Wed Jun 28 06:25:46 2023 +0000, Davide Beatrici wrote:
Isn't this function a "reflection" of `IMMDeviceEnumerator::GetDefaultAudioEndpoint()`? I tried passing a value of `2` (invalid) on Windows and got `E_INVALIDARG`.
Not really, but I don't care too much either way.
On Wed Jun 28 06:26:29 2023 +0000, Davide Beatrici wrote:
What's the preferred alternative?
I think ideally we'd have `get_device_name_from_guid()`[1] `malloc()` the name itself which the caller would be expected to `free()`.
[1] I slightly prefer `_from_guid()` over `_by_guid()`.
On Wed Jun 28 06:47:44 2023 +0000, Huw Davies wrote:
I think ideally we'd have `get_device_name_from_guid()`[1] `malloc()` the name itself which the caller would be expected to `free()`. [1] I slightly prefer `_from_guid()` over `_by_guid()`.
Agreed.
I'd probably move the `NULL` init to the beginning.
I'll do it in the next merge request, which will move `GetAudioEndpoint` into `mmdevapi`.