Add support for camera descriptions on windows (#1572)

For now, has to force enumerate all cameras to find the matching one
This commit is contained in:
Thad House
2019-02-01 23:04:12 -08:00
committed by Peter Johnson
parent 09d90b02fb
commit 910b9f3af7

View File

@@ -450,6 +450,15 @@ bool UsbCameraImpl::DeviceConnect() {
return false;
}
CS_Status st = 0;
auto devices = EnumerateUsbCameras(&st);
for (auto&& device : devices) {
if (device.path == m_path) {
SetDescription(device.name);
}
}
if (!m_properties_cached) {
SDEBUG3("caching properties");
DeviceCacheProperties();
@@ -933,9 +942,7 @@ std::vector<UsbCameraInfo> EnumerateUsbCameras(CS_Status* status) {
// Ensure we are initialized by grabbing the message pump
// GetMessagePump();
ComPtr<IMFMediaSource> ppSource;
std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
ComPtr<IMFMediaSource> pSource;
ComPtr<IMFAttributes> pAttributes;
IMFActivate** ppDevices = nullptr;
@@ -988,7 +995,6 @@ done:
}
}
CoTaskMemFree(ppDevices);
pSource.Reset();
return retval;
}