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

The self-test's media pipelines: decoding the embedded samples and recording and reading back a file. More...

Classes

struct  RegisteredPlugin
 A plugin as GStreamer's registry has it. More...
struct  Sample
 An encoded sample in the app's resources (Media/generate.sh makes them). More...
struct  RecordingFormat
struct  DecodeResult

Functions

QStringList bundledPluginIssues (const QList< RegisteredPlugin > &registered, const QStringList &pluginDirs, const QStringList &pluginFiles)
bool run (const Environment::BundledRuntime &runtime)
bool hasDecoderFor (const Sample &sample)
 Whether decodebin3 has a decoder for sample's codec to plug: one ranked at least MARGINAL.
DecodeResult decodeSample (const Sample &sample, const QByteArray &data, std::chrono::milliseconds timeout)
 appsrc ! <parser> ! decodebin3 ! appsink, the sink taking raw video in system memory, which every decoder can give.
QString recordSample (const QString &file, VideoReceiver::FileFormat format, const QByteArray &h264, std::chrono::milliseconds timeout)
 appsrc ! RecordingBranch's file sink (h264parse ! muxer ! filesink), as a recording is muxed.
QString readBack (const QString &file, const char *demuxer, std::chrono::milliseconds timeout)
 filesrc ! <demuxer> ! fakesink: the recorded file opens and holds video.

Variables

constexpr Sample kH264Sample {"H.264", ":/gstreamer/selftest/h264_160x120.h264", "video/x-h264", "h264parse"}
constexpr Sample kH265Sample {"H.265", ":/gstreamer/selftest/h265_320x240.h265", "video/x-h265", "h265parse"}
constexpr RecordingFormat kRecordingFormats []

Detailed Description

The self-test's media pipelines: decoding the embedded samples and recording and reading back a file.

The checks run() makes for the boot test (–simple-boot-test), proving that the GStreamer runtime the app ships works: its plugins load, every feature's elements exist, H.264 (and H.265, given a decoder) decodes, MP4 and MKV record, and GIO has TLS and, where the bundle ships libproxy, proxy support. Each failed check is logged under Video.GStreamer.SelfTest, naming the element, plugin or file at fault.

Function Documentation

◆ bundledPluginIssues()

QStringList GStreamer::SelfTest::bundledPluginIssues ( const QList< RegisteredPlugin > & registered,
const QStringList & pluginDirs,
const QStringList & pluginFiles )

What is wrong with a bundled runtime's plugins, one message each: plugins GStreamer blacklisted (typically because a library they link is missing), registered plugins from outside pluginDirs or whose file the bundle doesn't ship, and plugin files in pluginDirs (pluginFiles) that the registry lacks. Static plugins are not checked.

Definition at line 436 of file GStreamerSelfTest.cc.

References bundledPluginIssues().

Referenced by bundledPluginIssues().

◆ decodeSample()

DecodeResult GStreamer::SelfTest::decodeSample ( const Sample & sample,
const QByteArray & data,
std::chrono::milliseconds timeout )

◆ hasDecoderFor()

bool GStreamer::SelfTest::hasDecoderFor ( const Sample & sample)

Whether decodebin3 has a decoder for sample's codec to plug: one ranked at least MARGINAL.

Definition at line 98 of file GStreamerSelfTestMedia.cc.

References GStreamer::adoptCaps(), GStreamer::forEachVideoDecoderFactory(), and GStreamer::SelfTest::Sample::mediaType.

◆ readBack()

QString GStreamer::SelfTest::readBack ( const QString & file,
const char * demuxer,
std::chrono::milliseconds timeout )

filesrc ! <demuxer> ! fakesink: the recorded file opens and holds video.

Definition at line 179 of file GStreamerSelfTestMedia.cc.

References GStreamer::addToBin(), GStreamer::adoptFloating(), GStreamer::adoptPad(), GStreamer::glibFileName(), and GStreamer::makeElement().

◆ recordSample()

QString GStreamer::SelfTest::recordSample ( const QString & file,
VideoReceiver::FileFormat format,
const QByteArray & h264,
std::chrono::milliseconds timeout )

appsrc ! RecordingBranch's file sink (h264parse ! muxer ! filesink), as a recording is muxed.

Definition at line 158 of file GStreamerSelfTestMedia.cc.

References GStreamer::addToBin(), GStreamer::adoptFloating(), kH264Sample, GStreamer::makeElement(), and RecordingBranch::makeFileSink().

◆ run()

bool GStreamer::SelfTest::run ( const Environment::BundledRuntime & runtime)

Runs every check that applies to runtime, within about 15 s, and returns whether all passed. Needs an initialized GStreamer and the GUI thread; restores any decoder rank it changes.

Definition at line 508 of file GStreamerSelfTest.cc.

References run().

Referenced by run(), and GStreamerVideoBackend::selfTest().

Variable Documentation

◆ kH264Sample

Sample GStreamer::SelfTest::kH264Sample {"H.264", ":/gstreamer/selftest/h264_160x120.h264", "video/x-h264", "h264parse"}
inlineconstexpr

Definition at line 24 of file GStreamerSelfTestMedia.h.

Referenced by recordSample().

◆ kH265Sample

Sample GStreamer::SelfTest::kH265Sample {"H.265", ":/gstreamer/selftest/h265_320x240.h265", "video/x-h265", "h265parse"}
inlineconstexpr

Definition at line 26 of file GStreamerSelfTestMedia.h.

◆ kRecordingFormats

RecordingFormat GStreamer::SelfTest::kRecordingFormats[]
inlineconstexpr
Initial value:
= {
{"MP4", VideoReceiver::FileFormat::Mp4, "mp4", "qtdemux"},
{"MKV", VideoReceiver::FileFormat::Mkv, "mkv", "matroskademux"},
}

Definition at line 36 of file GStreamerSelfTestMedia.h.