Adds device uid for wmme and dsound devices.
damencho committed on Nov 3, 2012 7e70e94 from https://github.com/jitsi/libsrc/commits/master/portaudio.zip
This commit is contained in:
parent
e7a274942b
commit
0a7b80cfce
3 changed files with 128 additions and 12 deletions
BIN
configure
vendored
BIN
configure
vendored
Binary file not shown.
|
|
@ -517,11 +517,10 @@ static GUID pawin_IID_IKsPropertySet =
|
|||
static void FindDevicePnpInterfaces( DSDeviceNamesAndGUIDs *deviceNamesAndGUIDs )
|
||||
{
|
||||
IClassFactory *pClassFactory;
|
||||
|
||||
if( paWinDsDSoundEntryPoints.DllGetClassObject(&pawin_CLSID_DirectSoundPrivate, &IID_IClassFactory, (PVOID *) &pClassFactory) == S_OK ){
|
||||
IKsPropertySet *pPropertySet;
|
||||
if( pClassFactory->lpVtbl->CreateInstance( pClassFactory, NULL, &pawin_IID_IKsPropertySet, (PVOID *) &pPropertySet) == S_OK ){
|
||||
|
||||
|
||||
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data;
|
||||
ULONG bytesReturned;
|
||||
|
||||
|
|
@ -595,7 +594,7 @@ static double defaultSampleRateSearchOrder_[] =
|
|||
** The device will not be added to the device list if any errors are encountered.
|
||||
*/
|
||||
static PaError AddOutputDeviceInfoFromDirectSound(
|
||||
PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface )
|
||||
PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface, PaUtilAllocationGroup *allocations )
|
||||
{
|
||||
PaDeviceInfo *deviceInfo = &winDsDeviceInfo->inheritedDeviceInfo;
|
||||
HRESULT hr;
|
||||
|
|
@ -805,6 +804,17 @@ static PaError AddOutputDeviceInfoFromDirectSound(
|
|||
}
|
||||
else
|
||||
{
|
||||
// target device UID property
|
||||
WCHAR duid[39];
|
||||
char *deviceUID;
|
||||
deviceUID = (char *)PaUtil_GroupAllocateMemory(allocations, 39);
|
||||
|
||||
StringFromGUID2(&(*lpGUID), (LPOLESTR) &duid, 39);
|
||||
wcstombs(deviceUID, duid, sizeof(deviceUID));
|
||||
WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR,\
|
||||
duid, -1, deviceUID, 39, NULL, NULL );
|
||||
deviceInfo->deviceUID = deviceUID;
|
||||
|
||||
memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
|
||||
winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
|
||||
}
|
||||
|
|
@ -829,7 +839,7 @@ error:
|
|||
** The device will not be added to the device list if any errors are encountered.
|
||||
*/
|
||||
static PaError AddInputDeviceInfoFromDirectSoundCapture(
|
||||
PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface )
|
||||
PaWinDsDeviceInfo *winDsDeviceInfo, char *name, LPGUID lpGUID, char *pnpInterface, PaUtilAllocationGroup *allocations )
|
||||
{
|
||||
PaDeviceInfo *deviceInfo = &winDsDeviceInfo->inheritedDeviceInfo;
|
||||
HRESULT hr;
|
||||
|
|
@ -962,6 +972,17 @@ http://www.winehq.com/hypermail/wine-patches/2003/01/0290.html
|
|||
}
|
||||
else
|
||||
{
|
||||
// target device UID property
|
||||
WCHAR duid[39];
|
||||
char *deviceUID;
|
||||
deviceUID = (char *)PaUtil_GroupAllocateMemory(allocations, 39);
|
||||
|
||||
StringFromGUID2(&(*lpGUID), (LPOLESTR) &duid, 39);
|
||||
wcstombs(deviceUID, duid, sizeof(deviceUID));
|
||||
WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR,\
|
||||
duid, -1, deviceUID, 39, NULL, NULL );
|
||||
deviceInfo->deviceUID = deviceUID;
|
||||
|
||||
winDsDeviceInfo->lpGUID = &winDsDeviceInfo->guid;
|
||||
memcpy( &winDsDeviceInfo->guid, lpGUID, sizeof(GUID) );
|
||||
}
|
||||
|
|
@ -1066,10 +1087,12 @@ error:
|
|||
PaUtil_FreeAllAllocations( winDsHostApi->allocations );
|
||||
PaUtil_DestroyAllocationGroup( winDsHostApi->allocations );
|
||||
}
|
||||
|
||||
|
||||
PaUtil_FreeMemory( winDsHostApi );
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( comWasInitialized )
|
||||
CoUninitialize();
|
||||
|
||||
|
|
@ -1256,7 +1279,7 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
|
|||
DSDeviceNamesAndGUIDs deviceNamesAndGUIDs;
|
||||
int i = 0;
|
||||
int maximumNewDeviceCount = 0;
|
||||
|
||||
|
||||
/* Check preconditions */
|
||||
if( !comWasInitialized || scanResults == NULL || newDeviceCount == NULL )
|
||||
return paInternalError;
|
||||
|
|
@ -1340,7 +1363,7 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
|
|||
for( i = 0 ; i < maximumNewDeviceCount; ++i )
|
||||
{
|
||||
PaDeviceInfo *deviceInfo = &deviceInfoArray[i].inheritedDeviceInfo;
|
||||
deviceInfo->structVersion = 2;
|
||||
deviceInfo->structVersion = 3;
|
||||
deviceInfo->hostApi = hostApiIndex;
|
||||
deviceInfo->name = 0;
|
||||
|
||||
|
|
@ -1354,7 +1377,8 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
|
|||
result = AddInputDeviceInfoFromDirectSoundCapture( winDsDeviceInfo,
|
||||
deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].name,
|
||||
deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].lpGUID,
|
||||
deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].pnpInterface );
|
||||
deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].pnpInterface,
|
||||
winDsHostApi->allocations );
|
||||
if( result == paNoError )
|
||||
{
|
||||
if( deviceNamesAndGUIDs.inputNamesAndGUIDs.items[i].lpGUID == NULL )
|
||||
|
|
@ -1371,7 +1395,8 @@ static PaError ScanDeviceInfos( struct PaUtilHostApiRepresentation *hostApi, PaH
|
|||
result = AddOutputDeviceInfoFromDirectSound( winDsDeviceInfo,
|
||||
deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].name,
|
||||
deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].lpGUID,
|
||||
deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].pnpInterface );
|
||||
deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].pnpInterface,
|
||||
winDsHostApi->allocations );
|
||||
if( result == paNoError )
|
||||
{
|
||||
if( deviceNamesAndGUIDs.outputNamesAndGUIDs.items[i].lpGUID == NULL )
|
||||
|
|
|
|||
|
|
@ -153,6 +153,9 @@
|
|||
|
||||
#define PA_MME_USE_HIGH_DEFAULT_LATENCY_ (0) /* For debugging glitches. */
|
||||
|
||||
#define DRV_QUERYFUNCTIONINSTANCEID (DRV_RESERVED + 17)
|
||||
#define DRV_QUERYFUNCTIONINSTANCEIDSIZE (DRV_RESERVED + 18)
|
||||
|
||||
#if PA_MME_USE_HIGH_DEFAULT_LATENCY_
|
||||
#define PA_MME_WIN_9X_DEFAULT_LATENCY_ (0.4)
|
||||
#define PA_MME_MIN_HOST_OUTPUT_BUFFER_COUNT_ (4)
|
||||
|
|
@ -665,6 +668,7 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH
|
|||
{
|
||||
PaError result = paNoError;
|
||||
char *deviceName; /* non-const ptr */
|
||||
char *deviceUID;
|
||||
MMRESULT mmresult;
|
||||
WAVEINCAPS wic;
|
||||
PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
|
||||
|
|
@ -737,6 +741,49 @@ static PaError InitializeInputDeviceInfo( PaWinMmeHostApiRepresentation *winMmeH
|
|||
QueryWaveInKSFilterMaxChannels( winMmeInputDeviceId, &deviceInfo->maxInputChannels );
|
||||
#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
|
||||
|
||||
|
||||
MMRESULT mmr;
|
||||
size_t cbEndpointIdSize;
|
||||
// Get the size (including the terminating null) of
|
||||
// the endpoint ID string of the waveOut device.
|
||||
mmr = waveInMessage(
|
||||
winMmeInputDeviceId,
|
||||
DRV_QUERYFUNCTIONINSTANCEIDSIZE,
|
||||
(DWORD_PTR)&cbEndpointIdSize, NULL);
|
||||
|
||||
if (mmr == MMSYSERR_NOERROR) // do sizes match?
|
||||
{
|
||||
WCHAR *pstrEndpointId = NULL;
|
||||
pstrEndpointId = (WCHAR *)PaUtil_GroupAllocateMemory(winMmeHostApi->allocations, cbEndpointIdSize);
|
||||
|
||||
// Get the endpoint ID string for this waveOut device.
|
||||
mmr = waveInMessage(
|
||||
winMmeInputDeviceId,
|
||||
DRV_QUERYFUNCTIONINSTANCEID,
|
||||
(DWORD_PTR)pstrEndpointId,
|
||||
cbEndpointIdSize);
|
||||
|
||||
if (mmr == MMSYSERR_NOERROR)
|
||||
{
|
||||
deviceUID = (char *)PaUtil_GroupAllocateMemory(winMmeHostApi->allocations, wcslen(pstrEndpointId));
|
||||
if( !deviceUID )
|
||||
{
|
||||
result = paInsufficientMemory;
|
||||
goto error;
|
||||
}
|
||||
wcstombs(deviceUID, pstrEndpointId, sizeof(deviceUID));
|
||||
WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR,\
|
||||
pstrEndpointId, -1, deviceUID, wcslen(pstrEndpointId), NULL, NULL );
|
||||
deviceInfo->deviceUID = deviceUID;
|
||||
}
|
||||
/*else
|
||||
{
|
||||
char mmeErrorText[ MAXERRORLENGTH ];
|
||||
waveOutGetErrorText( mmr, mmeErrorText, MAXERRORLENGTH );
|
||||
PA_DEBUG(("Error %i: %s\n", mmr ,mmeErrorText));
|
||||
}*/
|
||||
}
|
||||
|
||||
winMmeDeviceInfo->dwFormats = wic.dwFormats;
|
||||
|
||||
DetectDefaultSampleRate( winMmeDeviceInfo, winMmeInputDeviceId,
|
||||
|
|
@ -788,6 +835,7 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
|
|||
{
|
||||
PaError result = paNoError;
|
||||
char *deviceName; /* non-const ptr */
|
||||
char *deviceUID;
|
||||
MMRESULT mmresult;
|
||||
WAVEOUTCAPS woc;
|
||||
PaDeviceInfo *deviceInfo = &winMmeDeviceInfo->inheritedDeviceInfo;
|
||||
|
|
@ -863,6 +911,49 @@ static PaError InitializeOutputDeviceInfo( PaWinMmeHostApiRepresentation *winMme
|
|||
winMmeDeviceInfo->deviceOutputChannelCountIsKnown = 1;
|
||||
#endif /* PAWIN_USE_WDMKS_DEVICE_INFO */
|
||||
|
||||
MMRESULT mmr;
|
||||
size_t cbEndpointIdSize;
|
||||
// Get the size (including the terminating null) of
|
||||
// the endpoint ID string of the waveOut device.
|
||||
mmr = waveOutMessage(
|
||||
winMmeOutputDeviceId,
|
||||
DRV_QUERYFUNCTIONINSTANCEIDSIZE,
|
||||
(DWORD_PTR)&cbEndpointIdSize, NULL);
|
||||
|
||||
if (mmr == MMSYSERR_NOERROR) // do sizes match?
|
||||
{
|
||||
WCHAR *pstrEndpointId = NULL;
|
||||
pstrEndpointId = (WCHAR *)PaUtil_GroupAllocateMemory(winMmeHostApi->allocations, cbEndpointIdSize);
|
||||
|
||||
// Get the endpoint ID string for this waveOut device.
|
||||
mmr = waveOutMessage(
|
||||
winMmeOutputDeviceId,
|
||||
DRV_QUERYFUNCTIONINSTANCEID,
|
||||
(DWORD_PTR)pstrEndpointId,
|
||||
cbEndpointIdSize);
|
||||
|
||||
if (mmr == MMSYSERR_NOERROR)
|
||||
{
|
||||
deviceUID = (char *)PaUtil_GroupAllocateMemory(winMmeHostApi->allocations, wcslen(pstrEndpointId));
|
||||
if( !deviceUID )
|
||||
{
|
||||
result = paInsufficientMemory;
|
||||
goto error;
|
||||
}
|
||||
wcstombs(deviceUID, pstrEndpointId, sizeof(deviceUID));
|
||||
|
||||
WideCharToMultiByte( CP_ACP, WC_COMPOSITECHECK | WC_DEFAULTCHAR,\
|
||||
pstrEndpointId, -1, deviceUID, wcslen(pstrEndpointId), NULL, NULL );
|
||||
deviceInfo->deviceUID = deviceUID;
|
||||
}
|
||||
/*else
|
||||
{
|
||||
char mmeErrorText[ MAXERRORLENGTH ];
|
||||
waveOutGetErrorText( mmr, mmeErrorText, MAXERRORLENGTH );
|
||||
PA_DEBUG(("Error %i: %s\n", mmr ,mmeErrorText));
|
||||
}*/
|
||||
}
|
||||
|
||||
winMmeDeviceInfo->dwFormats = woc.dwFormats;
|
||||
|
||||
DetectDefaultSampleRate( winMmeDeviceInfo, winMmeOutputDeviceId,
|
||||
|
|
@ -930,7 +1021,6 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
|
|||
(*hostApi)->info.type = paMME;
|
||||
(*hostApi)->info.name = "MME";
|
||||
|
||||
|
||||
/* initialise device counts and default devices under the assumption that
|
||||
there are no devices. These values are incremented below if and when
|
||||
devices are successfully initialized.
|
||||
|
|
@ -953,6 +1043,7 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
|
|||
|
||||
preferredDeviceStatusFlags = 0;
|
||||
waveOutPreferredDevice = -1;
|
||||
|
||||
waveOutMessage( (HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&waveOutPreferredDevice, (DWORD_PTR)&preferredDeviceStatusFlags );
|
||||
|
||||
maximumPossibleDeviceCount = 0;
|
||||
|
|
@ -1001,7 +1092,7 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
|
|||
UINT winMmeDeviceId = (UINT)((i==-1) ? WAVE_MAPPER : i);
|
||||
PaWinMmeDeviceInfo *wmmeDeviceInfo = &deviceInfoArray[ (*hostApi)->info.deviceCount ];
|
||||
PaDeviceInfo *deviceInfo = &wmmeDeviceInfo->inheritedDeviceInfo;
|
||||
deviceInfo->structVersion = 2;
|
||||
deviceInfo->structVersion = 3;
|
||||
deviceInfo->hostApi = hostApiIndex;
|
||||
|
||||
deviceInfo->maxInputChannels = 0;
|
||||
|
|
@ -1044,7 +1135,7 @@ PaError PaWinMme_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
|
|||
UINT winMmeDeviceId = (UINT)((i==-1) ? WAVE_MAPPER : i);
|
||||
PaWinMmeDeviceInfo *wmmeDeviceInfo = &deviceInfoArray[ (*hostApi)->info.deviceCount ];
|
||||
PaDeviceInfo *deviceInfo = &wmmeDeviceInfo->inheritedDeviceInfo;
|
||||
deviceInfo->structVersion = 2;
|
||||
deviceInfo->structVersion = 3;
|
||||
deviceInfo->hostApi = hostApiIndex;
|
||||
|
||||
deviceInfo->maxInputChannels = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue