QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VideoBackend.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4
5#include <QtCore/QList>
6#include <QtCore/QString>
7#include <QtCore/QStringList>
8#include <QtCore/qcontainerfwd.h>
9
10#include "VideoDecoderOptions.h"
11
12class QObject;
13class QQuickWindow;
14class VideoReceiver;
15
21{
22public:
27 {
28 bool ok = true;
29 QString error;
30 };
31
32 virtual ~VideoBackend() = default;
33
34 VideoBackend(const VideoBackend&) = delete;
36
37 static VideoBackend& instance();
38
40 static bool disabledForUnitTests();
41
43 static std::optional<int> persistedDebugLevel();
44
47 {
49 bool streaming = false;
52 bool pipelineSettings = false;
54 bool gpuVideoPath = false;
56 bool asyncInit = false;
57 };
58
60 {
62 QStringList arguments;
66 std::optional<int> debugLevel;
67 };
68
69 virtual Capabilities capabilities() const = 0;
70
72 virtual VideoReceiver* createReceiver(QObject* parent) = 0;
73
74 // The rest is setup and tuning a backend that needs none leaves alone.
75
78 virtual void configureQtGraphics([[maybe_unused]] bool softwareRendering) {}
79
81 virtual EnvPrepResult prepareEnvironment() { return {}; }
82
83 virtual bool initialize([[maybe_unused]] const InitParams& params) { return true; }
84
86 virtual QString initFailureMessage() const;
87
89 virtual bool selfTest() { return true; }
90
91 virtual void applyDecoderPriorities([[maybe_unused]] VideoDecoderOption option) {}
92
94 virtual QList<VideoDecoderOption> availableDecoderFamilies() { return {}; }
95
96 virtual void setDebugLevel([[maybe_unused]] int level) {}
97
98 virtual void onMainWindowReady([[maybe_unused]] QQuickWindow* window) {}
99
102 virtual void setAndroidJniState([[maybe_unused]] void* javaVm, [[maybe_unused]] void* appContext,
103 [[maybe_unused]] void* classLoader)
104 {}
105
106protected:
107 VideoBackend() = default;
108};
VideoDecoderOption
The decoders VideoSettings' forceVideoDecoder can force. The values are persisted.
virtual QString initFailureMessage() const
What to tell the user once initialize() has failed: what failed, and what plays the streams instead.
virtual bool selfTest()
The boot test's check that the initialized backend decodes and records.
virtual bool initialize(const InitParams &params)
virtual void setAndroidJniState(void *javaVm, void *appContext, void *classLoader)
virtual void applyDecoderPriorities(VideoDecoderOption option)
static VideoBackend & instance()
virtual VideoReceiver * createReceiver(QObject *parent)=0
A receiver that can play: once initialize() has failed, one that needs no initialization.
virtual QList< VideoDecoderOption > availableDecoderFamilies()
The hardware decoder families present, as forceVideoDecoder values (never Default or Software).
virtual Capabilities capabilities() const =0
virtual EnvPrepResult prepareEnvironment()
GUI thread, before initialize().
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...
virtual void onMainWindowReady(QQuickWindow *window)
VideoBackend(const VideoBackend &)=delete
virtual void setDebugLevel(int level)
VideoBackend()=default
virtual void configureQtGraphics(bool softwareRendering)
VideoBackend & operator=(const VideoBackend &)=delete
virtual ~VideoBackend()=default
What the backend offers.
bool gpuVideoPath
Shows decoded frames without copying them through the CPU.
bool asyncInit
initialize() must run, off the GUI thread, before receivers are created.
bool streaming
Plays network video streams; their settings are shown only then.
std::optional< int > debugLevel
The persisted debug threshold to start with (persistedDebugLevel()).
QStringList arguments
QCoreApplication::arguments(), snapshotted on the GUI thread.
EnvPrepResult environment
What prepareEnvironment() did.