diff options
-rw-r--r-- | bin/amcap.exe | bin | 0 -> 70144 bytes | |||
-rw-r--r-- | cmake/opentrack-install.cmake | 4 | ||||
-rw-r--r-- | cv/video-property-page.cpp | 48 | ||||
-rw-r--r-- | cv/video-property-page.hpp | 7 | ||||
-rw-r--r-- | tracker-pt/camera.cpp | 2 |
5 files changed, 45 insertions, 16 deletions
diff --git a/bin/amcap.exe b/bin/amcap.exe Binary files differnew file mode 100644 index 00000000..8a262fff --- /dev/null +++ b/bin/amcap.exe diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 62de340d..e867a3b7 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -41,6 +41,10 @@ otr_inst_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe") +if(WIN32) + otr_inst_exec("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/amcap.exe") +endif() + otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt") otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md") otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CONTRIBUTING.md") 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 }; diff --git a/tracker-pt/camera.cpp b/tracker-pt/camera.cpp index 28c95bf4..5e00499c 100644 --- a/tracker-pt/camera.cpp +++ b/tracker-pt/camera.cpp @@ -103,7 +103,7 @@ DEFUN_WARN_UNUSED Camera::open_status Camera::start(int idx, int fps, int res_x, { cam_info = CamInfo(); active_name = QString(); - cam_info.idx = -1; + cam_info.idx = idx; dt_mean = 0; active_name = desired_name; |