QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VideoBackend.cc
Go to the documentation of this file.
1#include "VideoBackend.h"
2
3#include <QtCore/QCoreApplication>
4#include <QtCore/QSettings>
5
6#include "AppMessages.h"
7#include "AppSettings.h"
8#include "QGCApplication.h"
10
11#ifdef QGC_GST_STREAMING
13#endif
14
15namespace {
16
18class QtMultimediaVideoBackend final : public VideoBackend
19{
20public:
21 Capabilities capabilities() const override { return {.streaming = true}; }
22
23 VideoReceiver* createReceiver(QObject* parent) override { return new QtMultimediaVideoReceiver(parent); }
24};
25
26} // namespace
27
29{
30#ifdef QGC_GST_STREAMING
31 static GStreamerVideoBackend backend;
32#else
33 static QtMultimediaVideoBackend backend;
34#endif
35 return backend;
36}
37
39{
40 return qgcApp() && QGC::runningUnitTests() && !qEnvironmentVariableIsSet("QGC_TEST_ENABLE_GSTREAMER");
41}
42
44{
45 return QCoreApplication::translate("VideoBackend", "Video streaming failed to initialize.");
46}
47
49{
50 QSettings settings;
51 settings.beginGroup(QString::fromLatin1(AppSettings::settingsGroup));
52 if (settings.contains(AppSettings::gstDebugLevelName)) {
53 return settings.value(AppSettings::gstDebugLevelName).toInt();
54 }
55 return std::nullopt;
56}
#define qgcApp()
VideoBackend on GStreamer: the only place the app reaches GStreamer's lifecycle from,...
QString settingsGroup() const
virtual QString initFailureMessage() const
What to tell the user once initialize() has failed: what failed, and what plays the streams instead.
static VideoBackend & instance()
static bool disabledForUnitTests()
True when the backend is skipped under unit tests (opt back in with QGC_TEST_ENABLE_GSTREAMER).
static std::optional< int > persistedDebugLevel()
The persisted gstDebugLevel setting, read before the settings system exists; nullopt when it was neve...
VideoBackend(const VideoBackend &)=delete
bool runningUnitTests()