-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline.h
75 lines (50 loc) · 1.51 KB
/
pipeline.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
#ifndef PIPELINE_H
#define PIPELINE_H
#include <memory>
#include <QSize>
#include <QRect>
#include <QGst/Pipeline>
class AppSink;
class Pipeline : public QObject {
Q_OBJECT
public:
Pipeline(const QString &host, int videoPort, int metadataPort, QObject *parent = nullptr);
~Pipeline();
void play();
const QGst::ElementPtr getVideoSink() {
return videoSink;
}
signals:
void frameSizeChanged(QSize rect);
void updateRoi(QRect roi);
private:
class Session {
public:
Session(int id, QGst::CapsPtr caps, QGst::BinPtr bin, int port);
int getId() const;
QGst::CapsPtr getCaps() const;
QGst::BinPtr getBin() const;
int getPort() const;
private:
int id;
QGst::CapsPtr caps;
QGst::BinPtr bin;
int port;
};
std::unique_ptr<Session> makeVideoSession(const int port);
std::unique_ptr<Session> makeMetadataSession(const int port);
void joinSession(QGst::ElementPtr rtpBin, const Session& session);
QString toString(QGst::State state);
void onBusMessage(const QGst::ObjectPtr object, const QGst::MessagePtr &message);
void onPadAdded(const QGst::PadPtr &pad);
void onUpdate(const QGst::ElementPtr &element);
void checkCaps();
QGst::PipelinePtr pipeline;
QGst::ElementPtr videoSink;
QGst::CapsPtr videoCaps;
AppSink *appSink;
std::unique_ptr<Session> videoSession;
std::unique_ptr<Session> metadataSession;
QString host;
};
#endif // PIPELINE_H