Provide alternate device paths info for USB cameras (#1519)

This is primarily for use on Linux to get by-id or by-path device names.

This information is now part of UsbCameraInfo.

A new entry point was added to UsbCamera to get that camera's UsbCameraInfo.

The alternate paths are also returned in EnumerateUsbCameras.
This commit is contained in:
Peter Johnson
2018-12-30 11:48:18 -08:00
committed by GitHub
parent 80f87ff8ad
commit 6105873cbe
14 changed files with 236 additions and 33 deletions

View File

@@ -1020,4 +1020,17 @@ std::string GetUsbCameraPath(CS_Source source, CS_Status* status) {
return static_cast<UsbCameraImpl&>(*data->source).GetPath();
}
UsbCameraInfo GetUsbCameraInfo(CS_Source source, CS_Status* status) {
UsbCameraInfo info;
auto data = Instance::GetInstance().GetSource(source);
if (!data || data->kind != CS_SOURCE_USB) {
*status = CS_INVALID_HANDLE;
return info;
}
info.path = static_cast<UsbCameraImpl&>(*data->source).GetPath();
// TODO: dev and name
return info;
}
} // namespace cs