diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-09-22 14:12:19 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-09-22 14:25:24 +0200 |
commit | a4b852bd282ccecd87527b02f52a2cf66822a1db (patch) | |
tree | 5ecdc575a041f9e37c82ac0eecb1f5fb81ea4b90 /cv/video-property-page.cpp | |
parent | 6c7361b97dfd90470c8c2923a852aff17970a5ed (diff) |
cv: use amcap.exe for ps3 eye exposure settings
Diffstat (limited to 'cv/video-property-page.cpp')
-rw-r--r-- | cv/video-property-page.cpp | 48 |
1 files changed, 36 insertions, 12 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; |