To be merged after !2906.
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/client.c | 91 +++++++++++++++++++++++++++++ dlls/winepulse.drv/mmdevdrv.c | 106 ++++++---------------------------- 2 files changed, 109 insertions(+), 88 deletions(-)
diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index ea279da34a1..acc3868ce6a 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -53,6 +53,11 @@ static inline struct audio_client *impl_from_IAudioCaptureClient(IAudioCaptureCl return CONTAINING_RECORD(iface, struct audio_client, IAudioCaptureClient_iface); }
+static inline struct audio_client *impl_from_IAudioClient3(IAudioClient3 *iface) +{ + return CONTAINING_RECORD(iface, struct audio_client, IAudioClient3_iface); +} + static inline struct audio_client *impl_from_IAudioClock(IAudioClock *iface) { return CONTAINING_RECORD(iface, struct audio_client, IAudioClock_iface); @@ -341,6 +346,92 @@ const IAudioClock2Vtbl AudioClock2_Vtbl = clock2_GetDevicePosition };
+HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, AUDIO_STREAM_CATEGORY category, + BOOL *offload_capable) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + + TRACE("(%p)->(0x%x, %p)\n", This, category, offload_capable); + + if (!offload_capable) + return E_INVALIDARG; + + *offload_capable = FALSE; + + return S_OK; +} + +HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, + const AudioClientProperties *prop) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop; + + TRACE("(%p)->(%p)\n", This, prop); + + if (!legacy_prop) + return E_POINTER; + + if (legacy_prop->cbSize == sizeof(AudioClientProperties)) { + TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n", legacy_prop->bIsOffload, + legacy_prop->eCategory, + prop->Options); + } else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)) { + TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n", legacy_prop->bIsOffload, + legacy_prop->eCategory); + } else { + WARN("Unsupported Size = %d\n", legacy_prop->cbSize); + return E_INVALIDARG; + } + + if (legacy_prop->bIsOffload) + return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; + + return S_OK; +} + +HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, const WAVEFORMATEX *format, + BOOL event_driven, REFERENCE_TIME *min_duration, + REFERENCE_TIME *max_duration) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + FIXME("(%p)->(%p, %u, %p, %p) - stub\n", This, format, event_driven, min_duration, max_duration); + return E_NOTIMPL; +} + +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) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + FIXME("(%p)->(%p, %p, %p, %p, %p) - stub\n", This, format, default_period_frames, + unit_period_frames, min_period_frames, + max_period_frames); + return E_NOTIMPL; +} + +HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, + WAVEFORMATEX **cur_format, + UINT32 *cur_period_frames) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + FIXME("(%p)->(%p, %p) - stub\n", This, cur_format, cur_period_frames); + return E_NOTIMPL; +} + +HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, DWORD flags, + UINT32 period_frames, + const WAVEFORMATEX *format, + const GUID *session_guid) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + FIXME("(%p)->(0x%lx, %u, %p, %s) - stub\n", This, flags, period_frames, format, debugstr_guid(session_guid)); + return E_NOTIMPL; +} + static HRESULT WINAPI render_QueryInterface(IAudioRenderClient *iface, REFIID riid, void **ppv) { struct audio_client *This = impl_from_IAudioRenderClient(iface); diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 110f23e1319..def79d7f961 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -1071,96 +1071,26 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, return E_NOINTERFACE; }
-static HRESULT WINAPI AudioClient_IsOffloadCapable(IAudioClient3 *iface, - AUDIO_STREAM_CATEGORY category, BOOL *offload_capable) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - TRACE("(%p)->(0x%x, %p)\n", This, category, offload_capable); - - if(!offload_capable) - return E_INVALIDARG; - - *offload_capable = FALSE; +extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, + AUDIO_STREAM_CATEGORY category, BOOL *offload_capable);
- return S_OK; -} - -static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, - const AudioClientProperties *prop) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop; - - TRACE("(%p)->(%p)\n", This, prop); - - if(!legacy_prop) - return E_POINTER; - - if(legacy_prop->cbSize == sizeof(AudioClientProperties)){ - TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n", - legacy_prop->bIsOffload, - legacy_prop->eCategory, - prop->Options); - }else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){ - TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n", - legacy_prop->bIsOffload, - legacy_prop->eCategory); - }else{ - WARN("Unsupported Size = %d\n", legacy_prop->cbSize); - return E_INVALIDARG; - } - - - if(legacy_prop->bIsOffload) - return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; - - return S_OK; -} +extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, + const AudioClientProperties *prop);
-static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient3 *iface, +extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, - REFERENCE_TIME *max_duration) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(%p, %u, %p, %p)\n", This, format, event_driven, min_duration, max_duration); - - return E_NOTIMPL; -} + REFERENCE_TIME *max_duration);
-static HRESULT WINAPI AudioClient_GetSharedModeEnginePeriod(IAudioClient3 *iface, +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) -{ - ACImpl *This = impl_from_IAudioClient3(iface); + UINT32 *min_period_frames, UINT32 *max_period_frames);
- FIXME("(%p)->(%p, %p, %p, %p, %p)\n", This, format, default_period_frames, unit_period_frames, - min_period_frames, max_period_frames); +extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, + WAVEFORMATEX **cur_format, UINT32 *cur_period_frames);
- return E_NOTIMPL; -} - -static HRESULT WINAPI AudioClient_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, - WAVEFORMATEX **cur_format, UINT32 *cur_period_frames) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(%p, %p)\n", This, cur_format, cur_period_frames); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioClient_InitializeSharedAudioStream(IAudioClient3 *iface, +extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, - const GUID *session_guid) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(0x%lx, %u, %p, %s)\n", This, flags, period_frames, format, debugstr_guid(session_guid)); - - return E_NOTIMPL; -} + const GUID *session_guid);
static const IAudioClient3Vtbl AudioClient3_Vtbl = { @@ -1179,12 +1109,12 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_Reset, AudioClient_SetEventHandle, AudioClient_GetService, - AudioClient_IsOffloadCapable, - AudioClient_SetClientProperties, - AudioClient_GetBufferSizeLimits, - AudioClient_GetSharedModeEnginePeriod, - AudioClient_GetCurrentSharedModeEnginePeriod, - AudioClient_InitializeSharedAudioStream, + client_IsOffloadCapable, + client_SetClientProperties, + client_GetBufferSizeLimits, + client_GetSharedModeEnginePeriod, + client_GetCurrentSharedModeEnginePeriod, + client_InitializeSharedAudioStream, };
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client)
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winealsa.drv/mmdevdrv.c | 106 ++++++----------------------------- 1 file changed, 18 insertions(+), 88 deletions(-)
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 57a0ed06733..8961f1a3c1d 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -978,96 +978,26 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, return E_NOINTERFACE; }
-static HRESULT WINAPI AudioClient_IsOffloadCapable(IAudioClient3 *iface, - AUDIO_STREAM_CATEGORY category, BOOL *offload_capable) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - TRACE("(%p)->(0x%x, %p)\n", This, category, offload_capable); - - if(!offload_capable) - return E_INVALIDARG; - - *offload_capable = FALSE; - - return S_OK; -} - -static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, - const AudioClientProperties *prop) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop; - - TRACE("(%p)->(%p)\n", This, prop); +extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, + AUDIO_STREAM_CATEGORY category, BOOL *offload_capable);
- if(!legacy_prop) - return E_POINTER; +extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, + const AudioClientProperties *prop);
- if(legacy_prop->cbSize == sizeof(AudioClientProperties)){ - TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n", - legacy_prop->bIsOffload, - legacy_prop->eCategory, - prop->Options); - }else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){ - TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n", - legacy_prop->bIsOffload, - legacy_prop->eCategory); - }else{ - WARN("Unsupported Size = %d\n", legacy_prop->cbSize); - return E_INVALIDARG; - } - - - if(legacy_prop->bIsOffload) - return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; - - return S_OK; -} - -static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient3 *iface, +extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, - REFERENCE_TIME *max_duration) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(%p, %u, %p, %p)\n", This, format, event_driven, min_duration, max_duration); - - return E_NOTIMPL; -} + REFERENCE_TIME *max_duration);
-static HRESULT WINAPI AudioClient_GetSharedModeEnginePeriod(IAudioClient3 *iface, +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) -{ - ACImpl *This = impl_from_IAudioClient3(iface); + UINT32 *min_period_frames, UINT32 *max_period_frames);
- FIXME("(%p)->(%p, %p, %p, %p, %p)\n", This, format, default_period_frames, unit_period_frames, - min_period_frames, max_period_frames); +extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, + WAVEFORMATEX **cur_format, UINT32 *cur_period_frames);
- return E_NOTIMPL; -} - -static HRESULT WINAPI AudioClient_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, - WAVEFORMATEX **cur_format, UINT32 *cur_period_frames) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(%p, %p)\n", This, cur_format, cur_period_frames); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioClient_InitializeSharedAudioStream(IAudioClient3 *iface, +extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, - const GUID *session_guid) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(0x%lx, %u, %p, %s)\n", This, flags, period_frames, format, debugstr_guid(session_guid)); - - return E_NOTIMPL; -} + const GUID *session_guid);
static const IAudioClient3Vtbl AudioClient3_Vtbl = { @@ -1086,12 +1016,12 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_Reset, AudioClient_SetEventHandle, AudioClient_GetService, - AudioClient_IsOffloadCapable, - AudioClient_SetClientProperties, - AudioClient_GetBufferSizeLimits, - AudioClient_GetSharedModeEnginePeriod, - AudioClient_GetCurrentSharedModeEnginePeriod, - AudioClient_InitializeSharedAudioStream, + client_IsOffloadCapable, + client_SetClientProperties, + client_GetBufferSizeLimits, + client_GetSharedModeEnginePeriod, + client_GetCurrentSharedModeEnginePeriod, + client_InitializeSharedAudioStream, };
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client)
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winecoreaudio.drv/mmdevdrv.c | 106 +++++------------------------- 1 file changed, 18 insertions(+), 88 deletions(-)
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 0372e320680..67bf7b122a4 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -943,96 +943,26 @@ end: return hr; }
-static HRESULT WINAPI AudioClient_IsOffloadCapable(IAudioClient3 *iface, - AUDIO_STREAM_CATEGORY category, BOOL *offload_capable) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - TRACE("(%p)->(0x%x, %p)\n", This, category, offload_capable); - - if(!offload_capable) - return E_INVALIDARG; - - *offload_capable = FALSE; - - return S_OK; -} - -static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, - const AudioClientProperties *prop) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop; - - TRACE("(%p)->(%p)\n", This, prop); +extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, + AUDIO_STREAM_CATEGORY category, BOOL *offload_capable);
- if(!legacy_prop) - return E_POINTER; +extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, + const AudioClientProperties *prop);
- if(legacy_prop->cbSize == sizeof(AudioClientProperties)){ - TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n", - legacy_prop->bIsOffload, - legacy_prop->eCategory, - prop->Options); - }else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){ - TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n", - legacy_prop->bIsOffload, - legacy_prop->eCategory); - }else{ - WARN("Unsupported Size = %d\n", legacy_prop->cbSize); - return E_INVALIDARG; - } - - - if(legacy_prop->bIsOffload) - return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; - - return S_OK; -} - -static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient3 *iface, +extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, - REFERENCE_TIME *max_duration) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(%p, %u, %p, %p)\n", This, format, event_driven, min_duration, max_duration); - - return E_NOTIMPL; -} + REFERENCE_TIME *max_duration);
-static HRESULT WINAPI AudioClient_GetSharedModeEnginePeriod(IAudioClient3 *iface, +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) -{ - ACImpl *This = impl_from_IAudioClient3(iface); + UINT32 *min_period_frames, UINT32 *max_period_frames);
- FIXME("(%p)->(%p, %p, %p, %p, %p)\n", This, format, default_period_frames, unit_period_frames, - min_period_frames, max_period_frames); +extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, + WAVEFORMATEX **cur_format, UINT32 *cur_period_frames);
- return E_NOTIMPL; -} - -static HRESULT WINAPI AudioClient_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, - WAVEFORMATEX **cur_format, UINT32 *cur_period_frames) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(%p, %p)\n", This, cur_format, cur_period_frames); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioClient_InitializeSharedAudioStream(IAudioClient3 *iface, +extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, - const GUID *session_guid) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(0x%lx, %u, %p, %s)\n", This, flags, period_frames, format, debugstr_guid(session_guid)); - - return E_NOTIMPL; -} + const GUID *session_guid);
static const IAudioClient3Vtbl AudioClient3_Vtbl = { @@ -1051,12 +981,12 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_Reset, AudioClient_SetEventHandle, AudioClient_GetService, - AudioClient_IsOffloadCapable, - AudioClient_SetClientProperties, - AudioClient_GetBufferSizeLimits, - AudioClient_GetSharedModeEnginePeriod, - AudioClient_GetCurrentSharedModeEnginePeriod, - AudioClient_InitializeSharedAudioStream, + client_IsOffloadCapable, + client_SetClientProperties, + client_GetBufferSizeLimits, + client_GetSharedModeEnginePeriod, + client_GetCurrentSharedModeEnginePeriod, + client_InitializeSharedAudioStream, };
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client)
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/wineoss.drv/mmdevdrv.c | 106 ++++++------------------------------ 1 file changed, 18 insertions(+), 88 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 9537a2f92fc..c282fb88831 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -941,96 +941,26 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, return E_NOINTERFACE; }
-static HRESULT WINAPI AudioClient_IsOffloadCapable(IAudioClient3 *iface, - AUDIO_STREAM_CATEGORY category, BOOL *offload_capable) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - TRACE("(%p)->(0x%x, %p)\n", This, category, offload_capable); - - if(!offload_capable) - return E_INVALIDARG; - - *offload_capable = FALSE; - - return S_OK; -} - -static HRESULT WINAPI AudioClient_SetClientProperties(IAudioClient3 *iface, - const AudioClientProperties *prop) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - const Win8AudioClientProperties *legacy_prop = (const Win8AudioClientProperties *)prop; - - TRACE("(%p)->(%p)\n", This, prop); +extern HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, + AUDIO_STREAM_CATEGORY category, BOOL *offload_capable);
- if(!legacy_prop) - return E_POINTER; +extern HRESULT WINAPI client_SetClientProperties(IAudioClient3 *iface, + const AudioClientProperties *prop);
- if(legacy_prop->cbSize == sizeof(AudioClientProperties)){ - TRACE("{ bIsOffload: %u, eCategory: 0x%x, Options: 0x%x }\n", - legacy_prop->bIsOffload, - legacy_prop->eCategory, - prop->Options); - }else if(legacy_prop->cbSize == sizeof(Win8AudioClientProperties)){ - TRACE("{ bIsOffload: %u, eCategory: 0x%x }\n", - legacy_prop->bIsOffload, - legacy_prop->eCategory); - }else{ - WARN("Unsupported Size = %d\n", legacy_prop->cbSize); - return E_INVALIDARG; - } - - - if(legacy_prop->bIsOffload) - return AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE; - - return S_OK; -} - -static HRESULT WINAPI AudioClient_GetBufferSizeLimits(IAudioClient3 *iface, +extern HRESULT WINAPI client_GetBufferSizeLimits(IAudioClient3 *iface, const WAVEFORMATEX *format, BOOL event_driven, REFERENCE_TIME *min_duration, - REFERENCE_TIME *max_duration) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(%p, %u, %p, %p)\n", This, format, event_driven, min_duration, max_duration); - - return E_NOTIMPL; -} + REFERENCE_TIME *max_duration);
-static HRESULT WINAPI AudioClient_GetSharedModeEnginePeriod(IAudioClient3 *iface, +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) -{ - ACImpl *This = impl_from_IAudioClient3(iface); + UINT32 *min_period_frames, UINT32 *max_period_frames);
- FIXME("(%p)->(%p, %p, %p, %p, %p)\n", This, format, default_period_frames, unit_period_frames, - min_period_frames, max_period_frames); +extern HRESULT WINAPI client_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, + WAVEFORMATEX **cur_format, UINT32 *cur_period_frames);
- return E_NOTIMPL; -} - -static HRESULT WINAPI AudioClient_GetCurrentSharedModeEnginePeriod(IAudioClient3 *iface, - WAVEFORMATEX **cur_format, UINT32 *cur_period_frames) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(%p, %p)\n", This, cur_format, cur_period_frames); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioClient_InitializeSharedAudioStream(IAudioClient3 *iface, +extern HRESULT WINAPI client_InitializeSharedAudioStream(IAudioClient3 *iface, DWORD flags, UINT32 period_frames, const WAVEFORMATEX *format, - const GUID *session_guid) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - FIXME("(%p)->(0x%lx, %u, %p, %s)\n", This, flags, period_frames, format, debugstr_guid(session_guid)); - - return E_NOTIMPL; -} + const GUID *session_guid);
static const IAudioClient3Vtbl AudioClient3_Vtbl = { @@ -1049,12 +979,12 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_Reset, AudioClient_SetEventHandle, AudioClient_GetService, - AudioClient_IsOffloadCapable, - AudioClient_SetClientProperties, - AudioClient_GetBufferSizeLimits, - AudioClient_GetSharedModeEnginePeriod, - AudioClient_GetCurrentSharedModeEnginePeriod, - AudioClient_InitializeSharedAudioStream, + client_IsOffloadCapable, + client_SetClientProperties, + client_GetBufferSizeLimits, + client_GetSharedModeEnginePeriod, + client_GetCurrentSharedModeEnginePeriod, + client_InitializeSharedAudioStream, };
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client)
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/client.c | 183 ++++++++++++++++++++++++++++++++++ dlls/mmdevapi/session.c | 28 ++++++ dlls/winepulse.drv/mmdevdrv.c | 170 +++---------------------------- 3 files changed, 226 insertions(+), 155 deletions(-)
diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index acc3868ce6a..219d4753afa 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -36,6 +36,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi); extern void sessions_lock(void) DECLSPEC_HIDDEN; extern void sessions_unlock(void) DECLSPEC_HIDDEN;
+extern struct audio_session_wrapper *session_wrapper_create(struct audio_client *client) DECLSPEC_HIDDEN; + void set_stream_volumes(struct audio_client *This) { struct set_volumes_params params; @@ -78,6 +80,20 @@ static inline struct audio_client *impl_from_IAudioStreamVolume(IAudioStreamVolu return CONTAINING_RECORD(iface, struct audio_client, IAudioStreamVolume_iface); }
+static DWORD CALLBACK timer_loop_func(void *user) +{ + struct timer_loop_params params; + struct audio_client *This = user; + + SetThreadDescription(GetCurrentThread(), L"audio_client_timer"); + + params.stream = This->stream; + + WINE_UNIX_CALL(timer_loop, ¶ms); + + return 0; +} + static HRESULT WINAPI capture_QueryInterface(IAudioCaptureClient *iface, REFIID riid, void **ppv) { struct audio_client *This = impl_from_IAudioCaptureClient(iface); @@ -346,6 +362,173 @@ const IAudioClock2Vtbl AudioClock2_Vtbl = clock2_GetDevicePosition };
+HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, REFERENCE_TIME *defperiod, + REFERENCE_TIME *minperiod) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + struct get_device_period_params params; + + TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); + + if (!defperiod && !minperiod) + return E_POINTER; + + params.device = This->device_name; + params.flow = This->dataflow; + params.def_period = defperiod; + params.min_period = minperiod; + + WINE_UNIX_CALL(get_device_period, ¶ms); + + return S_OK; +} + +HRESULT WINAPI client_Start(IAudioClient3 *iface) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + struct start_params params; + + TRACE("(%p)\n", This); + + sessions_lock(); + + if (!This->stream) { + sessions_unlock(); + return AUDCLNT_E_NOT_INITIALIZED; + } + + params.stream = This->stream; + + WINE_UNIX_CALL(start, ¶ms); + + if (SUCCEEDED(params.result) && !This->timer_thread) { + This->timer_thread = CreateThread(NULL, 0, timer_loop_func, This, 0, NULL); + SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL); + } + + sessions_unlock(); + + return params.result; +} + +HRESULT WINAPI client_Stop(IAudioClient3 *iface) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + struct stop_params params; + + TRACE("(%p)\n", This); + + if (!This->stream) + return AUDCLNT_E_NOT_INITIALIZED; + + params.stream = This->stream; + + WINE_UNIX_CALL(stop, ¶ms); + + return params.result; +} + +HRESULT WINAPI client_Reset(IAudioClient3 *iface) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + struct reset_params params; + + TRACE("(%p)\n", This); + + if (!This->stream) + return AUDCLNT_E_NOT_INITIALIZED; + + params.stream = This->stream; + + WINE_UNIX_CALL(reset, ¶ms); + + return params.result; +} + +HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, HANDLE event) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + struct set_event_handle_params params; + + TRACE("(%p)->(%p)\n", This, event); + + if (!event) + return E_INVALIDARG; + + if (!This->stream) + return AUDCLNT_E_NOT_INITIALIZED; + + params.stream = This->stream; + params.event = event; + + WINE_UNIX_CALL(set_event_handle, ¶ms); + + return params.result; +} + +HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, void **ppv) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + + TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv); + + if (!ppv) + return E_POINTER; + + *ppv = NULL; + + sessions_lock(); + + if (!This->stream) { + sessions_unlock(); + return AUDCLNT_E_NOT_INITIALIZED; + } + + if (IsEqualIID(riid, &IID_IAudioRenderClient)) { + if (This->dataflow != eRender) { + sessions_unlock(); + return AUDCLNT_E_WRONG_ENDPOINT_TYPE; + } + *ppv = &This->IAudioRenderClient_iface; + } else if (IsEqualIID(riid, &IID_IAudioCaptureClient)) { + if (This->dataflow != eCapture) { + sessions_unlock(); + return AUDCLNT_E_WRONG_ENDPOINT_TYPE; + } + *ppv = &This->IAudioCaptureClient_iface; + } else if (IsEqualIID(riid, &IID_IAudioClock)) { + *ppv = &This->IAudioClock_iface; + } else if (IsEqualIID(riid, &IID_IAudioStreamVolume)) { + *ppv = &This->IAudioStreamVolume_iface; + } else if (IsEqualIID(riid, &IID_IAudioSessionControl) || + IsEqualIID(riid, &IID_IChannelAudioVolume) || + IsEqualIID(riid, &IID_ISimpleAudioVolume)) { + if (!This->session_wrapper) { + This->session_wrapper = session_wrapper_create(This); + if (!This->session_wrapper) { + sessions_unlock(); + return E_OUTOFMEMORY; + } + } + if (IsEqualIID(riid, &IID_IAudioSessionControl)) + *ppv = &This->session_wrapper->IAudioSessionControl2_iface; + else if (IsEqualIID(riid, &IID_IChannelAudioVolume)) + *ppv = &This->session_wrapper->IChannelAudioVolume_iface; + else if (IsEqualIID(riid, &IID_ISimpleAudioVolume)) + *ppv = &This->session_wrapper->ISimpleAudioVolume_iface; + } + + if (*ppv) { + IUnknown_AddRef((IUnknown*)*ppv); + sessions_unlock(); + return S_OK; + } + + sessions_unlock(); + + return E_NOINTERFACE; +} + HRESULT WINAPI client_IsOffloadCapable(IAudioClient3 *iface, AUDIO_STREAM_CATEGORY category, BOOL *offload_capable) { diff --git a/dlls/mmdevapi/session.c b/dlls/mmdevapi/session.c index 81cea5b3482..fa012392108 100644 --- a/dlls/mmdevapi/session.c +++ b/dlls/mmdevapi/session.c @@ -1,4 +1,9 @@ /* + * Copyright 2011-2012 Maarten Lankhorst + * Copyright 2010-2011 Maarten Lankhorst for CodeWeavers + * Copyright 2011 Andrew Eikum for CodeWeavers + * Copyright 2022 Huw Davies + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -545,3 +550,26 @@ const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl = simplevolume_SetMute, simplevolume_GetMute }; + +struct audio_session_wrapper *session_wrapper_create(struct audio_client *client) +{ + struct audio_session_wrapper *ret; + + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct audio_session_wrapper)); + if (!ret) + return NULL; + + ret->IAudioSessionControl2_iface.lpVtbl = &AudioSessionControl2_Vtbl; + ret->IChannelAudioVolume_iface.lpVtbl = &ChannelAudioVolume_Vtbl; + ret->ISimpleAudioVolume_iface.lpVtbl = &SimpleAudioVolume_Vtbl; + + ret->ref = !client; + ret->client = client; + + if (client) { + ret->session = client->session; + IAudioClient3_AddRef(&client->IAudioClient3_iface); + } + + return ret; +} diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index def79d7f961..417d6653d30 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -274,16 +274,6 @@ static WCHAR *get_application_name(BOOL query_app_name) return wcsdup(name); }
-static DWORD WINAPI pulse_timer_cb(void *user) -{ - struct timer_loop_params params; - ACImpl *This = user; - params.stream = This->stream; - SetThreadDescription(GetCurrentThread(), L"winepulse_timer_loop"); - pulse_call(timer_loop, ¶ms); - return 0; -} - static void set_stream_volumes(ACImpl *This) { struct set_volumes_params params; @@ -926,150 +916,20 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, return params.result; }
-static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) -{ - struct get_device_period_params params; - ACImpl *This = impl_from_IAudioClient3(iface); - - TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); - - if (!defperiod && !minperiod) - return E_POINTER; - - params.flow = This->dataflow; - params.device = This->device_name; - params.def_period = defperiod; - params.min_period = minperiod; +extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, + REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod);
- pulse_call(get_device_period, ¶ms); +extern HRESULT WINAPI client_Start(IAudioClient3 *iface);
- return params.result; -} +extern HRESULT WINAPI client_Stop(IAudioClient3 *iface);
-static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct start_params params; - HRESULT hr; +extern HRESULT WINAPI client_Reset(IAudioClient3 *iface);
- TRACE("(%p)\n", This); +extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, + HANDLE event);
- if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - pulse_call(start, ¶ms); - if (FAILED(hr = params.result)) - return hr; - - if (!This->timer_thread) { - This->timer_thread = CreateThread(NULL, 0, pulse_timer_cb, This, 0, NULL); - SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL); - } - - return S_OK; -} - -static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct stop_params params; - - TRACE("(%p)\n", This); - - if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - pulse_call(stop, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct reset_params params; - - TRACE("(%p)\n", This); - - if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - pulse_call(reset, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, - HANDLE event) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct set_event_handle_params params; - - TRACE("(%p)->(%p)\n", This, event); - - if (!event) - return E_INVALIDARG; - if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - params.event = event; - pulse_call(set_event_handle, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, - void **ppv) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv); - - if (!ppv) - return E_POINTER; - *ppv = NULL; - - if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - if (IsEqualIID(riid, &IID_IAudioRenderClient)) { - if (This->dataflow != eRender) - return AUDCLNT_E_WRONG_ENDPOINT_TYPE; - *ppv = &This->IAudioRenderClient_iface; - } else if (IsEqualIID(riid, &IID_IAudioCaptureClient)) { - if (This->dataflow != eCapture) - return AUDCLNT_E_WRONG_ENDPOINT_TYPE; - *ppv = &This->IAudioCaptureClient_iface; - } else if (IsEqualIID(riid, &IID_IAudioClock)) { - *ppv = &This->IAudioClock_iface; - } else if (IsEqualIID(riid, &IID_IAudioStreamVolume)) { - *ppv = &This->IAudioStreamVolume_iface; - } else if (IsEqualIID(riid, &IID_IAudioSessionControl) || - IsEqualIID(riid, &IID_IChannelAudioVolume) || - IsEqualIID(riid, &IID_ISimpleAudioVolume)) { - if (!This->session_wrapper) { - This->session_wrapper = AudioSessionWrapper_Create(This); - if (!This->session_wrapper) - return E_OUTOFMEMORY; - } - if (IsEqualIID(riid, &IID_IAudioSessionControl)) - *ppv = &This->session_wrapper->IAudioSessionControl2_iface; - else if (IsEqualIID(riid, &IID_IChannelAudioVolume)) - *ppv = &This->session_wrapper->IChannelAudioVolume_iface; - else if (IsEqualIID(riid, &IID_ISimpleAudioVolume)) - *ppv = &This->session_wrapper->ISimpleAudioVolume_iface; - } - - if (*ppv) { - IUnknown_AddRef((IUnknown*)*ppv); - return S_OK; - } - - FIXME("stub %s\n", debugstr_guid(riid)); - return E_NOINTERFACE; -} +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); @@ -1103,12 +963,12 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_GetCurrentPadding, AudioClient_IsFormatSupported, AudioClient_GetMixFormat, - AudioClient_GetDevicePeriod, - AudioClient_Start, - AudioClient_Stop, - AudioClient_Reset, - AudioClient_SetEventHandle, - AudioClient_GetService, + client_GetDevicePeriod, + client_Start, + client_Stop, + client_Reset, + client_SetEventHandle, + client_GetService, client_IsOffloadCapable, client_SetClientProperties, client_GetBufferSizeLimits,
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winealsa.drv/mmdevdrv.c | 218 +++-------------------------------- 1 file changed, 15 insertions(+), 203 deletions(-)
diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 8961f1a3c1d..718de9e7e64 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -134,20 +134,6 @@ static HRESULT alsa_stream_release(stream_handle stream, HANDLE timer_thread) return params.result; }
-static DWORD WINAPI alsa_timer_thread(void *user) -{ - struct timer_loop_params params; - ACImpl *This = user; - - SetThreadDescription(GetCurrentThread(), L"winealsa_timer"); - - params.stream = This->stream; - - ALSA_CALL(timer_loop, ¶ms); - - return 0; -} - static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name, GUID *guid) { @@ -789,194 +775,20 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, return params.result; }
-static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct get_device_period_params params; - - TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); - - if (!defperiod && !minperiod) - return E_POINTER; - - params.device = This->device_name; - params.flow = This->dataflow; - params.def_period = defperiod; - params.min_period = minperiod; - - ALSA_CALL(get_device_period, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct start_params params; - - TRACE("(%p)\n", This); - - sessions_lock(); - - if(!This->stream){ - sessions_unlock(); - return AUDCLNT_E_NOT_INITIALIZED; - } - - params.stream = This->stream; - - ALSA_CALL(start, ¶ms); - - if(SUCCEEDED(params.result) && !This->timer_thread){ - This->timer_thread = CreateThread(NULL, 0, alsa_timer_thread, This, 0, NULL); - SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL); - } - - sessions_unlock(); - - return params.result; -} - -static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct stop_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - - ALSA_CALL(stop, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct reset_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - - ALSA_CALL(reset, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, - HANDLE event) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct set_event_handle_params params; - - TRACE("(%p)->(%p)\n", This, event); - - if(!event) - return E_INVALIDARG; - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - params.event = event; - - ALSA_CALL(set_event_handle, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, - void **ppv) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv); +extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, + REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod);
- if(!ppv) - return E_POINTER; - *ppv = NULL; +extern HRESULT WINAPI client_Start(IAudioClient3 *iface);
- sessions_lock(); +extern HRESULT WINAPI client_Stop(IAudioClient3 *iface);
- if(!This->stream){ - sessions_unlock(); - return AUDCLNT_E_NOT_INITIALIZED; - } +extern HRESULT WINAPI client_Reset(IAudioClient3 *iface);
- if(IsEqualIID(riid, &IID_IAudioRenderClient)){ - if(This->dataflow != eRender){ - sessions_unlock(); - return AUDCLNT_E_WRONG_ENDPOINT_TYPE; - } - IAudioRenderClient_AddRef(&This->IAudioRenderClient_iface); - *ppv = &This->IAudioRenderClient_iface; - }else if(IsEqualIID(riid, &IID_IAudioCaptureClient)){ - if(This->dataflow != eCapture){ - sessions_unlock(); - return AUDCLNT_E_WRONG_ENDPOINT_TYPE; - } - IAudioCaptureClient_AddRef(&This->IAudioCaptureClient_iface); - *ppv = &This->IAudioCaptureClient_iface; - }else if(IsEqualIID(riid, &IID_IAudioClock)){ - IAudioClock_AddRef(&This->IAudioClock_iface); - *ppv = &This->IAudioClock_iface; - }else if(IsEqualIID(riid, &IID_IAudioStreamVolume)){ - IAudioStreamVolume_AddRef(&This->IAudioStreamVolume_iface); - *ppv = &This->IAudioStreamVolume_iface; - }else if(IsEqualIID(riid, &IID_IAudioSessionControl)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - sessions_unlock(); - return E_OUTOFMEMORY; - } - }else - IAudioSessionControl2_AddRef(&This->session_wrapper->IAudioSessionControl2_iface); - - *ppv = &This->session_wrapper->IAudioSessionControl2_iface; - }else if(IsEqualIID(riid, &IID_IChannelAudioVolume)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - sessions_unlock(); - return E_OUTOFMEMORY; - } - }else - IChannelAudioVolume_AddRef(&This->session_wrapper->IChannelAudioVolume_iface); - - *ppv = &This->session_wrapper->IChannelAudioVolume_iface; - }else if(IsEqualIID(riid, &IID_ISimpleAudioVolume)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - sessions_unlock(); - return E_OUTOFMEMORY; - } - }else - ISimpleAudioVolume_AddRef(&This->session_wrapper->ISimpleAudioVolume_iface); - - *ppv = &This->session_wrapper->ISimpleAudioVolume_iface; - } +extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, + HANDLE event);
- if(*ppv){ - sessions_unlock(); - return S_OK; - } - - sessions_unlock(); - - FIXME("stub %s\n", debugstr_guid(riid)); - return E_NOINTERFACE; -} +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); @@ -1010,12 +822,12 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_GetCurrentPadding, AudioClient_IsFormatSupported, AudioClient_GetMixFormat, - AudioClient_GetDevicePeriod, - AudioClient_Start, - AudioClient_Stop, - AudioClient_Reset, - AudioClient_SetEventHandle, - AudioClient_GetService, + client_GetDevicePeriod, + client_Start, + client_Stop, + client_Reset, + client_SetEventHandle, + client_GetService, client_IsOffloadCapable, client_SetClientProperties, client_GetBufferSizeLimits,
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winecoreaudio.drv/mmdevdrv.c | 203 +++--------------------------- 1 file changed, 15 insertions(+), 188 deletions(-)
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 67bf7b122a4..79f1374286f 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -755,193 +755,20 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, return params.result; }
-static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct get_device_period_params params; - - TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); - - if (!defperiod && !minperiod) - return E_POINTER; - - params.device = This->device_name; - params.flow = This->dataflow; - params.def_period = defperiod; - params.min_period = minperiod; - - UNIX_CALL(get_device_period, ¶ms); - - return params.result; -} - -static DWORD WINAPI ca_timer_thread(void *user) -{ - struct timer_loop_params params; - ACImpl *This = user; - params.stream = This->stream; - SetThreadDescription(GetCurrentThread(), L"winecoreaudio_timer_loop"); - UNIX_CALL(timer_loop, ¶ms); - return 0; -} - -static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct start_params params; - HRESULT hr; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - UNIX_CALL(start, ¶ms); - if(FAILED(hr = params.result)) - return hr; - - 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; -} - -static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct stop_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - UNIX_CALL(stop, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct reset_params params; - - TRACE("(%p)\n", This); +extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, + REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod);
- if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - UNIX_CALL(reset, ¶ms); - return params.result; -} +extern HRESULT WINAPI client_Start(IAudioClient3 *iface);
-static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, - HANDLE event) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct set_event_handle_params params; - - TRACE("(%p)->(%p)\n", This, event); +extern HRESULT WINAPI client_Stop(IAudioClient3 *iface);
- if(!event) - return E_INVALIDARG; +extern HRESULT WINAPI client_Reset(IAudioClient3 *iface);
- if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; +extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, + HANDLE event);
- params.stream = This->stream; - params.event = event; - UNIX_CALL(set_event_handle, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, - void **ppv) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - HRESULT hr; - - TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv); - - if(!ppv) - return E_POINTER; - *ppv = NULL; - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - sessions_lock(); - - if(IsEqualIID(riid, &IID_IAudioRenderClient)){ - if(This->dataflow != eRender){ - hr = AUDCLNT_E_WRONG_ENDPOINT_TYPE; - goto end; - } - IAudioRenderClient_AddRef(&This->IAudioRenderClient_iface); - *ppv = &This->IAudioRenderClient_iface; - }else if(IsEqualIID(riid, &IID_IAudioCaptureClient)){ - if(This->dataflow != eCapture){ - hr = AUDCLNT_E_WRONG_ENDPOINT_TYPE; - goto end; - } - IAudioCaptureClient_AddRef(&This->IAudioCaptureClient_iface); - *ppv = &This->IAudioCaptureClient_iface; - }else if(IsEqualIID(riid, &IID_IAudioClock)){ - IAudioClock_AddRef(&This->IAudioClock_iface); - *ppv = &This->IAudioClock_iface; - }else if(IsEqualIID(riid, &IID_IAudioStreamVolume)){ - IAudioStreamVolume_AddRef(&This->IAudioStreamVolume_iface); - *ppv = &This->IAudioStreamVolume_iface; - }else if(IsEqualIID(riid, &IID_IAudioSessionControl)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - hr = E_OUTOFMEMORY; - goto end; - } - }else - IAudioSessionControl2_AddRef(&This->session_wrapper->IAudioSessionControl2_iface); - - *ppv = &This->session_wrapper->IAudioSessionControl2_iface; - }else if(IsEqualIID(riid, &IID_IChannelAudioVolume)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - hr = E_OUTOFMEMORY; - goto end; - } - }else - IChannelAudioVolume_AddRef(&This->session_wrapper->IChannelAudioVolume_iface); - - *ppv = &This->session_wrapper->IChannelAudioVolume_iface; - }else if(IsEqualIID(riid, &IID_ISimpleAudioVolume)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - hr = E_OUTOFMEMORY; - goto end; - } - }else - ISimpleAudioVolume_AddRef(&This->session_wrapper->ISimpleAudioVolume_iface); - - *ppv = &This->session_wrapper->ISimpleAudioVolume_iface; - } - - if(*ppv) hr = S_OK; - else{ - FIXME("stub %s\n", debugstr_guid(riid)); - hr = E_NOINTERFACE; - } - -end: - sessions_unlock(); - return hr; -} +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); @@ -975,12 +802,12 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_GetCurrentPadding, AudioClient_IsFormatSupported, AudioClient_GetMixFormat, - AudioClient_GetDevicePeriod, - AudioClient_Start, - AudioClient_Stop, - AudioClient_Reset, - AudioClient_SetEventHandle, - AudioClient_GetService, + client_GetDevicePeriod, + client_Start, + client_Stop, + client_Reset, + client_SetEventHandle, + client_GetService, client_IsOffloadCapable, client_SetClientProperties, client_GetBufferSizeLimits,
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/wineoss.drv/mmdevdrv.c | 211 +++--------------------------------- 1 file changed, 15 insertions(+), 196 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index c282fb88831..34bf0d96261 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -147,17 +147,6 @@ static HRESULT stream_release(stream_handle stream, HANDLE timer_thread) return params.result; }
-static DWORD WINAPI timer_thread(void *user) -{ - struct timer_loop_params params; - ACImpl *This = user; - - params.stream = This->stream; - OSS_CALL(timer_loop, ¶ms); - - return 0; -} - static void set_device_guid(EDataFlow flow, HKEY drv_key, const WCHAR *key_name, GUID *guid) { @@ -756,190 +745,20 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient3 *iface, return params.result; }
-static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient3 *iface, - REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct get_device_period_params params; - - TRACE("(%p)->(%p, %p)\n", This, defperiod, minperiod); - - if (!defperiod && !minperiod) - return E_POINTER; - - params.device = This->device_name; - params.flow = This->dataflow; - params.def_period = defperiod; - params.min_period = minperiod; - - OSS_CALL(get_device_period, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct start_params params; - - TRACE("(%p)\n", This); - - sessions_lock(); - - if(!This->stream){ - sessions_unlock(); - return AUDCLNT_E_NOT_INITIALIZED; - } - - params.stream = This->stream; - OSS_CALL(start, ¶ms); - - if(SUCCEEDED(params.result) && !This->timer_thread){ - This->timer_thread = CreateThread(NULL, 0, timer_thread, This, 0, NULL); - SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL); - } - - sessions_unlock(); - - return params.result; -} - -static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct stop_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - OSS_CALL(stop, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct reset_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - OSS_CALL(reset, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, - HANDLE event) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct set_event_handle_params params; - - TRACE("(%p)->(%p)\n", This, event); - - if(!event) - return E_INVALIDARG; +extern HRESULT WINAPI client_GetDevicePeriod(IAudioClient3 *iface, + REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod);
- if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; +extern HRESULT WINAPI client_Start(IAudioClient3 *iface);
- params.stream = This->stream; - params.event = event; - OSS_CALL(set_event_handle, ¶ms); +extern HRESULT WINAPI client_Stop(IAudioClient3 *iface);
- return params.result; -} +extern HRESULT WINAPI client_Reset(IAudioClient3 *iface);
-static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, - void **ppv) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - - TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv); - - if(!ppv) - return E_POINTER; - *ppv = NULL; +extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, + HANDLE event);
- sessions_lock(); - - if(!This->stream){ - sessions_unlock(); - return AUDCLNT_E_NOT_INITIALIZED; - } - - if(IsEqualIID(riid, &IID_IAudioRenderClient)){ - if(This->dataflow != eRender){ - sessions_unlock(); - return AUDCLNT_E_WRONG_ENDPOINT_TYPE; - } - IAudioRenderClient_AddRef(&This->IAudioRenderClient_iface); - *ppv = &This->IAudioRenderClient_iface; - }else if(IsEqualIID(riid, &IID_IAudioCaptureClient)){ - if(This->dataflow != eCapture){ - sessions_unlock(); - return AUDCLNT_E_WRONG_ENDPOINT_TYPE; - } - IAudioCaptureClient_AddRef(&This->IAudioCaptureClient_iface); - *ppv = &This->IAudioCaptureClient_iface; - }else if(IsEqualIID(riid, &IID_IAudioClock)){ - IAudioClock_AddRef(&This->IAudioClock_iface); - *ppv = &This->IAudioClock_iface; - }else if(IsEqualIID(riid, &IID_IAudioStreamVolume)){ - IAudioStreamVolume_AddRef(&This->IAudioStreamVolume_iface); - *ppv = &This->IAudioStreamVolume_iface; - }else if(IsEqualIID(riid, &IID_IAudioSessionControl)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - sessions_unlock(); - return E_OUTOFMEMORY; - } - }else - IAudioSessionControl2_AddRef(&This->session_wrapper->IAudioSessionControl2_iface); - - *ppv = &This->session_wrapper->IAudioSessionControl2_iface; - }else if(IsEqualIID(riid, &IID_IChannelAudioVolume)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - sessions_unlock(); - return E_OUTOFMEMORY; - } - }else - IChannelAudioVolume_AddRef(&This->session_wrapper->IChannelAudioVolume_iface); - - *ppv = &This->session_wrapper->IChannelAudioVolume_iface; - }else if(IsEqualIID(riid, &IID_ISimpleAudioVolume)){ - if(!This->session_wrapper){ - This->session_wrapper = AudioSessionWrapper_Create(This); - if(!This->session_wrapper){ - sessions_unlock(); - return E_OUTOFMEMORY; - } - }else - ISimpleAudioVolume_AddRef(&This->session_wrapper->ISimpleAudioVolume_iface); - - *ppv = &This->session_wrapper->ISimpleAudioVolume_iface; - } - - if(*ppv){ - sessions_unlock(); - return S_OK; - } - - sessions_unlock(); - - FIXME("stub %s\n", debugstr_guid(riid)); - return E_NOINTERFACE; -} +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); @@ -973,12 +792,12 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_GetCurrentPadding, AudioClient_IsFormatSupported, AudioClient_GetMixFormat, - AudioClient_GetDevicePeriod, - AudioClient_Start, - AudioClient_Stop, - AudioClient_Reset, - AudioClient_SetEventHandle, - AudioClient_GetService, + client_GetDevicePeriod, + client_Start, + client_Stop, + client_Reset, + client_SetEventHandle, + client_GetService, client_IsOffloadCapable, client_SetClientProperties, client_GetBufferSizeLimits,