-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathmyvideosurface.h
58 lines (49 loc) · 1.23 KB
/
myvideosurface.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
#ifndef MYVIDEOSURFACE_H
#define MYVIDEOSURFACE_H
#include <QImage>
#include <QPixmap>
#include <QDebug>
#include <QPainter>
#include <QCamera>
#include <QCameraInfo>
#include <QAbstractVideoSurface>
#include <QDateTime>
#include <QMutex>
#include <QList>
#include <vector>
#include "DynamsoftCommon.h"
#include "DynamsoftBarcodeReader.h"
#include "work.h"
#include "barcodeinfo.h"
class Work;
class BarcodeInfo;
QT_BEGIN_NAMESPACE
namespace Ui
{
class MainWindow;
}
QT_END_NAMESPACE
// https://www.qtcentre.org/threads/57090-How-could-I-get-the-image-buffer-of-QCamera
class MyVideoSurface : public QAbstractVideoSurface
{
Q_OBJECT
private:
Ui::MainWindow *ui;
void *reader;
bool is_detecting;
Work* worker;
std::vector<std::vector<BarcodeInfo>> queue;
QMutex mutex;
QCamera *camera;
public:
MyVideoSurface(QObject *parent, Ui::MainWindow *ui, void *reader, QCamera *camera);
~MyVideoSurface();
void reset();
void pause();
void setWorker(Work* worker);
void appendResult(std::vector<BarcodeInfo> &result);
QList<QVideoFrame::PixelFormat>
supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const;
bool present(const QVideoFrame &frame);
};
#endif // MYVIDEOSURFACE_H