QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GStreamerSelfTestMedia.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <gst/gst.h>
5
6#include <QtCore/QByteArray>
7#include <QtCore/QString>
8#include <QtCore/QStringList>
9
10#include "VideoReceiver.h"
11
13namespace GStreamer::SelfTest {
14
16struct Sample
17{
18 const char* codec;
19 const char* resource;
20 const char* mediaType;
21 const char* parser;
22};
23
24inline constexpr Sample kH264Sample{"H.264", ":/gstreamer/selftest/h264_160x120.h264", "video/x-h264", "h264parse"};
25// 320x240: NVIDIA's HEVC decoders (NVDEC, and d3d11/d3d12 on an NVIDIA GPU) reject frames under 144 pixels high.
26inline constexpr Sample kH265Sample{"H.265", ":/gstreamer/selftest/h265_320x240.h265", "video/x-h265", "h265parse"};
27
29{
30 const char* name;
32 const char* extension;
33 const char* demuxer;
34};
35
36inline constexpr RecordingFormat kRecordingFormats[] = {
37 {"MP4", VideoReceiver::FileFormat::Mp4, "mp4", "qtdemux"},
38 {"MKV", VideoReceiver::FileFormat::Mkv, "mkv", "matroskademux"},
39};
40
42bool hasDecoderFor(const Sample& sample);
43
45{
46 QString failure;
47 QStringList decoders;
48 bool hardware = false;
49};
50
52DecodeResult decodeSample(const Sample& sample, const QByteArray& data, std::chrono::milliseconds timeout);
53
55QString recordSample(const QString& file, VideoReceiver::FileFormat format, const QByteArray& h264,
56 std::chrono::milliseconds timeout);
57
59QString readBack(const QString& file, const char* demuxer, std::chrono::milliseconds timeout);
60
61} // namespace GStreamer::SelfTest
FileFormat
Values are persisted by VideoSettings::recordingFormat.
The self-test's media pipelines: decoding the embedded samples and recording and reading back a file.
bool hasDecoderFor(const Sample &sample)
Whether decodebin3 has a decoder for sample's codec to plug: one ranked at least MARGINAL.
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.
constexpr RecordingFormat kRecordingFormats[]
DecodeResult decodeSample(const Sample &sample, const QByteArray &data, std::chrono::milliseconds timeout)
appsrc ! <parser> ! decodebin3 ! appsink, the sink taking raw video in system memory,...
QString readBack(const QString &file, const char *demuxer, std::chrono::milliseconds timeout)
filesrc ! <demuxer> ! fakesink: the recorded file opens and holds video.
An encoded sample in the app's resources (Media/generate.sh makes them).