summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-09-15 20:00:57 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-09-15 20:00:57 +0200
commitfc906d93916d04c81ae712e52045ed56c2788adc (patch)
tree24d05ee0358f83034e28227b14929429224f2682
parente5644bff6531717503c14b209041c1a7524e9998 (diff)
Simplify tracker API
No need to have a separate finalization function, can just as well sleep in the destructor.
-rw-r--r--FTNoIR_Tracker_PT/ftnoir_tracker_pt.h1
-rw-r--r--facetracknoir/global-settings.cpp7
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp2
-rw-r--r--ftnoir_tracker_aruco/ftnoir_tracker_aruco.h7
-rw-r--r--ftnoir_tracker_base/ftnoir_tracker_base.h2
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht.cpp4
-rw-r--r--ftnoir_tracker_ht/ftnoir_tracker_ht.h10
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp.cpp2
-rw-r--r--ftnoir_tracker_udp/ftnoir_tracker_udp.h5
9 files changed, 8 insertions, 32 deletions
diff --git a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h
index 867378d1..7dcfc8bb 100644
--- a/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h
+++ b/FTNoIR_Tracker_PT/ftnoir_tracker_pt.h
@@ -46,7 +46,6 @@ public:
virtual void Initialize(QFrame *videoframe);
#ifdef OPENTRACK_API
virtual void StartTracker(QFrame* parent_window);
- virtual void WaitForExit() {}
virtual bool GiveHeadPoseData(double* data);
#else
virtual void StartTracker(HWND parent_window);
diff --git a/facetracknoir/global-settings.cpp b/facetracknoir/global-settings.cpp
index 4a655171..aa334463 100644
--- a/facetracknoir/global-settings.cpp
+++ b/facetracknoir/global-settings.cpp
@@ -9,13 +9,6 @@ SelectedLibraries* Libraries = NULL;
SelectedLibraries::~SelectedLibraries()
{
if (pTracker) {
- pTracker->WaitForExit();
- }
- if (pSecondTracker) {
- pSecondTracker->WaitForExit();
- }
-
- if (pTracker) {
delete pTracker;
pTracker = NULL;
}
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
index e40c92d2..b781f390 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.cpp
@@ -137,6 +137,8 @@ Tracker::Tracker()
Tracker::~Tracker()
{
+ stop = true;
+ wait();
if (layout)
delete layout;
if (videoWidget)
diff --git a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
index 7f21f020..98aba2cf 100644
--- a/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
+++ b/ftnoir_tracker_aruco/ftnoir_tracker_aruco.h
@@ -27,13 +27,6 @@ public:
void StartTracker(QFrame* frame);
bool GiveHeadPoseData(double *data);
bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ;
- bool NeedsTimeToFinish() {
- return true;
- }
- void WaitForExit() {
- stop = true;
- wait();
- }
void run();
private:
QMutex mtx;
diff --git a/ftnoir_tracker_base/ftnoir_tracker_base.h b/ftnoir_tracker_base/ftnoir_tracker_base.h
index 39db6bb6..b84ce05d 100644
--- a/ftnoir_tracker_base/ftnoir_tracker_base.h
+++ b/ftnoir_tracker_base/ftnoir_tracker_base.h
@@ -51,8 +51,6 @@ struct ITracker
virtual ~ITracker() {}
virtual void StartTracker( QFrame* frame ) = 0;
virtual bool GiveHeadPoseData(double *data) = 0;
-
- virtual void WaitForExit() = 0;
virtual void NotifyCenter() {}
};
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
index 2ca5a3de..27817a0c 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.cpp
@@ -149,6 +149,10 @@ Tracker::Tracker() : lck_shm(HT_SHM_NAME, HT_MUTEX_NAME, sizeof(ht_shm_t)), fres
Tracker::~Tracker()
{
+ if (shm) {
+ shm->terminate = true;
+ subprocess.waitForFinished(5000);
+ }
subprocess.kill();
if (shm)
shm->terminate = true;
diff --git a/ftnoir_tracker_ht/ftnoir_tracker_ht.h b/ftnoir_tracker_ht/ftnoir_tracker_ht.h
index fcdea140..5b8eb508 100644
--- a/ftnoir_tracker_ht/ftnoir_tracker_ht.h
+++ b/ftnoir_tracker_ht/ftnoir_tracker_ht.h
@@ -27,16 +27,6 @@ public:
bool GiveHeadPoseData(double *data);
bool enableTX, enableTY, enableTZ, enableRX, enableRY, enableRZ;
ht_shm_t* shm;
- bool NeedsTimeToFinish() {
- return true;
- }
- void WaitForExit() {
- if (shm) {
- shm->terminate = true;
- subprocess.waitForFinished(5000);
- }
- subprocess.kill();
- }
private:
QTimer timer;
PortableLockedShm lck_shm;
diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
index e71d13bb..d67fb636 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp
@@ -45,6 +45,8 @@ FTNoIR_Tracker::FTNoIR_Tracker()
FTNoIR_Tracker::~FTNoIR_Tracker()
{
+ should_quit = true;
+ wait();
if (inSocket) {
inSocket->close();
delete inSocket;
diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h
index 76fcacf2..e5ea7ff3 100644
--- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h
+++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h
@@ -19,11 +19,6 @@ public:
bool GiveHeadPoseData(double *data);
void loadSettings();
volatile bool should_quit;
- void WaitForExit() {
- should_quit = true;
- wait();
- }
-
protected:
void run(); // qthread override run method