summaryrefslogtreecommitdiffhomepage
path: root/video-ps3eye/module.hpp
blob: 357af14cb8aeaf7bd4356534f0ac668e236cc493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once

#include "video/camera.hpp"

#if 0

namespace video {

struct OTR_VIDEO_EXPORT camera_
{
    camera_();
    virtual ~camera_();

    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;
};

struct OTR_VIDEO_EXPORT 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;
};

} // ns video

#endif

namespace video::impl {
struct ps3eye_camera_ : 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