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 RtpUdpH264,
31 RtpUdpH265,
32 RtspH264,
33 MpegTsUdp,
34 MpegTsTcp,
35 };
36
39
42
45 bool start(StreamType type, const QString &host, quint16 port);
46
48 void stop();
49
50 bool isRunning() const { return _running; }
51 QString servedUri() const { return _servedUri; }
52
56 static bool isStreamTypeAvailable(StreamType type);
57
58private:
59 bool _startPipeline(const QString &launch);
60#ifdef QGC_GST_RTSP_SERVER
61 bool _startRtsp(const QString &host, quint16 port);
62 void _stopRtsp();
63
64 GstRTSPServer *_rtspServer = nullptr;
65 GMainLoop *_rtspLoop = nullptr;
66 GMainContext *_rtspContext = nullptr;
67 std::thread _rtspThread;
68#endif
69
70 GstElement *_pipeline = nullptr;
71 bool _running = false;
72 QString _servedUri;
73};
struct _GstElement GstElement
Serves a synthetic (videotestsrc) live video stream for MockLink so the GStreamer receive pipeline ca...
MockVideoStreamServer(const MockVideoStreamServer &)=delete
MockVideoStreamServer()=default
MockVideoStreamServer & operator=(const MockVideoStreamServer &)=delete