-
Notifications
You must be signed in to change notification settings - Fork 2
/
videocapture.h
92 lines (82 loc) · 2.34 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
90
91
92
#ifndef VIDEOCAPTURE_H
#define VIDEOCAPTURE_H
#include <QObject>
#include <QCamera>
#include <QVideoWidget>
#include <QImageCapture>
#include <QAudioDevice>
#include <QAudioInput>
#include <QAudioOutput>
class VideoCapture : public QObject
{
Q_OBJECT
public:
enum PixelFormat
{
Format_Invalid,
Format_ARGB8888,
Format_ARGB8888_Premultiplied,
Format_XRGB8888,
Format_BGRA8888,
Format_BGRA8888_Premultiplied,
Format_BGRX8888,
Format_ABGR8888,
Format_XBGR8888,
Format_RGBA8888,
Format_RGBX8888,
Format_AYUV,
Format_AYUV_Premultiplied,
Format_YUV420P,
Format_YUV422P,
Format_YV12,
Format_UYVY,
Format_YUYV,
Format_NV12,
Format_NV21,
Format_IMC1,
Format_IMC2,
Format_IMC3,
Format_IMC4,
Format_Y8,
Format_Y16,
Format_P010,
Format_P016,
Format_SamplerExternalOES,
Format_Jpeg,
Format_SamplerRect,
};
Q_ENUM(PixelFormat)
explicit VideoCapture(QObject *parent);
~VideoCapture();
// void init(QLayout *layout);
void open(int videoIndex, int cameraFormateIndex, int audioInputIndex);
void close();
QStringList refreshCamera(QString defaultSearch, QString &defaultName);
QStringList refreshAudioInput(QString defaultSearch, QString &defaultName);
QStringList GetCameraFormats(int index, int &defaultIndex, const QStringList &defaultSearch);
void moveViewfinder(QLayout *layout);
void removeViewfinder();
const QVideoWidget* getViewfinder();
QImage *capture();
void setAudioInputVolume(int volume);
void setAudioInputMute(bool mute);
void stopViewfinder(bool b);
private slots:
void imageAvailable(int id, const QVideoFrame &frame);
private:
QCamera *camera = Q_NULLPTR;
QAudioInput *audioInput = Q_NULLPTR;
QAudioOutput *audioOutput = Q_NULLPTR;
QMediaCaptureSession *mediaCaptureSession = Q_NULLPTR;
QImageCapture *imageCapture = Q_NULLPTR;
QVideoWidget *viewfinder = Q_NULLPTR;
QList<QCameraDevice> cameraList;
QList<QAudioDevice> audioInputList;
QMetaEnum metaEnum;
QImage *videoFrame = Q_NULLPTR;
int audioInputVolume = 100;
bool audioInputMute = false;
void renewViewFinder();
signals:
};
#endif // VIDEOCAPTURE_H