Update to spice2x-25-04-25 (pre-apply)
> broken commit
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#include "device_enumerator.h"
|
||||
|
||||
#include "util/logging.h"
|
||||
|
||||
#include "device.h"
|
||||
#include "util/utils.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
DEFINE_GUID(IID_IMMDeviceEnumerator,
|
||||
@@ -61,6 +59,38 @@ HRESULT STDMETHODCALLTYPE WrappedIMMDeviceEnumerator::GetDefaultAudioEndpoint(
|
||||
return ret;
|
||||
}
|
||||
|
||||
// dump friendly name of audio endpoint
|
||||
// https://learn.microsoft.com/en-us/windows/win32/coreaudio/device-properties?redirectedfrom=MSDN
|
||||
{
|
||||
IPropertyStore *pProps = nullptr;
|
||||
HRESULT hr;
|
||||
|
||||
hr = (*ppEndpoint)->OpenPropertyStore(STGM_READ, &pProps);
|
||||
if (SUCCEEDED(hr)) {
|
||||
PROPVARIANT varName;
|
||||
|
||||
// instead of including giant windows headers, hardcoding the GUID here
|
||||
PROPERTYKEY key;
|
||||
GUID IDevice_FriendlyName = { 0xa45c254e, 0xdf1c, 0x4efd, { 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0 } };
|
||||
key.pid = 14;
|
||||
key.fmtid = IDevice_FriendlyName;
|
||||
|
||||
// get friendly name
|
||||
PropVariantInit(&varName);
|
||||
hr = pProps->GetValue(key, &varName);
|
||||
if (SUCCEEDED(hr) && varName.vt != VT_EMPTY) {
|
||||
log_info("audio", "IMMDeviceEnumerator::GetDefaultAudioEndpoint: using {}", ws2s(varName.pwszVal));
|
||||
}
|
||||
|
||||
// cleanup
|
||||
PropVariantClear(&varName);
|
||||
}
|
||||
if (pProps) {
|
||||
pProps->Release();
|
||||
pProps = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// wrap interface
|
||||
*ppEndpoint = new WrappedIMMDevice(*ppEndpoint);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user