-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamerartp.h
105 lines (77 loc) · 2.8 KB
/
camerartp.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef CAMERA_H
#define CAMERA_H
#include <QTimer>
#include <QProcess>
#include <QTime>
#include <QStyleOption>
#include <QPainter>
#define DEBUG_MSG(x) qDebug() << (x);
#if defined(Q_OS_LINUX)
#include <QVideoWidget>
#include <QGst/Pipeline>
#include <QGst/Ui/VideoWidget>
class CameraRtp : public QVideoWidget //QGst::Ui::VideoWidget
{
Q_OBJECT
public:
CameraRtp(QWidget *parent = 0);
~CameraRtp();
void set_camera(void);
void set_channel(quint32 channel);
void set_property(const QString &property, int value);
void set_property(const QString &property, float value);
void set_property(const QString &property, const QString &value);
void getProperty(const QString &property, int * result, bool * ok);
void getProperty(const QString &property, float * result, bool * ok);
void getProperty(const QString &property, QString * result, bool * ok);
void set_orientation(int value);
QGst::State state() const;
void paintEvent(QPaintEvent* event);
public Q_SLOTS:
void play();
void pause();
void stop();
Q_SIGNALS:
void stateChanged();
//void setLog(LogType type, const QString &msg);
private:
void onBusMessage(const QGst::MessagePtr & message);
void handlePipelineStateChange(const QGst::StateChangedMessagePtr & scm);
QGst::PipelinePtr m_pipeline;
QGst::ElementPtr camerasrc;
QGst::ElementPtr app_vidconv;
QGst::ElementPtr udp_vidconv;
QGst::ElementPtr udpsink;
};
#else
class CameraRtp : public QWidget
{
Q_OBJECT
public:
explicit CameraRtp(QWidget *parent = 0) : QWidget(parent) { }
void set_camera(void) {}
void set_channel(quint32 channel) { Q_UNUSED(channel); }
void set_property(const QString &property, int value) { Q_UNUSED(property); Q_UNUSED(value); }
void set_property(const QString &property, float value) { Q_UNUSED(property); Q_UNUSED(value); }
void set_property(const QString &property, const QString &value) { Q_UNUSED(property); Q_UNUSED(value);}
void getProperty(const QString &property, int * result, bool * ok)
{ Q_UNUSED(property); Q_UNUSED(result); *ok = false; }
void getProperty(const QString &property, float * result, bool * ok)
{ Q_UNUSED(property); Q_UNUSED(result); *ok = false; }
void getProperty(const QString &property, QString * result, bool * ok)
{ Q_UNUSED(property); Q_UNUSED(result); *ok = false; }
void set_orientation(int value) { Q_UNUSED(value); }
quint32 state() { return 0; }
signals:
void stateChanged();
void setLog(LogType type, const QString &msg);
public Q_SLOTS:
void play() {}
void pause() {}
void stop() {}
};
#if defined(Q_OS_LINUX)
#include "moc_camerartp.cpp"
#endif
#endif
#endif // CAMERA_H