-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloopplayer.h
More file actions
46 lines (39 loc) · 923 Bytes
/
loopplayer.h
File metadata and controls
46 lines (39 loc) · 923 Bytes
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
#ifndef LOOPPLAYER_H
#define LOOPPLAYER_H
#include <vector>
#include <QMutex>
#include <QThread>
#include <QImage>
#include <QWaitCondition>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
class LoopPlayer : public QThread
{ Q_OBJECT
private:
bool stop;
QMutex mutex;
QWaitCondition condition;
std::vector<cv::Mat> frames;
QImage img;
long currentFrameIndex = 0;
int fps;
double playbackRate = 1.00;
long duration = 0;
long frameCount = 0;
signals:
void processedImage(const QImage &image);
protected:
void run();
void msleep(int ms);
public:
LoopPlayer(QObject *parent = 0);
~LoopPlayer();
bool loadVideo(std::string filename);
void play();
void pause();
long getDuration() const;
void setPlaybackRate(double rate);
bool isStopped() const;
};
#endif // LOOPPLAYER_H