diff options
Diffstat (limited to 'cv')
-rw-r--r-- | cv/video-property-page.cpp | 48 | ||||
-rw-r--r-- | cv/video-property-page.hpp | 7 |
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 }; |