summaryrefslogtreecommitdiffhomepage
path: root/cv
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-09-22 14:12:19 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-09-22 14:25:24 +0200
commita4b852bd282ccecd87527b02f52a2cf66822a1db (patch)
tree5ecdc575a041f9e37c82ac0eecb1f5fb81ea4b90 /cv
parent6c7361b97dfd90470c8c2923a852aff17970a5ed (diff)
cv: use amcap.exe for ps3 eye exposure settings
Diffstat (limited to 'cv')
-rw-r--r--cv/video-property-page.cpp48
-rw-r--r--cv/video-property-page.hpp7
2 files changed, 40 insertions, 15 deletions
diff --git a/cv/video-property-page.cpp b/cv/video-property-page.cpp
index b542a9c4..0595f04a 100644
--- a/cv/video-property-page.cpp
+++ b/cv/video-property-page.cpp
@@ -9,17 +9,34 @@
#ifdef _WIN32
+#include "compat/camera-names.hpp"
+#include "opentrack-library-path.h"
+
#include <cstring>
+
#include <QRegularExpression>
+#include <QProcess>
#include <QDebug>
+#include <QFile>
+
+#include <dshow.h>
#define CHECK(expr) if (FAILED(hr = (expr))) { qDebug() << QStringLiteral(#expr) << hr; goto done; }
#define CHECK2(expr) if (!(expr)) { qDebug() << QStringLiteral(#expr); goto done; }
-bool video_property_page::show_from_capture(cv::VideoCapture& cap, int)
+bool video_property_page::show_from_capture(cv::VideoCapture& cap, int index)
{
- cap.set(cv::CAP_PROP_SETTINGS, 0);
- return true;
+ const QString name = get_camera_names().value(index, "");
+
+ if (name == "PS3Eye Camera")
+ {
+ return QProcess::startDetached(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH "./amcap.exe");
+ }
+ else
+ {
+ cap.set(cv::CAP_PROP_SETTINGS, 0);
+ return true;
+ }
}
bool video_property_page::should_show_dialog(const QString& camera_name)
@@ -27,7 +44,7 @@ bool video_property_page::should_show_dialog(const QString& camera_name)
using re = QRegularExpression;
static const re regexen[] =
{
- re("^PS3Eye Camera$"),
+ //re("^PS3Eye Camera$"),
re("^A4 TECH "),
};
bool avail = true;
@@ -42,21 +59,28 @@ bool video_property_page::should_show_dialog(const QString& camera_name)
bool video_property_page::show(int id)
{
- IBaseFilter* filter = NULL;
- bool ret = false;
+ const QString name = get_camera_names().value(id, "");
- CHECK2(filter = get_device(id));
+ if (name == "PS3Eye Camera")
+ return QProcess::startDetached(OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH "./amcap.exe");
+ else
+ {
+ IBaseFilter* filter = NULL;
+ bool ret = false;
+
+ CHECK2(filter = get_device(id));
- ret = SUCCEEDED(ShowFilterPropertyPages(filter));
+ ret = SUCCEEDED(ShowFilterPropertyPages(filter));
done:
- if (filter)
- filter->Release();
+ if (filter)
+ filter->Release();
- return ret;
+ return ret;
+ }
}
-HRESULT video_property_page::ShowFilterPropertyPages(IBaseFilter* filter)
+int video_property_page::ShowFilterPropertyPages(IBaseFilter* filter)
{
ISpecifyPropertyPages* pProp = NULL;
IUnknown* unk = NULL;
diff --git a/cv/video-property-page.hpp b/cv/video-property-page.hpp
index 4e53e2ab..2acffd85 100644
--- a/cv/video-property-page.hpp
+++ b/cv/video-property-page.hpp
@@ -4,20 +4,21 @@
#ifdef _WIN32
# include <windows.h>
-# include <dshow.h>
#endif
#include "opencv2/videoio.hpp"
+struct IBaseFilter;
+
struct video_property_page final
{
video_property_page() = delete;
static bool show(int id);
- static bool show_from_capture(cv::VideoCapture& cap, int idx);
+ static bool show_from_capture(cv::VideoCapture& cap, int index);
static bool should_show_dialog(const QString& camera_name);
private:
#ifdef _WIN32
- static HRESULT ShowFilterPropertyPages(IBaseFilter* filter);
+ static int ShowFilterPropertyPages(IBaseFilter* filter);
static IBaseFilter* get_device(int id);
#endif
};