QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MockVideoStreamServer.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QLoggingCategory>
4#include <QtCore/QString>
5#include <QtCore/QtGlobal>
6
7typedef struct _GstElement GstElement;
8
9#ifdef QGC_GST_RTSP_SERVER
10#include <thread>
11typedef struct _GstRTSPServer GstRTSPServer;
12typedef struct _GMainLoop GMainLoop;
13typedef struct _GMainContext GMainContext;
14#endif
15
16Q_DECLARE_LOGGING_CATEGORY(MockVideoStreamServerLog)
17
18
25{
26public:
29 enum class StreamType
30 {
31 RtpUdpH264,
32 RtpUdpH265,
33 RtspH264,
34 RtspH265,
35 MpegTsUdp,
36 MpegTsTcp,
37 };
38
41
44
48 bool start(StreamType type, const QString& host, quint16 port);
49
51 void stop();
52
53 QString servedUri() const { return _servedUri; }
54
58 static bool isStreamTypeAvailable(StreamType type);
59
60private:
61 bool _startPipeline(const QString& launch);
62#ifdef QGC_GST_RTSP_SERVER
64 int _startRtsp(StreamType type, const QString& host, quint16 port);
65 void _stopRtsp();
66
67 GstRTSPServer* _rtspServer = nullptr;
68 GMainLoop* _rtspLoop = nullptr;
69 GMainContext* _rtspContext = nullptr;
70 std::thread _rtspThread;
71#endif
72
73 GstElement* _pipeline = nullptr;
74 QString _servedUri;
75};
struct _GstElement GstElement
void stop()
Stop the stream and release all resources. Safe to call when not running.
MockVideoStreamServer(const MockVideoStreamServer &)=delete
MockVideoStreamServer()=default
MockVideoStreamServer & operator=(const MockVideoStreamServer &)=delete
bool start(StreamType type, const QString &host, quint16 port)