mmdevapi: Use device GUIDs as unique identifiers.
This commit is contained in:
parent
98815f399c
commit
e87cb774d1
|
@ -261,67 +261,58 @@ static HRESULT MMDevice_SetPropValue(const GUID *devguid, DWORD flow, REFPROPERT
|
|||
* If GUID is null, a random guid will be assigned
|
||||
* and the device will be created
|
||||
*/
|
||||
static MMDevice *MMDevice_Create(WCHAR *name, void *devkey, GUID *id, EDataFlow flow, DWORD state, BOOL setdefault)
|
||||
static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD state, BOOL setdefault)
|
||||
{
|
||||
HKEY key, root;
|
||||
MMDevice *cur;
|
||||
MMDevice *cur = NULL;
|
||||
WCHAR guidstr[39];
|
||||
DWORD i;
|
||||
|
||||
for (i = 0; i < MMDevice_count; ++i)
|
||||
{
|
||||
cur = MMDevice_head[i];
|
||||
if (cur->flow == flow && !lstrcmpW(cur->drv_id, name))
|
||||
{
|
||||
LONG ret;
|
||||
/* Same device, update state */
|
||||
cur->state = state;
|
||||
cur->key = devkey;
|
||||
StringFromGUID2(&cur->devguid, guidstr, sizeof(guidstr)/sizeof(*guidstr));
|
||||
ret = RegOpenKeyExW(flow == eRender ? key_render : key_capture, guidstr, 0, KEY_WRITE, &key);
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
RegSetValueExW(key, reg_devicestate, 0, REG_DWORD, (const BYTE*)&state, sizeof(DWORD));
|
||||
RegCloseKey(key);
|
||||
}
|
||||
goto done;
|
||||
MMDevice *device = MMDevice_head[i];
|
||||
if (device->flow == flow && IsEqualGUID(&device->devguid, id)){
|
||||
cur = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!cur){
|
||||
/* No device found, allocate new one */
|
||||
cur = HeapAlloc(GetProcessHeap(), 0, sizeof(*cur));
|
||||
if (!cur){
|
||||
HeapFree(GetProcessHeap(), 0, devkey);
|
||||
cur = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cur));
|
||||
if (!cur)
|
||||
return NULL;
|
||||
}
|
||||
cur->drv_id = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name)+1)*sizeof(WCHAR));
|
||||
if (!cur->drv_id)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, cur);
|
||||
HeapFree(GetProcessHeap(), 0, devkey);
|
||||
return NULL;
|
||||
}
|
||||
lstrcpyW(cur->drv_id, name);
|
||||
cur->key = devkey;
|
||||
|
||||
cur->IMMDevice_iface.lpVtbl = &MMDeviceVtbl;
|
||||
cur->IMMEndpoint_iface.lpVtbl = &MMEndpointVtbl;
|
||||
cur->ref = 0;
|
||||
|
||||
InitializeCriticalSection(&cur->crst);
|
||||
cur->crst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MMDevice.crst");
|
||||
|
||||
if (!MMDevice_head)
|
||||
MMDevice_head = HeapAlloc(GetProcessHeap(), 0, sizeof(*MMDevice_head));
|
||||
else
|
||||
MMDevice_head = HeapReAlloc(GetProcessHeap(), 0, MMDevice_head, sizeof(*MMDevice_head)*(1+MMDevice_count));
|
||||
MMDevice_head[MMDevice_count++] = cur;
|
||||
}else if(cur->ref > 0)
|
||||
WARN("Modifying an MMDevice with postitive reference count!\n");
|
||||
|
||||
if(cur->drv_id)
|
||||
HeapFree(GetProcessHeap(), 0, cur->drv_id);
|
||||
cur->drv_id = name;
|
||||
|
||||
cur->flow = flow;
|
||||
cur->state = state;
|
||||
if (!id)
|
||||
{
|
||||
id = &cur->devguid;
|
||||
CoCreateGuid(id);
|
||||
}
|
||||
cur->devguid = *id;
|
||||
StringFromGUID2(id, guidstr, sizeof(guidstr)/sizeof(*guidstr));
|
||||
|
||||
StringFromGUID2(&cur->devguid, guidstr, sizeof(guidstr)/sizeof(*guidstr));
|
||||
|
||||
if (flow == eRender)
|
||||
root = key_render;
|
||||
else
|
||||
root = key_capture;
|
||||
if (!RegCreateKeyExW(root, guidstr, 0, NULL, 0, KEY_WRITE|KEY_READ, NULL, &key, NULL))
|
||||
|
||||
if (RegCreateKeyExW(root, guidstr, 0, NULL, 0, KEY_WRITE|KEY_READ, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
HKEY keyprop;
|
||||
RegSetValueExW(key, reg_devicestate, 0, REG_DWORD, (const BYTE*)&state, sizeof(DWORD));
|
||||
|
@ -336,13 +327,7 @@ static MMDevice *MMDevice_Create(WCHAR *name, void *devkey, GUID *id, EDataFlow
|
|||
}
|
||||
RegCloseKey(key);
|
||||
}
|
||||
if (!MMDevice_head)
|
||||
MMDevice_head = HeapAlloc(GetProcessHeap(), 0, sizeof(*MMDevice_head));
|
||||
else
|
||||
MMDevice_head = HeapReAlloc(GetProcessHeap(), 0, MMDevice_head, sizeof(*MMDevice_head)*(1+MMDevice_count));
|
||||
MMDevice_head[MMDevice_count++] = cur;
|
||||
|
||||
done:
|
||||
if (setdefault)
|
||||
{
|
||||
if (flow == eRender)
|
||||
|
@ -401,7 +386,10 @@ static HRESULT load_devices_from_reg(void)
|
|||
&& SUCCEEDED(MMDevice_GetPropValue(&guid, curflow, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pv))
|
||||
&& pv.vt == VT_LPWSTR)
|
||||
{
|
||||
MMDevice_Create(pv.u.pwszVal, NULL, &guid, curflow,
|
||||
DWORD size_bytes = (strlenW(pv.u.pwszVal) + 1) * sizeof(WCHAR);
|
||||
WCHAR *name = HeapAlloc(GetProcessHeap(), 0, size_bytes);
|
||||
memcpy(name, pv.u.pwszVal, size_bytes);
|
||||
MMDevice_Create(name, &guid, curflow,
|
||||
DEVICE_STATE_NOTPRESENT, FALSE);
|
||||
CoTaskMemFree(pv.u.pwszVal);
|
||||
}
|
||||
|
@ -417,7 +405,7 @@ static HRESULT set_format(MMDevice *dev)
|
|||
WAVEFORMATEX *fmt;
|
||||
PROPVARIANT pv = { VT_EMPTY };
|
||||
|
||||
hr = drvs.pGetAudioEndpoint(dev->key, &dev->IMMDevice_iface, dev->flow, &client);
|
||||
hr = drvs.pGetAudioEndpoint(&dev->devguid, &dev->IMMDevice_iface, &client);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
@ -443,26 +431,25 @@ static HRESULT set_format(MMDevice *dev)
|
|||
static HRESULT load_driver_devices(EDataFlow flow)
|
||||
{
|
||||
WCHAR **ids;
|
||||
void **keys;
|
||||
GUID *guids;
|
||||
UINT num, def, i;
|
||||
HRESULT hr;
|
||||
|
||||
if(!drvs.pGetEndpointIDs)
|
||||
return S_OK;
|
||||
|
||||
hr = drvs.pGetEndpointIDs(flow, &ids, &keys, &num, &def);
|
||||
hr = drvs.pGetEndpointIDs(flow, &ids, &guids, &num, &def);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
for(i = 0; i < num; ++i){
|
||||
MMDevice *dev;
|
||||
dev = MMDevice_Create(ids[i], keys[i], NULL, flow, DEVICE_STATE_ACTIVE,
|
||||
dev = MMDevice_Create(ids[i], &guids[i], flow, DEVICE_STATE_ACTIVE,
|
||||
def == i);
|
||||
set_format(dev);
|
||||
HeapFree(GetProcessHeap(), 0, ids[i]);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, keys);
|
||||
HeapFree(GetProcessHeap(), 0, guids);
|
||||
HeapFree(GetProcessHeap(), 0, ids);
|
||||
|
||||
return S_OK;
|
||||
|
@ -484,7 +471,6 @@ static void MMDevice_Destroy(MMDevice *This)
|
|||
This->crst.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->crst);
|
||||
HeapFree(GetProcessHeap(), 0, This->drv_id);
|
||||
HeapFree(GetProcessHeap(), 0, This->key);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
|
@ -546,7 +532,7 @@ static HRESULT WINAPI MMDevice_Activate(IMMDevice *iface, REFIID riid, DWORD cls
|
|||
return E_POINTER;
|
||||
|
||||
if (IsEqualIID(riid, &IID_IAudioClient)){
|
||||
hr = drvs.pGetAudioEndpoint(This->key, iface, This->flow, (IAudioClient**)ppv);
|
||||
hr = drvs.pGetAudioEndpoint(&This->devguid, iface, (IAudioClient**)ppv);
|
||||
}else if (IsEqualIID(riid, &IID_IAudioEndpointVolume))
|
||||
hr = AudioEndpointVolume_Create(This, (IAudioEndpointVolume**)ppv);
|
||||
else if (IsEqualIID(riid, &IID_IAudioSessionManager)
|
||||
|
|
|
@ -50,9 +50,9 @@ typedef struct _DriverFuncs {
|
|||
* it is the caller's responsibility to free both arrays, and
|
||||
* all of the elements in both arrays with HeapFree() */
|
||||
HRESULT WINAPI (*pGetEndpointIDs)(EDataFlow flow, WCHAR ***ids,
|
||||
void ***keys, UINT *num, UINT *default_index);
|
||||
GUID **guids, UINT *num, UINT *default_index);
|
||||
HRESULT WINAPI (*pGetAudioEndpoint)(void *key, IMMDevice *dev,
|
||||
EDataFlow dataflow, IAudioClient **out);
|
||||
IAudioClient **out);
|
||||
HRESULT WINAPI (*pGetAudioSessionManager)(IMMDevice *device,
|
||||
IAudioSessionManager2 **out);
|
||||
} DriverFuncs;
|
||||
|
@ -70,7 +70,6 @@ typedef struct MMDevice {
|
|||
DWORD state;
|
||||
GUID devguid;
|
||||
WCHAR *drv_id;
|
||||
void *key;
|
||||
} MMDevice;
|
||||
|
||||
extern HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -340,7 +340,7 @@ static BOOL alsa_try_open(const char *devnode, snd_pcm_stream_t stream)
|
|||
}
|
||||
|
||||
static HRESULT alsa_get_card_devices(EDataFlow flow, snd_pcm_stream_t stream,
|
||||
WCHAR **ids, GUID **guids, UINT *num, snd_ctl_t *ctl, int card,
|
||||
WCHAR **ids, GUID *guids, UINT *num, snd_ctl_t *ctl, int card,
|
||||
const WCHAR *cardnameW)
|
||||
{
|
||||
static const WCHAR dashW[] = {' ','-',' ',0};
|
||||
|
@ -401,13 +401,7 @@ static HRESULT alsa_get_card_devices(EDataFlow flow, snd_pcm_stream_t stream,
|
|||
MultiByteToWideChar(CP_UNIXCP, 0, devname, -1, ids[*num] + cardlen,
|
||||
len - cardlen);
|
||||
|
||||
guids[*num] = HeapAlloc(GetProcessHeap(), 0, sizeof(GUID));
|
||||
if(!guids[*num]){
|
||||
HeapFree(GetProcessHeap(), 0, info);
|
||||
HeapFree(GetProcessHeap(), 0, ids[*num]);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
get_device_guid(flow, devnode, guids[*num]);
|
||||
get_device_guid(flow, devnode, &guids[*num]);
|
||||
}
|
||||
|
||||
++(*num);
|
||||
|
@ -423,7 +417,7 @@ static HRESULT alsa_get_card_devices(EDataFlow flow, snd_pcm_stream_t stream,
|
|||
}
|
||||
|
||||
static void get_reg_devices(EDataFlow flow, snd_pcm_stream_t stream, WCHAR **ids,
|
||||
GUID **guids, UINT *num)
|
||||
GUID *guids, UINT *num)
|
||||
{
|
||||
static const WCHAR ALSAOutputDevices[] = {'A','L','S','A','O','u','t','p','u','t','D','e','v','i','c','e','s',0};
|
||||
static const WCHAR ALSAInputDevices[] = {'A','L','S','A','I','n','p','u','t','D','e','v','i','c','e','s',0};
|
||||
|
@ -455,8 +449,7 @@ static void get_reg_devices(EDataFlow flow, snd_pcm_stream_t stream, WCHAR **ids
|
|||
ids[*num] = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
memcpy(ids[*num], p, len * sizeof(WCHAR));
|
||||
|
||||
guids[*num] = HeapAlloc(GetProcessHeap(), 0, sizeof(GUID));
|
||||
get_device_guid(flow, devname, guids[*num]);
|
||||
get_device_guid(flow, devname, &guids[*num]);
|
||||
}
|
||||
++*num;
|
||||
}
|
||||
|
@ -469,7 +462,7 @@ static void get_reg_devices(EDataFlow flow, snd_pcm_stream_t stream, WCHAR **ids
|
|||
}
|
||||
}
|
||||
|
||||
static HRESULT alsa_enum_devices(EDataFlow flow, WCHAR **ids, GUID **guids,
|
||||
static HRESULT alsa_enum_devices(EDataFlow flow, WCHAR **ids, GUID *guids,
|
||||
UINT *num)
|
||||
{
|
||||
snd_pcm_stream_t stream = (flow == eRender ? SND_PCM_STREAM_PLAYBACK :
|
||||
|
@ -483,8 +476,7 @@ static HRESULT alsa_enum_devices(EDataFlow flow, WCHAR **ids, GUID **guids,
|
|||
if(ids && guids){
|
||||
*ids = HeapAlloc(GetProcessHeap(), 0, sizeof(defaultW));
|
||||
memcpy(*ids, defaultW, sizeof(defaultW));
|
||||
*guids = HeapAlloc(GetProcessHeap(), 0, sizeof(GUID));
|
||||
get_device_guid(flow, defname, *guids);
|
||||
get_device_guid(flow, defname, guids);
|
||||
}
|
||||
++*num;
|
||||
}
|
||||
|
@ -540,7 +532,7 @@ static HRESULT alsa_enum_devices(EDataFlow flow, WCHAR **ids, GUID **guids,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID ***guids,
|
||||
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID **guids,
|
||||
UINT *num, UINT *def_index)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -559,7 +551,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID ***guids
|
|||
}
|
||||
|
||||
*ids = HeapAlloc(GetProcessHeap(), 0, *num * sizeof(WCHAR *));
|
||||
*guids = HeapAlloc(GetProcessHeap(), 0, *num * sizeof(GUID *));
|
||||
*guids = HeapAlloc(GetProcessHeap(), 0, *num * sizeof(GUID));
|
||||
if(!*ids || !*guids){
|
||||
HeapFree(GetProcessHeap(), 0, *ids);
|
||||
HeapFree(GetProcessHeap(), 0, *guids);
|
||||
|
@ -571,10 +563,8 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID ***guids
|
|||
hr = alsa_enum_devices(flow, *ids, *guids, num);
|
||||
if(FAILED(hr)){
|
||||
int i;
|
||||
for(i = 0; i < *num; ++i){
|
||||
for(i = 0; i < *num; ++i)
|
||||
HeapFree(GetProcessHeap(), 0, (*ids)[i]);
|
||||
HeapFree(GetProcessHeap(), 0, (*guids)[i]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, *ids);
|
||||
HeapFree(GetProcessHeap(), 0, *guids);
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -729,8 +719,7 @@ static BOOL get_alsa_name_by_guid(GUID *guid, char *name, DWORD name_size, EData
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, EDataFlow unused_flow,
|
||||
IAudioClient **out)
|
||||
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out)
|
||||
{
|
||||
ACImpl *This;
|
||||
int err;
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
# MMDevAPI driver functions
|
||||
@ stdcall -private GetPriority() AUDDRV_GetPriority
|
||||
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
|
||||
@ stdcall -private GetAudioEndpoint(ptr ptr long ptr) AUDDRV_GetAudioEndpoint
|
||||
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
|
||||
@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
|
||||
|
|
|
@ -357,7 +357,7 @@ static void get_device_guid(EDataFlow flow, AudioDeviceID device, GUID *guid)
|
|||
}
|
||||
|
||||
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids,
|
||||
GUID ***guids, UINT *num, UINT *def_index)
|
||||
GUID **guids, UINT *num, UINT *def_index)
|
||||
{
|
||||
UInt32 devsize, size;
|
||||
AudioDeviceID *devices;
|
||||
|
@ -413,7 +413,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids,
|
|||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
*guids = HeapAlloc(GetProcessHeap(), 0, ndevices * sizeof(GUID *));
|
||||
*guids = HeapAlloc(GetProcessHeap(), 0, ndevices * sizeof(GUID));
|
||||
if(!*ids){
|
||||
HeapFree(GetProcessHeap(), 0, *ids);
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
|
@ -444,10 +444,8 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids,
|
|||
buffers = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
if(!buffers){
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
for(j = 0; j < *num; ++j){
|
||||
for(j = 0; j < *num; ++j)
|
||||
HeapFree(GetProcessHeap(), 0, (*ids)[j]);
|
||||
HeapFree(GetProcessHeap(), 0, (*guids)[j]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, *guids);
|
||||
HeapFree(GetProcessHeap(), 0, *ids);
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -489,10 +487,8 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids,
|
|||
if(!(*ids)[*num]){
|
||||
CFRelease(name);
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
for(j = 0; j < *num; ++j){
|
||||
for(j = 0; j < *num; ++j)
|
||||
HeapFree(GetProcessHeap(), 0, (*ids)[j]);
|
||||
HeapFree(GetProcessHeap(), 0, (*guids)[j]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, *ids);
|
||||
HeapFree(GetProcessHeap(), 0, *guids);
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -501,19 +497,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids,
|
|||
((*ids)[*num])[len - 1] = 0;
|
||||
CFRelease(name);
|
||||
|
||||
(*guids)[*num] = HeapAlloc(GetProcessHeap(), 0, sizeof(GUID));
|
||||
if(!(*guids)[*num]){
|
||||
HeapFree(GetProcessHeap(), 0, devices);
|
||||
HeapFree(GetProcessHeap(), 0, (*ids)[*num]);
|
||||
for(j = 0; j < *num; ++j){
|
||||
HeapFree(GetProcessHeap(), 0, (*ids)[j]);
|
||||
HeapFree(GetProcessHeap(), 0, (*guids)[j]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, *ids);
|
||||
HeapFree(GetProcessHeap(), 0, *guids);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
get_device_guid(flow, devices[i], (*guids)[*num]);
|
||||
get_device_guid(flow, devices[i], &(*guids)[*num]);
|
||||
|
||||
if(*def_index == (UINT)-1 && devices[i] == default_id)
|
||||
*def_index = *num;
|
||||
|
@ -595,8 +579,7 @@ static BOOL get_deviceid_by_guid(GUID *guid, AudioDeviceID *id, EDataFlow *flow)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev,
|
||||
EDataFlow unused_dataflow, IAudioClient **out)
|
||||
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient **out)
|
||||
{
|
||||
ACImpl *This;
|
||||
AudioDeviceID adevid;
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
# MMDevAPI driver functions
|
||||
@ stdcall -private GetPriority() AUDDRV_GetPriority
|
||||
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
|
||||
@ stdcall -private GetAudioEndpoint(str ptr long ptr) AUDDRV_GetAudioEndpoint
|
||||
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
|
||||
@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
|
||||
|
|
|
@ -451,7 +451,7 @@ static UINT get_default_index(EDataFlow flow)
|
|||
return 0;
|
||||
}
|
||||
|
||||
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID ***guids,
|
||||
HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID **guids,
|
||||
UINT *num, UINT *def_index)
|
||||
{
|
||||
int i, mixer_fd;
|
||||
|
@ -497,7 +497,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID ***guids
|
|||
}
|
||||
|
||||
*ids = HeapAlloc(GetProcessHeap(), 0, sysinfo.numaudios * sizeof(WCHAR *));
|
||||
*guids = HeapAlloc(GetProcessHeap(), 0, sysinfo.numaudios * sizeof(GUID *));
|
||||
*guids = HeapAlloc(GetProcessHeap(), 0, sysinfo.numaudios * sizeof(GUID));
|
||||
|
||||
*num = 0;
|
||||
for(i = 0; i < sysinfo.numaudios; ++i){
|
||||
|
@ -544,29 +544,14 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID ***guids
|
|||
get_device_guid(flow, devnode, &dev_item->guid);
|
||||
strcpy(dev_item->devnode, devnode);
|
||||
|
||||
(*guids)[*num] = HeapAlloc(GetProcessHeap(), 0, sizeof(GUID));
|
||||
if(!(*guids)[*num]){
|
||||
for(i = 0; i < *num; ++i){
|
||||
HeapFree(GetProcessHeap(), 0, (*ids)[i]);
|
||||
HeapFree(GetProcessHeap(), 0, (*guids)[i]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, *ids);
|
||||
HeapFree(GetProcessHeap(), 0, *guids);
|
||||
HeapFree(GetProcessHeap(), 0, dev_item);
|
||||
close(mixer_fd);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
*(*guids)[*num] = dev_item->guid;
|
||||
(*guids)[*num] = dev_item->guid;
|
||||
|
||||
len = MultiByteToWideChar(CP_UNIXCP, 0, ai.name, -1, NULL, 0);
|
||||
(*ids)[*num] = HeapAlloc(GetProcessHeap(), 0,
|
||||
len * sizeof(WCHAR));
|
||||
if(!(*ids)[*num]){
|
||||
HeapFree(GetProcessHeap(), 0, (*guids)[*num]);
|
||||
for(i = 0; i < *num; ++i){
|
||||
for(i = 0; i < *num; ++i)
|
||||
HeapFree(GetProcessHeap(), 0, (*ids)[i]);
|
||||
HeapFree(GetProcessHeap(), 0, (*guids)[i]);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, *ids);
|
||||
HeapFree(GetProcessHeap(), 0, *guids);
|
||||
HeapFree(GetProcessHeap(), 0, dev_item);
|
||||
|
@ -599,7 +584,7 @@ const OSSDevice *get_ossdevice_from_guid(const GUID *guid)
|
|||
}
|
||||
|
||||
HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev,
|
||||
EDataFlow unused_dataflow, IAudioClient **out)
|
||||
IAudioClient **out)
|
||||
{
|
||||
ACImpl *This;
|
||||
const OSSDevice *oss_dev;
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
# MMDevAPI driver functions
|
||||
@ stdcall -private GetPriority() AUDDRV_GetPriority
|
||||
@ stdcall -private GetEndpointIDs(long ptr ptr ptr ptr) AUDDRV_GetEndpointIDs
|
||||
@ stdcall -private GetAudioEndpoint(ptr ptr long ptr) AUDDRV_GetAudioEndpoint
|
||||
@ stdcall -private GetAudioEndpoint(ptr ptr ptr) AUDDRV_GetAudioEndpoint
|
||||
@ stdcall -private GetAudioSessionManager(ptr ptr) AUDDRV_GetAudioSessionManager
|
||||
|
|
Loading…
Reference in New Issue