-
Notifications
You must be signed in to change notification settings - Fork 10
/
CaptureVideoFilter.h
49 lines (36 loc) · 1.21 KB
/
CaptureVideoFilter.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
#ifndef __CaptureVideoFilter__
#define __CaptureVideoFilter__
#include <QAbstractVideoFilter>
#include <QVideoFilterRunnable>
#include <QPainter>
#include <QUrl>
class CaptureVideoFilter : public QAbstractVideoFilter
{
Q_OBJECT
Q_PROPERTY( bool m_Capturing READ capturing NOTIFY capturingChanged )
Q_PROPERTY( int videoOutputOrientation MEMBER m_VideoOutputOrientation )
signals:
void captured( const QUrl& imageUrl );
void capturingChanged();
public:
CaptureVideoFilter( QObject* parent = nullptr );
QVideoFilterRunnable* createFilterRunnable() Q_DECL_OVERRIDE;
Q_INVOKABLE void capture();
public:
bool capturing() const { return m_Capturing; }
void setCapturing( bool capturing );
int videoOutputOrientation() const { return m_VideoOutputOrientation; }
void emitCaptured( const QUrl& imageUrl );
protected:
int m_VideoOutputOrientation;
bool m_Capturing;
};
class CaptureVideoFilterRunnable : public QVideoFilterRunnable
{
public:
CaptureVideoFilterRunnable( CaptureVideoFilter* filter );
QVideoFrame run( QVideoFrame *input, const QVideoSurfaceFormat &surfaceFormat, RunFlags flags ) Q_DECL_OVERRIDE;
protected:
CaptureVideoFilter* m_Filter;
};
#endif