summaryrefslogtreecommitdiffhomepage
path: root/opentrack-api
diff options
context:
space:
mode:
authorDonovan Baarda <abo@minkirri.apana.org.au>2014-10-15 14:07:20 +1100
committerDonovan Baarda <abo@minkirri.apana.org.au>2014-10-15 14:07:20 +1100
commitdbd04e283082ab869a22abf03c4c6280b03935bb (patch)
tree3951c6f91f76047e655f35e04db4eecd576c49df /opentrack-api
parentd880464fbe9180aefde94594330126e115066dc3 (diff)
parent051a2e4392bc75b246cc5cb897ae0bbb1f92042e (diff)
Merge branch 'unstable' of https://github.com/opentrack/opentrack into dev/kalman
Conflicts: ftnoir_filter_kalman/ftnoir_filter_kalman.h
Diffstat (limited to 'opentrack-api')
-rw-r--r--opentrack-api/context.cpp112
-rw-r--r--opentrack-api/gnuc-version-script.txt12
-rw-r--r--opentrack-api/opentrack-guts.h57
-rw-r--r--opentrack-api/opentrack.h58
-rw-r--r--opentrack-api/trackers.cpp38
5 files changed, 0 insertions, 277 deletions
diff --git a/opentrack-api/context.cpp b/opentrack-api/context.cpp
deleted file mode 100644
index 04fa5ac2..00000000
--- a/opentrack-api/context.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "opentrack-guts.h"
-#include "opentrack.h"
-
-#if defined(__APPLE__)
-# define SONAME "dylib"
-#elif defined(_WIN32)
-# define SONAME "dll"
-#else
-# define SONAME "so"
-#endif
-
-#include <iostream>
-
-#ifdef _MSC_VER
-# define LIB_PREFIX ""
-#else
-# define LIB_PREFIX "lib"
-#endif
-
-static Metadata* get_metadata(DynamicLibrary* lib, QString& longName, QIcon& icon)
-{
- Metadata* meta;
- if (!lib->Metadata || ((meta = lib->Metadata()), !meta))
- return NULL;
- meta->getFullName(&longName);
- meta->getIcon(&icon);
- return meta;
-}
-
-static QList<opentrack_meta> list_files(QString filter)
-{
- QList<opentrack_meta> ret;
- QStringList filenames = QDir((qApp->applicationDirPath())).entryList(
- QStringList() << (LIB_PREFIX + filter + ("*." SONAME)),
- QDir::Files, QDir::Name );
- for ( int i = 0; i < filenames.size(); i++) {
- QIcon icon;
- QString long_name;
- QString str = filenames.at(i);
- DynamicLibrary* lib = new DynamicLibrary(str);
- qDebug() << "Loading" << str;
- std::cout.flush();
- Metadata* meta;
- if (!(meta = get_metadata(lib, long_name, icon)))
- {
- delete lib;
- continue;
- }
- /* TODO perhaps return full name and somesuch */
- delete meta;
- QString prefix(LIB_PREFIX + filter);
- QString suffix("." SONAME);
- if (str.size() > prefix.size() + suffix.size() && str.startsWith(prefix) && str.endsWith(suffix))
- {
- auto str2 = str.mid(prefix.size(), str.size() - prefix.size() - suffix.size());
- opentrack_meta item(str2, lib);
- ret.push_back(item);
- }
- }
-
- return ret;
-}
-
-opentrack_ctx::opentrack_ctx(int argc, char** argv, void* window_parent) :
- app(argc, argv),
- meta_list(list_files("opentrack-tracker-")),
- fake_frame(window_parent)
-{
- const int count = meta_list.size();
- list = new char*[count + 1];
- for (int i = 0; i < count; i++)
- {
- QByteArray tmp = meta_list.at(i).path.toUtf8();
- int len = tmp.size();
- auto foo = new char[len+1];
- for (int j = 0; j < len; j++)
- foo[j] = tmp.at(j);
- foo[len] = '\0';
- list[i] = foo;
- }
- list[count] = NULL;
-}
-
-opentrack_ctx::~opentrack_ctx()
-{
- for (int i = 0; list[i]; i++)
- {
- delete[] list[i];
- }
- delete[] list;
-}
-
-extern "C"
-{
-
-OPENTRACK_EXPORT const char** opentrack_enum_trackers(opentrack ctx)
-{
- return const_cast<const char**>(ctx->list);
-}
-
-OPENTRACK_EXPORT opentrack opentrack_make_ctx(int argc, char** argv, void* window_parent)
-{
- return new opentrack_ctx(argc, argv, window_parent);
-}
-
-OPENTRACK_EXPORT void opentrack_finalize_ctx(opentrack foo)
-{
- delete foo;
-}
-
-}
-
diff --git a/opentrack-api/gnuc-version-script.txt b/opentrack-api/gnuc-version-script.txt
deleted file mode 100644
index cd3a568d..00000000
--- a/opentrack-api/gnuc-version-script.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- global:
- opentrack_make_ctx;
- opentrack_finalize_ctx;
- opentrack_enum_trackers;
- opentrack_make_tracker;
- opentrack_tracker_start;
- opentrack_tracker_tick;
- opentrack_finalize_tracker;
- local:
- *;
-};
diff --git a/opentrack-api/opentrack-guts.h b/opentrack-api/opentrack-guts.h
deleted file mode 100644
index c8e3309a..00000000
--- a/opentrack-api/opentrack-guts.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#pragma once
-
-#include <QFrame>
-#include <QDir>
-#include <QList>
-#include <QStringList>
-#include <QDebug>
-#include <QIcon>
-#include <QShowEvent>
-#include <iostream>
-#include <cstring>
-#include <QString>
-#include <QApplication>
-#include "ftnoir_tracker_base/ftnoir_tracker_base.h"
-#include "facetracknoir/global-settings.h"
-#include <memory>
-
-typedef ITracker* opentrack_tracker;
-
-class opentrack_meta {
-public:
- QString path;
- std::shared_ptr<DynamicLibrary> lib;
-
- opentrack_meta(QString& path, DynamicLibrary* lib) :
- path(path), lib(lib)
- {}
-};
-
-class MyFrame : public QFrame {
- Q_OBJECT
-public:
- MyFrame(void* parent)
- {
- if (parent == (void*) -1)
- {
- show();
- setVisible(false);
- hide();
- }
- else
- {
- create((WId) parent);
- }
- }
- explicit MyFrame() {}
-};
-
-typedef class opentrack_ctx {
-public:
- QApplication app;
- char** list;
- QList<opentrack_meta> meta_list;
- MyFrame fake_frame;
- opentrack_ctx(int argc, char** argv, void* window_parent);
- ~opentrack_ctx();
-} *opentrack;
diff --git a/opentrack-api/opentrack.h b/opentrack-api/opentrack.h
deleted file mode 100644
index 88ba6cf0..00000000
--- a/opentrack-api/opentrack.h
+++ /dev/null
@@ -1,58 +0,0 @@
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifndef IN_OPENTRACK
-/* opaque pointers, forward definitions */
-struct opentrack_opaque_ctx;
-typedef struct opentrack_opaque_ctx* opentrack;
-struct opentrack_opaque_tracker;
-typedef struct opentrack_opaque_tracker* opentrack_tracker;
-#endif
-
-#ifdef IN_OPENTRACK
-# ifdef _WIN32
-# define OPENTRACK_EXPORT __declspec(dllexport)
-# else
-# define OPENTRACK_EXPORT
-# endif
-#else
-# ifdef _WIN32
-# define OPENTRACK_EXPORT __declspec(dllimport)
-# else
-# define OPENTRACK_EXPORT
-# endif
-#endif
-
-/* for `opentrack_tracker_tick', individual headpose elts */
-#ifndef IN_OPENTRACK
-enum opentrack_dof {
- TX = 0,
- TY,
- TZ,
- Yaw,
- Pitch,
- Roll,
- DOF_count
-};
-#endif
-
-OPENTRACK_EXPORT opentrack opentrack_make_ctx(int argc, char** argv, void* window_parent);
-OPENTRACK_EXPORT void opentrack_finalize_ctx(opentrack self);
-
-/* no need to free the return value; invalid to modify it */
-OPENTRACK_EXPORT const char** opentrack_enum_trackers(opentrack self);
-
-/*
- * don't `opentrack_tracker_tick an unstarted tracker, it's invalid to do so
- * it's also invalid to start a finalized tracker
- */
-OPENTRACK_EXPORT opentrack_tracker opentrack_make_tracker(opentrack ctx, const char* name);
-OPENTRACK_EXPORT void opentrack_tracker_start(opentrack self, opentrack_tracker tracker);
-OPENTRACK_EXPORT void opentrack_tracker_tick(opentrack_tracker tracker, double* headpose);
-OPENTRACK_EXPORT void opentrack_finalize_tracker(opentrack_tracker tracker);
-#ifdef __cplusplus
-}
-#endif
-
diff --git a/opentrack-api/trackers.cpp b/opentrack-api/trackers.cpp
deleted file mode 100644
index 5027ec1d..00000000
--- a/opentrack-api/trackers.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "opentrack-guts.h"
-#include "opentrack.h"
-
-extern "C" {
-
-opentrack_tracker OPENTRACK_EXPORT opentrack_make_tracker(opentrack ctx, const char* name)
-{
- for (int i = 0; i < ctx->meta_list.size(); i++)
- {
- auto meta = ctx->meta_list.at(i);
- if (ctx->meta_list.at(i).path == name)
- {
- ITracker* foo = static_cast<ITracker*>(meta.lib->Constructor());
- return foo;
- }
- }
- return NULL;
-}
-
-void OPENTRACK_EXPORT opentrack_finalize_tracker(opentrack_tracker tracker)
-{
- delete tracker;
-}
-
-void OPENTRACK_EXPORT opentrack_tracker_start(opentrack self, opentrack_tracker tracker)
-{
- // hot damn, this is problematic!
- // need to pass QFrame from somewhere
- return tracker->StartTracker(&self->fake_frame);
-}
-
-void OPENTRACK_EXPORT opentrack_tracker_tick(opentrack_tracker tracker, double* headpose)
-{
- tracker->GetHeadPoseData(headpose);
- QApplication::processEvents(0, 5);
-}
-
-}