QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GStreamerVideoBackend Class Referencefinal

VideoBackend on GStreamer: the only place the app reaches GStreamer's lifecycle from, in the only order it can run: prepareEnvironment() on the GUI thread, before gst_init() reads the environment; initialize() once, on any thread; then selfTest(), once initialized. More...

#include <GStreamerVideoBackend.h>

Inheritance diagram for GStreamerVideoBackend:
Collaboration diagram for GStreamerVideoBackend:

Public Types

enum class  State : uint8_t { Unprepared , Prepared , Initialized , Failed }

Public Member Functions

State state () const
Capabilities capabilities () const override
VideoReceiver * createReceiver (QObject *parent) override
 A receiver that can play: once initialize() has failed, one that needs no initialization.
void configureQtGraphics (bool softwareRendering) override
EnvPrepResult prepareEnvironment () override
 Points GStreamer at its plugins, scanner and registry (GStreamer::Environment::prepareEnvironment()).
bool initialize (const InitParams &params) override
 GStreamer::initialize() the first time; afterwards that call's outcome.
QString initFailureMessage () const override
 What to tell the user once initialize() has failed: what failed, and what plays the streams instead.
bool selfTest () override
 GStreamer::SelfTest::run() once initialized; false, logged, otherwise.
void applyDecoderPriorities (VideoDecoderOption option) override
QList< VideoDecoderOption > availableDecoderFamilies () override
 The hardware decoder families present, as forceVideoDecoder values (never Default or Software).
void setDebugLevel (int level) override
void onMainWindowReady (QQuickWindow *window) override
void setAndroidJniState (void *javaVm, void *appContext, void *classLoader) override
Public Member Functions inherited from VideoBackend
virtual ~VideoBackend ()=default
 VideoBackend (const VideoBackend &)=delete
VideoBackend & operator= (const VideoBackend &)=delete

Additional Inherited Members

Static Public Member Functions inherited from VideoBackend
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 never set.
Protected Member Functions inherited from VideoBackend
 VideoBackend ()=default

Detailed Description

VideoBackend on GStreamer: the only place the app reaches GStreamer's lifecycle from, in the only order it can run: prepareEnvironment() on the GUI thread, before gst_init() reads the environment; initialize() once, on any thread; then selfTest(), once initialized.

gst_init() can't be undone, so initialize() runs GStreamer's setup once: a later call returns the first one's outcome, and a failed setup isn't retried. The receivers are then Qt Multimedia's. The free functions in GStreamer.h, GStreamerEnvironment.h and GStreamerSelfTest.h do the work.

Definition at line 15 of file GStreamerVideoBackend.h.

Member Enumeration Documentation

◆ State

enum class GStreamerVideoBackend::State : uint8_t
strong
Enumerator
Unprepared 
Prepared 

The environment is set up for gst_init().

Initialized 

GStreamer runs, with the plugins video needs.

Failed 

initialize() failed; Qt Multimedia plays the streams.

Definition at line 18 of file GStreamerVideoBackend.h.

Member Function Documentation

◆ applyDecoderPriorities()

void GStreamerVideoBackend::applyDecoderPriorities ( VideoDecoderOption option)
overridevirtual

Reimplemented from VideoBackend.

Definition at line 93 of file GStreamerVideoBackend.cc.

References GStreamer::setCodecPriorities().

◆ availableDecoderFamilies()

QList< VideoDecoderOption > GStreamerVideoBackend::availableDecoderFamilies ( )
overridevirtual

The hardware decoder families present, as forceVideoDecoder values (never Default or Software).

Reimplemented from VideoBackend.

Definition at line 98 of file GStreamerVideoBackend.cc.

References GStreamer::availableDecoderFamilies().

◆ capabilities()

VideoBackend::Capabilities GStreamerVideoBackend::capabilities ( ) const
overridevirtual

Implements VideoBackend.

Definition at line 29 of file GStreamerVideoBackend.cc.

◆ configureQtGraphics()

void GStreamerVideoBackend::configureQtGraphics ( bool softwareRendering)
overridevirtual

Qt graphics setup the backend's GPU video paths need; call it before the QGuiApplication exists, as Qt reads it at startup. softwareRendering: the user asked for software rendering (–swrast), which it must keep.

Reimplemented from VideoBackend.

Definition at line 24 of file GStreamerVideoBackend.cc.

References HwBuffers::configureQtGraphics().

◆ createReceiver()

VideoReceiver * GStreamerVideoBackend::createReceiver ( QObject * parent)
overridevirtual

A receiver that can play: once initialize() has failed, one that needs no initialization.

Implements VideoBackend.

Definition at line 39 of file GStreamerVideoBackend.cc.

References Failed, and state().

◆ initFailureMessage()

QString GStreamerVideoBackend::initFailureMessage ( ) const
overridevirtual

What to tell the user once initialize() has failed: what failed, and what plays the streams instead.

Reimplemented from VideoBackend.

Definition at line 77 of file GStreamerVideoBackend.cc.

◆ initialize()

bool GStreamerVideoBackend::initialize ( const InitParams & params)
overridevirtual

GStreamer::initialize() the first time; afterwards that call's outcome.

Reimplemented from VideoBackend.

Definition at line 59 of file GStreamerVideoBackend.cc.

References Failed, GStreamer::initialize(), Initialized, Prepared, state(), and Unprepared.

◆ onMainWindowReady()

void GStreamerVideoBackend::onMainWindowReady ( QQuickWindow * window)
overridevirtual

Reimplemented from VideoBackend.

Definition at line 108 of file GStreamerVideoBackend.cc.

References GStreamer::onMainWindowReady().

◆ prepareEnvironment()

VideoBackend::EnvPrepResult GStreamerVideoBackend::prepareEnvironment ( )
overridevirtual

Points GStreamer at its plugins, scanner and registry (GStreamer::Environment::prepareEnvironment()).

Reimplemented from VideoBackend.

Definition at line 48 of file GStreamerVideoBackend.cc.

References Prepared, GStreamer::Environment::prepareEnvironment(), state(), and Unprepared.

◆ selfTest()

bool GStreamerVideoBackend::selfTest ( )
overridevirtual

GStreamer::SelfTest::run() once initialized; false, logged, otherwise.

Reimplemented from VideoBackend.

Definition at line 84 of file GStreamerVideoBackend.cc.

References GStreamer::Environment::bundledRuntime(), Initialized, GStreamer::SelfTest::run(), and state().

◆ setAndroidJniState()

void GStreamerVideoBackend::setAndroidJniState ( void * javaVm,
void * appContext,
void * classLoader )
overridevirtual

Android: hands the backend the JavaVM, application context and class loader (jobject, or null) its plugins look up through JNI.

Reimplemented from VideoBackend.

Definition at line 113 of file GStreamerVideoBackend.cc.

◆ setDebugLevel()

void GStreamerVideoBackend::setDebugLevel ( int level)
overridevirtual

Reimplemented from VideoBackend.

Definition at line 103 of file GStreamerVideoBackend.cc.

References GStreamer::setDebugLevel().

◆ state()

State GStreamerVideoBackend::state ( ) const
inline

Definition at line 26 of file GStreamerVideoBackend.h.

Referenced by createReceiver(), initialize(), prepareEnvironment(), and selfTest().


The documentation for this class was generated from the following files: