-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrenderdev.h
65 lines (59 loc) · 1.37 KB
/
renderdev.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
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef RENDERDEV_H
#define RENDERDEV_H
#include <QImage>
#include <QMutex>
#include <QWidget>
#include <QPainter>
#include <pjmedia.h>
#include <pjmedia_videodev.h>
#define QT_RENDER_DRIVER_NAME "Qt"
#define QT_RENDER_DEVICE_NAME "QWidget renderer"
#define QT_RENDER_VID_DEV_TYPE 485
class VideoSurface :
public QObject
{
Q_OBJECT;
public:
VideoSurface();
~VideoSurface();
QSize frameSize() const;
qint64 frameKey() const;
bool putFrame(const pjmedia_frame *AFrame);
bool setFormat(const pjmedia_format *AFormat);
void paint(QPainter *APainter, const QRect &ATarget);
signals:
void frameChanged();
void formatChanged();
void surfaceDestroyed();
private:
QMutex FMutex;
QImage FFrame;
QSize FFrameSize;
qint64 FFrameKey;
QImage::Format FFormat;
};
class VideoWindow :
public QWidget
{
Q_OBJECT;
public:
VideoWindow(QWidget *AParent = NULL);
~VideoWindow();
QSize sizeHint() const;
VideoSurface *surface() const;
void setSurface(VideoSurface *ASurface);
signals:
void windowDestroyed();
protected:
void paintEvent(QPaintEvent *AEvent);
protected slots:
void onFrameChanged();
void onFormatChanged();
void onSurfaceDestroyed();
private:
QSize FSizeHint;
qint64 FCurFrameKey;
VideoSurface *FSurface;
};
pjmedia_vid_dev_factory* qwidget_factory_create(pj_pool_factory *pf);
#endif // RENDERDEV_H