diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2020-03-07 10:30:55 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2020-03-07 10:30:55 +0100 |
commit | 9d0136249cade3469ac70f71cef4a428fecc7a9c (patch) | |
tree | 4e808eb055a1bac608ca7bc08e9b3ec95c0bdd76 /video-ps3eye/module.hpp | |
parent | adb5f89b018da33ee7e3aa8a48e5b742129da161 (diff) |
video/ps3eye: prototype open driver impl
Diffstat (limited to 'video-ps3eye/module.hpp')
-rw-r--r-- | video-ps3eye/module.hpp | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/video-ps3eye/module.hpp b/video-ps3eye/module.hpp index 357af14c..73cdf04c 100644 --- a/video-ps3eye/module.hpp +++ b/video-ps3eye/module.hpp @@ -1,54 +1,51 @@ #pragma once #include "video/camera.hpp" +#include "shm-layout.hpp" +#include "compat/shm.h" +#include "options/options.hpp" +#include "compat/macros1.h" -#if 0 +using namespace options; -namespace video { +#include <QProcess> -struct OTR_VIDEO_EXPORT camera_ +using video::impl::camera; +using video::impl::camera_; +using video::frame; + +struct settings : opts { - camera_(); - virtual ~camera_(); + settings() : opts{"video-ps3eye"} {} - virtual std::vector<QString> camera_names() const = 0; - virtual std::unique_ptr<camera> make_camera(const QString& name) = 0; - virtual bool show_dialog(const QString& camera_name) = 0; - virtual bool can_show_dialog(const QString& camera_name) = 0; + value<slider_value> exposure{b, "exposure", {63, 0, 63}}; + value<slider_value> gain{b, "gain", {30, 0, 63}}; }; -struct OTR_VIDEO_EXPORT camera +struct ps3eye_camera final : video::impl::camera { - struct info final - { - // TODO: expose FOV-based focal length for regular webcams - int width = 0, height = 0, fps = 0; - double fx = 0, fy = 0; // focal length - double P_x = 0, P_y = 0; // principal point - double dist_c[8] {}; // distortion coefficients - }; - - camera(); - virtual ~camera(); - - [[nodiscard]] virtual bool start(info& args) = 0; - virtual void stop() = 0; - virtual bool is_open() = 0; - - virtual std::tuple<const frame&, bool> get_frame() = 0; - [[nodiscard]] virtual bool show_dialog() = 0; + QProcess wrapper; + shm_wrapper shm { "ps3eye-driver-shm", nullptr, sizeof(ps3eye::shm) }; + settings s; + frame fr; + bool open = false; + unsigned timecode = 0; + + ps3eye_camera(); + ~ps3eye_camera() override; + + bool start(info& args) override; + void stop() override; + bool is_open() override { return open; } + + std::tuple<const frame&, bool> get_frame() override; + [[nodiscard]] bool show_dialog() override; }; -} // ns video - -#endif - -namespace video::impl { -struct ps3eye_camera_ : camera_ +struct ps3eye_camera_ final : video::impl::camera_ { std::vector<QString> camera_names() const override; std::unique_ptr<camera> make_camera(const QString& name) override; bool show_dialog(const QString& camera_name) override; bool can_show_dialog(const QString& camera_name) override; }; -} // ns video::impl |