-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmyvideosurface.h
52 lines (40 loc) · 1.08 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
#ifndef MYVIDEOSURFACE_H
#define MYVIDEOSURFACE_H
#include <QWidget>
#include <QVideoFrame>
#include <QImage>
#include <QVideoSurfaceFormat>
#include <QAbstractVideoSurface>
#include <QVideoRendererControl>
#include <QVideoSurfaceFormat>
#include <QPainter>
#include <QTimer>
class VideoIF
{
public:
virtual void updateVideo() = 0;
};
class MyVideoSurface: public QAbstractVideoSurface
{
Q_OBJECT
public:
MyVideoSurface(QWidget* widget, VideoIF* target, QObject * parent = 0);
~MyVideoSurface();
bool start(const QVideoSurfaceFormat &format);
bool present(const QVideoFrame &frame);
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
void paint(QPainter*);
public slots:
void sendImageToDecode();
signals:
void imageCaptured(QImage image);
private:
QWidget* m_targetWidget;
VideoIF* m_target;
QVideoFrame m_frame;
QImage::Format m_imageFormat;
QVideoSurfaceFormat m_videoFormat;
QTimer* timer;
};
#endif // MYVIDEOSURFACE_H