forked from zhengran14/SwitchGamepad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
videocapture.h
89 lines (78 loc) · 2.23 KB
/
videocapture.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef VIDEOCAPTURE_H
#define VIDEOCAPTURE_H
#include <QObject>
#include <QCamera>
#include <QCameraViewfinder>
#include <QCameraImageCapture>
class VideoCapture : public QObject
{
Q_OBJECT
public:
enum PixelFormat
{
Format_Invalid,
Format_ARGB32,
Format_ARGB32_Premultiplied,
Format_RGB32,
Format_RGB24,
Format_RGB565,
Format_RGB555,
Format_ARGB8565_Premultiplied,
Format_BGRA32,
Format_BGRA32_Premultiplied,
Format_BGR32,
Format_BGR24,
Format_BGR565,
Format_BGR555,
Format_BGRA5658_Premultiplied,
Format_AYUV444,
Format_AYUV444_Premultiplied,
Format_YUV444,
Format_YUV420P,
Format_YV12,
Format_UYVY,
Format_YUYV,
Format_NV12,
Format_NV21,
Format_IMC1,
Format_IMC2,
Format_IMC3,
Format_IMC4,
Format_Y8,
Format_Y16,
Format_Jpeg,
Format_CameraRaw,
Format_AdobeDng,
Format_ABGR32, // ### Qt 6: reorder
Format_YUV422P,
#ifndef Q_QDOC
NPixelFormats,
#endif
Format_User = 1000
};
Q_ENUM(PixelFormat)
explicit VideoCapture(QObject *parent);
~VideoCapture();
// void init(QLayout *layout);
void open(int index, QString resolution, QString frameRateRange, QString pixelFormat);
void close();
QStringList refresh(QString defaultSearch, QString &defaultName);
QStringList GetSupportedResolutions(int index, QString &defaultName, QString defaultSearch = "");
QStringList GetSupportedFrameRateRanges(int index, QString &defaultName, QString defaultSearch = "");
QStringList GetSupportedPixelFormats(int index, QString &defaultName, QString defaultSearch = "");
void moveViewfinder(QLayout *layout);
void removeViewfinder();
QCameraViewfinder* getViewfinder();
QImage *capture();
private slots:
void imageAvailable(int id, const QVideoFrame &frame);
private:
QCamera *camera = Q_NULLPTR;
QCameraImageCapture *cameraImageCapture = Q_NULLPTR;
QCameraViewfinder viewfinder;
QList<QCameraInfo> cameraList;
QMetaEnum metaEnum;
QImage *videoFrame = Q_NULLPTR;
signals:
};
#endif // VIDEOCAPTURE_H