diff options
Diffstat (limited to 'opentrack/opencv-camera-dialog.hpp')
-rw-r--r-- | opentrack/opencv-camera-dialog.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/opentrack/opencv-camera-dialog.hpp b/opentrack/opencv-camera-dialog.hpp index eac26bde..8fa71505 100644 --- a/opentrack/opencv-camera-dialog.hpp +++ b/opentrack/opencv-camera-dialog.hpp @@ -28,12 +28,14 @@ # include <windows.h> #endif +#ifdef _WIN32 static void init_com_threading(void) { HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(hr)) qDebug() << "failed CoInitializeEx" << hr << "code" << GetLastError(); } +#endif static void maybe_grab_frame(cv::VideoCapture& cap) { @@ -55,9 +57,9 @@ public: int idx = camera_name_to_index(camera_name); QProcess::startDetached("qv4l2", QStringList() << "-d" << ("/dev/video" + QString::number(idx))); } -#else void open_camera_settings(cv::VideoCapture* cap, const QString& camera_name, QMutex* camera_mtx) { +#elif defined(_WIN32) if (cap) { QMutexLocker l(camera_mtx); @@ -89,7 +91,11 @@ public: // HACK: we're not notified when it's safe to close the capture t.start(); } +#else + void open_camera_settings(cv::VideoCapture*, const QString&, QMutex*) {} +#endif private: +#if defined(_WIN32) cv::VideoCapture fake_capture; QTimer t; void delete_capture() @@ -100,4 +106,3 @@ private: }; #endif - |