QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GStreamer::Environment Namespace Reference

Classes

struct  BundledRuntime
 The desktop GStreamer runtime bundled with the app that prepareEnvironment() pointed GStreamer at. More...
struct  BundleLayout
 Where a desktop install keeps its GStreamer runtime, as candidate paths in priority order. More...

Enumerations

enum class  DesktopInstall { MacOSFramework , MacOSFlat , Windows , Linux }
 The desktop installs prepareEnvironment() knows how to point GStreamer into. More...

Functions

BundleLayout bundleLayout (DesktopInstall install, const QString &appDir)
VideoBackend::EnvPrepResult prepareEnvironment (const QString &appDir)
QString usePrivateRegistry (const QString &cacheDir, const QString &installPath)
bool writeIfChanged (const QString &path, QByteArrayView content)
BundledRuntime bundledRuntime ()
 The bundled runtime the last prepareEnvironment() applied; empty before it ran.
void logDiagnostics ()

Detailed Description

Process-wide GStreamer environment setup: plugin-path discovery, GIO compat override, env var management, APK asset extraction, mobile CA file.

Enumeration Type Documentation

◆ DesktopInstall

The desktop installs prepareEnvironment() knows how to point GStreamer into.

Enumerator
MacOSFramework 

An app bundle with GStreamer.framework, whose paths win over the app's own lib.

MacOSFlat 

An app bundle with a flat SDK copied next to the app, whose paths win over the framework's.

Windows 

bin/ beside lib/gstreamer-1.0 and libexec/gstreamer-1.0.

Linux 

An AppImage or other prefix: bin/ beside lib/ and libexec/.

Definition at line 30 of file GStreamerEnvironment.h.

Function Documentation

◆ bundledRuntime()

BundledRuntime GStreamer::Environment::bundledRuntime ( )

The bundled runtime the last prepareEnvironment() applied; empty before it ran.

Definition at line 547 of file GStreamerEnvironment.cc.

Referenced by GStreamerVideoBackend::selfTest().

◆ bundleLayout()

BundleLayout GStreamer::Environment::bundleLayout ( DesktopInstall install,
const QString & appDir )

The layout of install for the app in appDir. Only reads the filesystem to find the macOS framework's version directory, so every platform's layout can be checked on any host.

Definition at line 447 of file GStreamerEnvironment.cc.

References Linux, MacOSFlat, MacOSFramework, and Windows.

◆ logDiagnostics()

void GStreamer::Environment::logDiagnostics ( )

Dump the GST_PLUGIN_*‍/GST_REGISTRY* vars managed by this layer to the log at critical level. Called from plugin-verification failure paths so a stripped registry shows how the loader was configured.

Definition at line 552 of file GStreamerEnvironment.cc.

◆ prepareEnvironment()

VideoBackend::EnvPrepResult GStreamer::Environment::prepareEnvironment ( const QString & appDir = QString())

Apply all GStreamer env vars for this process from bundled-paths discovery + platform validation, for the app in appDir (default: QCoreApplication::applicationDirPath()). A desktop runtime bundled with the app replaces the default plugin path; GStreamer keeps scanning its plugins out of process, so a plugin that crashes while loading is blacklisted instead of taking QGC down. Idempotent: a later call applies the same environment, as it doesn't take the values an earlier one set for the user's. Returns the validation outcome by value (threaded explicitly to initialize(), not a cross-thread global). Not thread-safe: call it on the GUI thread, before gst_init() and any thread that reads the environment.

Definition at line 486 of file GStreamerEnvironment.cc.

Referenced by GStreamerVideoBackend::prepareEnvironment().

◆ usePrivateRegistry()

QString GStreamer::Environment::usePrivateRegistry ( const QString & cacheDir,
const QString & installPath )

Point GST_REGISTRY at gstreamer-<runtime version>-<arch>-<install hash>.bin in cacheDir, creating the directory, unless the user set GST_REGISTRY or GST_REGISTRY_1_0 or cacheDir is empty. The hash names the install at installPath by what stays put across launches: the AppImage file ($APPIMAGE) for a path in its mount ($APPDIR), and the app's name for a macOS app translocated to a random directory. Touches the registry, and removes the gstreamer-*.bin registries in cacheDir that no install has touched for 30 days. prepareEnvironment() does this with the app's cache location and plugin path for a bundled desktop runtime. Returns the registry it set, else an empty string.

Definition at line 499 of file GStreamerEnvironment.cc.

◆ writeIfChanged()

bool GStreamer::Environment::writeIfChanged ( const QString & path,
QByteArrayView content )

Makes the file at path hold content, creating its directory: written only when it differs, and through a temporary file, so it is never left half written. False when it can't. prepareEnvironment() extracts the Android APK's CA bundle with it.

Definition at line 526 of file GStreamerEnvironment.cc.