Commit b26bad57 authored by Davide Beatrici's avatar Davide Beatrici Committed by Alexandre Julliard

mmdevapi: Implement AudioClient_Create.

parent 55b6cded
......@@ -26,6 +26,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
extern HRESULT get_audio_session_wrapper(const GUID *guid, IMMDevice *device,
struct audio_session_wrapper **out);
static CRITICAL_SECTION g_sessions_lock;
static CRITICAL_SECTION_DEBUG g_sessions_lock_debug =
{
......@@ -102,7 +105,7 @@ static HRESULT WINAPI ASM_GetAudioSessionControl(IAudioSessionManager2 *iface,
TRACE("(%p)->(%s, %lx, %p)\n", This, debugstr_guid(guid), flags, out);
hr = drvs.pGetAudioSessionWrapper(guid, This->device, &wrapper);
hr = get_audio_session_wrapper(guid, This->device, &wrapper);
if (FAILED(hr))
return hr;
......@@ -121,7 +124,7 @@ static HRESULT WINAPI ASM_GetSimpleAudioVolume(IAudioSessionManager2 *iface,
TRACE("(%p)->(%s, %lx, %p)\n", This, debugstr_guid(guid), flags, out);
hr = drvs.pGetAudioSessionWrapper(guid, This->device, &wrapper);
hr = get_audio_session_wrapper(guid, This->device, &wrapper);
if (FAILED(hr))
return hr;
......
......@@ -30,8 +30,7 @@
#include <wine/debug.h>
#include <wine/unixlib.h>
#include "unixlib.h"
#include "mmdevdrv.h"
#include "mmdevapi_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
......@@ -1383,3 +1382,57 @@ const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl =
streamvolume_SetAllVolumes,
streamvolume_GetAllVolumes
};
HRESULT AudioClient_Create(GUID *guid, IMMDevice *device, IAudioClient **out)
{
struct audio_client *This;
char *name;
EDataFlow dataflow;
size_t size;
HRESULT hr;
TRACE("%s %p %p\n", debugstr_guid(guid), device, out);
*out = NULL;
if (!drvs.pget_device_name_from_guid(guid, &name, &dataflow))
return AUDCLNT_E_DEVICE_INVALIDATED;
if (dataflow != eRender && dataflow != eCapture) {
free(name);
return E_UNEXPECTED;
}
size = strlen(name) + 1;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(struct audio_client, device_name[size]));
if (!This) {
free(name);
return E_OUTOFMEMORY;
}
memcpy(This->device_name, name, size);
free(name);
This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl;
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl;
This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl;
This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl;
This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl;
This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl;
This->dataflow = dataflow;
This->parent = device;
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal);
if (FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, This);
return hr;
}
IMMDevice_AddRef(This->parent);
*out = (IAudioClient *)&This->IAudioClient3_iface;
IAudioClient3_AddRef(&This->IAudioClient3_iface);
return S_OK;
}
......@@ -474,7 +474,7 @@ static HRESULT set_format(MMDevice *dev)
WAVEFORMATEX *fmt;
PROPVARIANT pv = { VT_EMPTY };
hr = drvs.pGetAudioEndpoint(&dev->devguid, &dev->IMMDevice_iface, &client);
hr = AudioClient_Create(&dev->devguid, &dev->IMMDevice_iface, &client);
if(FAILED(hr))
return hr;
......@@ -595,7 +595,7 @@ static HRESULT WINAPI MMDevice_Activate(IMMDevice *iface, REFIID riid, DWORD cls
if (IsEqualIID(riid, &IID_IAudioClient) ||
IsEqualIID(riid, &IID_IAudioClient2) ||
IsEqualIID(riid, &IID_IAudioClient3)){
hr = drvs.pGetAudioEndpoint(&This->devguid, iface, (IAudioClient**)ppv);
hr = AudioClient_Create(&This->devguid, iface, (IAudioClient**)ppv);
}else if (IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
IsEqualIID(riid, &IID_IAudioEndpointVolumeEx))
hr = AudioEndpointVolume_Create(This, (IAudioEndpointVolumeEx**)ppv);
......
......@@ -100,8 +100,6 @@ static BOOL load_driver(const WCHAR *name, DriverFuncs *driver)
if(!driver->p##n) { goto fail; } } while(0)
LDFC(get_device_name_from_guid);
LDFC(GetEndpointIDs);
LDFC(GetAudioEndpoint);
LDFC(GetAudioSessionWrapper);
#undef LDFC
/* optional - do not fail if not found */
......
......@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <endpointvolume.h>
#include <spatialaudioclient.h>
#include <winternl.h>
......@@ -48,10 +50,6 @@ typedef struct _DriverFuncs {
* all of the elements in both arrays with HeapFree() */
HRESULT (WINAPI *pGetEndpointIDs)(EDataFlow flow, WCHAR ***ids,
GUID **guids, UINT *num, UINT *default_index);
HRESULT (WINAPI *pGetAudioEndpoint)(void *key, IMMDevice *dev,
IAudioClient **out);
HRESULT (WINAPI *pGetAudioSessionWrapper)(const GUID *guid, IMMDevice *device,
struct audio_session_wrapper **out);
HRESULT (WINAPI *pGetPropValue)(GUID *guid,
const PROPERTYKEY *prop, PROPVARIANT *out);
} DriverFuncs;
......@@ -73,7 +71,13 @@ typedef struct MMDevice {
struct list entry;
} MMDevice;
extern HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv) DECLSPEC_HIDDEN;
static inline void wine_unix_call(const unsigned int code, void *args)
{
const NTSTATUS status = __wine_unix_call(drvs.module_unixlib, code, args);
assert(!status);
}
extern HRESULT AudioClient_Create(GUID *guid, IMMDevice *device, IAudioClient **out) DECLSPEC_HIDDEN;
extern HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv) DECLSPEC_HIDDEN;
extern HRESULT AudioSessionManager_Create(IMMDevice *device, IAudioSessionManager2 **ppv) DECLSPEC_HIDDEN;
extern HRESULT SpatialAudioClient_Create(IMMDevice *device, ISpatialAudioClient **out) DECLSPEC_HIDDEN;
......
......@@ -14,13 +14,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <audiopolicy.h>
#include <mmdeviceapi.h>
#include <wine/list.h>
#include <wine/unixlib.h>
typedef struct audio_client ACImpl;
......@@ -85,9 +82,3 @@ struct audio_client {
/* Keep at end */
char device_name[0];
};
static inline void wine_unix_call(const unsigned int code, void *args)
{
const NTSTATUS status = WINE_UNIX_CALL(code, args);
assert(!status);
}
......@@ -28,8 +28,7 @@
#include <wine/debug.h>
#include <wine/unixlib.h>
#include "unixlib.h"
#include "mmdevdrv.h"
#include "mmdevapi_private.h"
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
......@@ -653,3 +652,21 @@ HRESULT get_audio_session(const GUID *guid, IMMDevice *device, UINT channels,
return S_OK;
}
HRESULT get_audio_session_wrapper(const GUID *guid, IMMDevice *device,
struct audio_session_wrapper **out)
{
struct audio_session *session;
const HRESULT hr = get_audio_session(guid, device, 0, &session);
if (FAILED(hr))
return hr;
*out = session_wrapper_create(NULL);
if (!*out)
return E_OUTOFMEMORY;
(*out)->session = session;
return S_OK;
}
MODULE = winealsa.drv
UNIXLIB = winealsa.so
IMPORTS = uuid ole32 advapi32 version
PARENTSRC = ../mmdevapi
DELAYIMPORTS = winmm
UNIX_LIBS = $(ALSA_LIBS) $(PTHREAD_LIBS)
C_SRCS = \
alsa.c \
alsamidi.c \
client.c \
midi.c \
mmdevdrv.c \
session.c
mmdevdrv.c
......@@ -65,13 +65,6 @@ static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0,
static WCHAR drv_key_devicesW[256];
static const WCHAR guidW[] = {'g','u','i','d',0};
extern const IAudioClient3Vtbl AudioClient3_Vtbl;
extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl;
extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl;
extern const IAudioClockVtbl AudioClock_Vtbl;
extern const IAudioClock2Vtbl AudioClock2_Vtbl;
extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl;
extern struct audio_session_wrapper *session_wrapper_create(
struct audio_client *client) DECLSPEC_HIDDEN;
......@@ -319,58 +312,6 @@ BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow)
return FALSE;
}
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out)
{
ACImpl *This;
char *alsa_name;
EDataFlow dataflow;
HRESULT hr;
int len;
TRACE("%s %p %p\n", debugstr_guid(guid), dev, out);
if(!get_device_name_from_guid(guid, &alsa_name, &dataflow))
return AUDCLNT_E_DEVICE_INVALIDATED;
if(dataflow != eRender && dataflow != eCapture){
free(alsa_name);
return E_UNEXPECTED;
}
len = strlen(alsa_name);
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1]));
if(!This){
free(alsa_name);
return E_OUTOFMEMORY;
}
memcpy(This->device_name, alsa_name, len + 1);
free(alsa_name);
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl;
This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl;
This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl;
This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl;
This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl;
This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl;
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal);
if (FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, This);
return hr;
}
This->dataflow = dataflow;
This->parent = dev;
IMMDevice_AddRef(This->parent);
*out = (IAudioClient *)&This->IAudioClient3_iface;
IAudioClient3_AddRef(&This->IAudioClient3_iface);
return S_OK;
}
/* if channels == 0, then this will return or create a session with
* matching dataflow and GUID. otherwise, channels must also match */
extern HRESULT get_audio_session(const GUID *sessionguid,
......@@ -379,19 +320,7 @@ extern HRESULT get_audio_session(const GUID *sessionguid,
HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device,
AudioSessionWrapper **out)
{
AudioSession *session;
HRESULT hr = get_audio_session(guid, device, 0, &session);
if(FAILED(hr))
return hr;
*out = session_wrapper_create(NULL);
if(!*out)
return E_OUTOFMEMORY;
(*out)->session = session;
return S_OK;
return E_NOTIMPL;
}
HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out)
......
......@@ -6,6 +6,5 @@
# MMDevAPI driver functions
@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
@ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
@ stdcall -private GetPropValue(ptr ptr ptr) AUDDRV_GetPropValue
MODULE = winecoreaudio.drv
UNIXLIB = winecoreaudio.so
IMPORTS = uuid ole32 user32 advapi32 version
PARENTSRC = ../mmdevapi
DELAYIMPORTS = winmm
UNIX_LIBS = $(COREAUDIO_LIBS)
C_SRCS = \
client.c \
coreaudio.c \
coremidi.c \
midi.c \
mmdevdrv.c \
session.c
mmdevdrv.c
......@@ -48,13 +48,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(coreaudio);
#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER)
extern const IAudioClient3Vtbl AudioClient3_Vtbl;
extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl;
extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl;
extern const IAudioClockVtbl AudioClock_Vtbl;
extern const IAudioClock2Vtbl AudioClock2_Vtbl;
extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl;
static WCHAR drv_key_devicesW[256];
static CRITICAL_SECTION g_sessions_lock;
......@@ -313,58 +306,6 @@ BOOL WINAPI get_device_name_from_guid(const GUID *guid, char **name, EDataFlow *
return FALSE;
}
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out)
{
ACImpl *This;
char *name;
SIZE_T name_len;
EDataFlow dataflow;
HRESULT hr;
TRACE("%s %p %p\n", debugstr_guid(guid), dev, out);
if(!get_device_name_from_guid(guid, &name, &dataflow))
return AUDCLNT_E_DEVICE_INVALIDATED;
if(dataflow != eRender && dataflow != eCapture){
free(name);
return E_UNEXPECTED;
}
name_len = strlen(name);
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[name_len + 1]));
if(!This){
free(name);
return E_OUTOFMEMORY;
}
memcpy(This->device_name, name, name_len + 1);
free(name);
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl;
This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl;
This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl;
This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl;
This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl;
This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl;
This->dataflow = dataflow;
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal);
if (FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, This);
return hr;
}
This->parent = dev;
IMMDevice_AddRef(This->parent);
*out = (IAudioClient *)&This->IAudioClient3_iface;
IAudioClient3_AddRef(&This->IAudioClient3_iface);
return S_OK;
}
/* if channels == 0, then this will return or create a session with
* matching dataflow and GUID. otherwise, channels must also match */
extern HRESULT get_audio_session(const GUID *sessionguid,
......@@ -373,17 +314,5 @@ extern HRESULT get_audio_session(const GUID *sessionguid,
HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device,
AudioSessionWrapper **out)
{
AudioSession *session;
HRESULT hr = get_audio_session(guid, device, 0, &session);
if(FAILED(hr))
return hr;
*out = session_wrapper_create(NULL);
if(!*out)
return E_OUTOFMEMORY;
(*out)->session = session;
return S_OK;
return E_NOTIMPL;
}
......@@ -6,5 +6,4 @@
# MMDevAPI driver functions
@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
@ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
MODULE = wineoss.drv
UNIXLIB = wineoss.so
IMPORTS = uuid ole32 user32 advapi32 version
PARENTSRC = ../mmdevapi
DELAYIMPORTS = winmm
UNIX_LIBS = $(OSS4_LIBS) $(PTHREAD_LIBS)
UNIX_CFLAGS = $(OSS4_CFLAGS)
C_SRCS = \
client.c \
midi.c \
midipatch.c \
mmaux.c \
mmdevdrv.c \
oss.c \
ossmidi.c \
session.c
ossmidi.c
......@@ -71,13 +71,6 @@ static CRITICAL_SECTION_DEBUG g_sessions_lock_debug =
};
static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 };
extern const IAudioClient3Vtbl AudioClient3_Vtbl;
extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl;
extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl;
extern const IAudioClockVtbl AudioClock_Vtbl;
extern const IAudioClock2Vtbl AudioClock2_Vtbl;
extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl;
extern struct audio_session_wrapper *session_wrapper_create(
struct audio_client *client) DECLSPEC_HIDDEN;
......@@ -300,61 +293,6 @@ end:
return params.result;
}
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev,
IAudioClient **out)
{
ACImpl *This;
char *name;
int len;
EDataFlow dataflow;
HRESULT hr;
TRACE("%s %p %p\n", debugstr_guid(guid), dev, out);
if(!get_device_name_from_guid(guid, &name, &dataflow)){
WARN("Unknown GUID: %s\n", debugstr_guid(guid));
return AUDCLNT_E_DEVICE_INVALIDATED;
}
if(dataflow != eRender && dataflow != eCapture){
free(name);
return E_UNEXPECTED;
}
len = strlen(name);
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, offsetof(ACImpl, device_name[len + 1]));
if(!This){
free(name);
return E_OUTOFMEMORY;
}
memcpy(This->device_name, name, len + 1);
free(name);
hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient3_iface, &This->marshal);
if (FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, This);
return hr;
}
This->dataflow = dataflow;
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl;
This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl;
This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl;
This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl;
This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl;
This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl;
This->parent = dev;
IMMDevice_AddRef(This->parent);
*out = (IAudioClient *)&This->IAudioClient3_iface;
IAudioClient3_AddRef(&This->IAudioClient3_iface);
return S_OK;
}
/* if channels == 0, then this will return or create a session with
* matching dataflow and GUID. otherwise, channels must also match */
extern HRESULT get_audio_session(const GUID *sessionguid,
......@@ -363,17 +301,5 @@ extern HRESULT get_audio_session(const GUID *sessionguid,
HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device,
AudioSessionWrapper **out)
{
AudioSession *session;
HRESULT hr = get_audio_session(guid, device, 0, &session);
if(FAILED(hr))
return hr;
*out = session_wrapper_create(NULL);
if(!*out)
return E_OUTOFMEMORY;
(*out)->session = session;
return S_OK;
return E_NOTIMPL;
}
......@@ -7,5 +7,4 @@
# MMDevAPI driver functions
@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
@ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
MODULE = winepulse.drv
UNIXLIB = winepulse.so
IMPORTS = dxguid uuid winmm user32 advapi32 ole32 version
PARENTSRC = ../mmdevapi
UNIX_LIBS = $(PULSE_LIBS) $(PTHREAD_LIBS) -lm
UNIX_CFLAGS = $(PULSE_CFLAGS)
C_SRCS = \
client.c \
mmdevdrv.c \
pulse.c \
session.c
pulse.c
......@@ -117,13 +117,6 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved)
return TRUE;
}
extern const IAudioClient3Vtbl AudioClient3_Vtbl;
extern const IAudioRenderClientVtbl AudioRenderClient_Vtbl;
extern const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl;
extern const IAudioClockVtbl AudioClock_Vtbl;
extern const IAudioClock2Vtbl AudioClock2_Vtbl;
extern const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl;
extern struct audio_session_wrapper *session_wrapper_create(
struct audio_client *client) DECLSPEC_HIDDEN;
......@@ -343,58 +336,6 @@ BOOL WINAPI get_device_name_from_guid(GUID *guid, char **name, EDataFlow *flow)
return FALSE;
}
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out)
{
ACImpl *This;
char *pulse_name;
EDataFlow dataflow;
unsigned len;
HRESULT hr;
TRACE("%s %p %p\n", debugstr_guid(guid), dev, out);
if (!get_device_name_from_guid(guid, &pulse_name, &dataflow))
return AUDCLNT_E_DEVICE_INVALIDATED;
if (dataflow != eRender && dataflow != eCapture) {
free(pulse_name);
return E_UNEXPECTED;
}
*out = NULL;
len = strlen(pulse_name) + 1;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(ACImpl, device_name[len]));
if (!This) {
free(pulse_name);
return E_OUTOFMEMORY;
}
memcpy(This->device_name, pulse_name, len);
free(pulse_name);
This->IAudioClient3_iface.lpVtbl = &AudioClient3_Vtbl;
This->IAudioRenderClient_iface.lpVtbl = &AudioRenderClient_Vtbl;
This->IAudioCaptureClient_iface.lpVtbl = &AudioCaptureClient_Vtbl;
This->IAudioClock_iface.lpVtbl = &AudioClock_Vtbl;
This->IAudioClock2_iface.lpVtbl = &AudioClock2_Vtbl;
This->IAudioStreamVolume_iface.lpVtbl = &AudioStreamVolume_Vtbl;
This->dataflow = dataflow;
This->parent = dev;
hr = CoCreateFreeThreadedMarshaler((IUnknown*)&This->IAudioClient3_iface, &This->marshal);
if (FAILED(hr)) {
HeapFree(GetProcessHeap(), 0, This);
return hr;
}
IMMDevice_AddRef(This->parent);
*out = (IAudioClient *)&This->IAudioClient3_iface;
IAudioClient3_AddRef(&This->IAudioClient3_iface);
return S_OK;
}
/* if channels == 0, then this will return or create a session with
* matching dataflow and GUID. otherwise, channels must also match */
extern HRESULT get_audio_session(const GUID *sessionguid,
......@@ -403,19 +344,7 @@ extern HRESULT get_audio_session(const GUID *sessionguid,
HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device,
AudioSessionWrapper **out)
{
AudioSession *session;
HRESULT hr = get_audio_session(guid, device, 0, &session);
if(FAILED(hr))
return hr;
*out = session_wrapper_create(NULL);
if(!*out)
return E_OUTOFMEMORY;
(*out)->session = session;
return S_OK;
return E_NOTIMPL;
}
HRESULT WINAPI AUDDRV_GetPropValue(GUID *guid, const PROPERTYKEY *prop, PROPVARIANT *out)
......
# MMDevAPI driver functions
@ stdcall -private get_device_name_from_guid(ptr ptr ptr) get_device_name_from_guid
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
@ stdcall -private GetAudioSessionWrapper(ptr ptr ptr) AUDDRV_GetAudioSessionWrapper
@ stdcall -private GetPropValue(ptr ptr ptr) AUDDRV_GetPropValue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment