diff options
Diffstat (limited to 'ftnoir_tracker_ht/ftnoir_tracker_ht.h')
-rw-r--r-- | ftnoir_tracker_ht/ftnoir_tracker_ht.h | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h index 348fc246..b2fcb147 100644 --- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h +++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h @@ -5,10 +5,8 @@ * copyright notice and this permission notice appear in all copies. */ -#ifndef FTNOIR_TRACKER_HT_H -#define FTNOIR_TRACKER_HT_H +#pragma once -#include "stdafx.h" #include "headtracker-ftnoir.h" #include "ui_ht-trackercontrols.h" #include "ht_video_widget.h" @@ -18,6 +16,12 @@ #include "opentrack/plugin-api.hpp" #include "opentrack/opencv-camera-dialog.hpp" +#include <QThread> +#include <QMutex> +#include <QMutexLocker> +#include <QHBoxLayout> +#include <QString> + using namespace options; struct settings : opts { @@ -33,42 +37,47 @@ struct settings : opts { {} }; -class Tracker : public QObject, public ITracker +class Tracker : public QThread, public ITracker { Q_OBJECT public: Tracker(); ~Tracker() override; + void run() override; void start_tracker(QFrame* frame); void data(double *data); void load_settings(ht_config_t* config); + headtracker_t* ht; + QMutex camera_mtx; private: + double ypr[6]; settings s; - PortableLockedShm lck_shm; - ht_shm_t* shm; - QProcess subprocess; + ht_config_t conf; HTVideoWidget* videoWidget; QHBoxLayout* layout; + QMutex ypr_mtx, frame_mtx; + ht_video_t frame; + volatile bool should_stop; }; -// Widget that has controls for FTNoIR protocol client-settings. class TrackerControls : public ITrackerDialog, protected camera_dialog<Tracker> { Q_OBJECT public: - explicit TrackerControls(); - void register_tracker(ITracker *) {} - void unregister_tracker() {} - + TrackerControls(); + void register_tracker(ITracker * t) + { + tracker = static_cast<Tracker*>(t); + } + void unregister_tracker() { + tracker = nullptr; + } private: Ui::Form ui; settings s; - + Tracker* tracker; private slots: void doOK(); void doCancel(); void camera_settings(); }; - -#endif - |