-
-
Notifications
You must be signed in to change notification settings - Fork 196
Expand file tree
/
Copy pathV4L2Worker.h
More file actions
99 lines (81 loc) · 2.08 KB
/
V4L2Worker.h
File metadata and controls
99 lines (81 loc) · 2.08 KB
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
93
94
95
96
97
98
99
#pragma once
#ifndef PCH_ENABLED
#include <QThread>
#include <vector>
#include <atomic>
#endif
#include <utils/PixelFormat.h>
#include <base/Grabber.h>
#include <utils/Components.h>
#include <base/AutomaticToneMapping.h>
#include <turbojpeg.h>
class V4L2WorkerManager;
struct v4l2_buffer;
class V4L2Worker;
class V4L2Worker : public QThread
{
Q_OBJECT
friend class V4L2WorkerManager;
public:
void setup(
unsigned int _workerIndex, v4l2_buffer* __v4l2Buf,
PixelFormat __pixelFormat,
uint8_t* __sharedData,
int __size, int __width, int __height, int __lineLength,
unsigned __cropLeft, unsigned __cropTop,
unsigned __cropBottom, unsigned __cropRight,
quint64 __currentFrame, qint64 __frameBegin,
int __hdrToneMappingEnabled, uint8_t* __lutBuffer,
bool __qframe, bool __directAccess, QString __deviceName, AutomaticToneMapping* __automaticToneMapping);
void startOnThisThread();
void run() override;
v4l2_buffer* GetV4L2Buffer();
bool isBusy();
void noBusy();
V4L2Worker();
~V4L2Worker();
signals:
void SignalNewFrame(unsigned int workerIndex, Image<ColorRgb> data, quint64 sourceCount, qint64 _frameBegin);
void SignalNewFrameError(unsigned int workerIndex, QString, quint64 sourceCount);
private:
void runMe();
void process_image_jpg_mt();
tjhandle _decompress;
static std::atomic<bool> _isActive;
std::atomic<bool> _isBusy;
unsigned int _workerIndex;
struct v4l2_buffer _v4l2Buf;
PixelFormat _pixelFormat;
uint8_t* _sharedData;
int _size;
int _width;
int _height;
int _lineLength;
int _subsamp;
uint _cropLeft;
uint _cropTop;
uint _cropBottom;
uint _cropRight;
quint64 _currentFrame;
qint64 _frameBegin;
uint8_t _hdrToneMappingEnabled;
uint8_t* _lutBuffer;
bool _qframe;
bool _directAccess;
QString _deviceName;
AutomaticToneMapping* _automaticToneMapping;
};
class V4L2WorkerManager : public QObject
{
Q_OBJECT
public:
V4L2WorkerManager();
~V4L2WorkerManager();
bool isActive();
void InitWorkers();
void Stop();
void Start();
// MT workers
unsigned int workersCount;
V4L2Worker** workers;
};