-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvideodecoder.h
More file actions
42 lines (33 loc) · 922 Bytes
/
Copy pathvideodecoder.h
File metadata and controls
42 lines (33 loc) · 922 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
#ifndef VIDEODECODER_H
#define VIDEODECODER_H
#include <QObject>
#include <QMutex>
#include <QThread>
#include <atomic>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavdevice/avdevice.h>
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#include <libavutil/mem.h>
#include <libswscale/swscale.h>
}
class VideoDecoder : public QThread {
Q_OBJECT
public:
explicit VideoDecoder(QObject* parent = nullptr);
~VideoDecoder() override;
void startDecoding(const QString& url);
void stopDecoding();
bool isDecoding() const;
signals:
void frameReady(QByteArray frameData, int width, int height, int stride);
protected:
void run() override;
private:
QString m_url;
std::atomic_bool m_running{false};
std::atomic<AVFormatContext*> m_formatContext{nullptr};
QMutex m_mutex;
};
#endif