summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStéphane Lenclud <github@lenclud.com>2019-05-02 21:17:47 +0200
committerStéphane Lenclud <github@lenclud.com>2019-05-02 21:18:28 +0200
commit03092469c8c84e03f9099a0d147217561706a1e8 (patch)
tree72b44717d3cde8eaf8fac5eda83db1e34da3dccb
parent42c2ff54b657babf59eacdb3291e5867a511489c (diff)
Kinect IR camera was not listed any more.
-rw-r--r--tracker-kinect-face/camera_kinect_ir.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/tracker-kinect-face/camera_kinect_ir.cpp b/tracker-kinect-face/camera_kinect_ir.cpp
index a4e6b203..c5b21572 100644
--- a/tracker-kinect-face/camera_kinect_ir.cpp
+++ b/tracker-kinect-face/camera_kinect_ir.cpp
@@ -22,6 +22,17 @@ namespace Kinect {
static const char KKinectIRSensor[] = "Kinect V2 IR Sensor";
+ // Safe release for interfaces
+ template<class Interface>
+ inline void SafeRelease(Interface *& pInterfaceToRelease)
+ {
+ if (pInterfaceToRelease != NULL)
+ {
+ pInterfaceToRelease->Release();
+ pInterfaceToRelease = NULL;
+ }
+ }
+
CamerasProvider::CamerasProvider() = default;
std::unique_ptr<video::impl::camera> CamerasProvider::make_camera(const QString& name)
@@ -36,12 +47,16 @@ namespace Kinect {
std::vector<QString> CamerasProvider::camera_names() const
{
- IKinectSensor* ptr;
- BOOLEAN b;
- if (SUCCEEDED(GetDefaultKinectSensor(&ptr)) && SUCCEEDED(ptr->get_IsAvailable(&b)) && b)
+ IKinectSensor* kinect;
+ if (SUCCEEDED(GetDefaultKinectSensor(&kinect)))
+ {
+ SafeRelease(kinect);
return { KKinectIRSensor };
+ }
else
+ {
return {};
+ }
}
bool CamerasProvider::can_show_dialog(const QString& camera_name)
@@ -109,17 +124,6 @@ namespace Kinect {
return { iFrame, new_frame };
}
- // Safe release for interfaces
- template<class Interface>
- inline void SafeRelease(Interface *& pInterfaceToRelease)
- {
- if (pInterfaceToRelease != NULL)
- {
- pInterfaceToRelease->Release();
- pInterfaceToRelease = NULL;
- }
- }
-
///
///
///