3#include <QtCore/QVariantList>
4#include <QtMultimedia/QMediaDevices>
16bool hasPipelineSettings()
25 _updateVideoSources();
26 (void) connect(
new QMediaDevices(
this), &QMediaDevices::videoInputsChanged,
this,
27 &VideoSettings::_updateVideoSources);
29 _setForceVideoDecodeList();
31 _nameToMetaDataMap[videoSourceName]->setRawDefaultValue(videoDisabled);
34void VideoSettings::_updateVideoSources()
36 static constexpr const char* fixedSources[] = {
46#ifdef QGC_HERELINK_AIRUNIT_VIDEO
53 const QStringList cameras = _cameraNames ? _cameraNames() : UVCDevices::
deviceNames();
58 for (const char* const source : fixedSources) {
59 sources.append(QString::fromLatin1(source));
60 labels.append(tr(source));
64 const QVariantList listed = metaData->enumValues();
65 if (listed.isEmpty() || (listed.mid(0, sources.size()) == sources)) {
66 _offerCameras(metaData, _videoSourceFact, sources, labels, cameras);
70 if (
FactMetaData*
const metaData = _nameToMetaDataMap.value(uvcTileCameraName)) {
71 _offerCameras(metaData, _uvcTileCameraFact, {QString()}, {tr(
"None")}, cameras);
75void VideoSettings::_offerCameras(
FactMetaData* metaData,
Fact* fact, QVariantList values, QStringList labels,
76 const QStringList& cameras)
78 for (
const QString& camera : cameras) {
79 values.append(camera);
80 labels.append(camera);
82 const QString selected = fact ? fact->
rawValue().toString() : QString();
83 if (!selected.isEmpty() && !values.contains(selected)) {
84 values.append(selected);
85 labels.append(tr(
"%1 (not connected)").arg(selected));
125 if (!_videoSourceFact) {
126 _videoSourceFact = _createSettingsFact(videoSourceName);
130 _updateVideoSources();
132 Qt::QueuedConnection);
134 return _videoSourceFact;
139 if (!_uvcTileCameraFact) {
140 _uvcTileCameraFact = _createSettingsFact(uvcTileCameraName);
142 _updateVideoSources();
143 (void) connect(_uvcTileCameraFact, &
Fact::rawValueChanged,
this, &VideoSettings::_updateVideoSources,
144 Qt::QueuedConnection);
146 return _uvcTileCameraFact;
150#define DECLARE_VIDEO_SETTINGSFACT_VISIBLE(NAME, VISIBLE) \
151 DECLARE_SETTINGSFACT_NO_FUNC(VideoSettings, NAME) \
153 if (!_##NAME##Fact) { \
154 _##NAME##Fact = _createSettingsFact(NAME##Name); \
155 _##NAME##Fact->setUserVisible(VISIBLE); \
157 return _##NAME##Fact; \
177#undef DECLARE_VIDEO_SETTINGSFACT_VISIBLE
179void VideoSettings::_setForceVideoDecodeList()
181 if (!hasPipelineSettings()) {
184 static const QList<VideoDecoderOption> removeForceVideoDecodeList{
185#if defined(Q_OS_ANDROID)
188#elif defined(Q_OS_LINUX)
191#elif defined(Q_OS_WIN)
194#elif defined(Q_OS_MACOS)
197#elif defined(Q_OS_IOS)
212 if (!hasPipelineSettings()) {
215 static const QList<VideoDecoderOption> hardwareFamilies{
227 for (
const auto family : hardwareFamilies) {
230 const QVariant familyValue =
static_cast<int>(family);
231 if (!available.contains(family) && metaData->
enumValues().contains(familyValue)) {
237 Fact*
const fact = forceVideoDecoder();
#define DECLARE_SETTINGSFACT_NO_FUNC(CLASS, NAME)
#define DECLARE_SETTINGSFACT(CLASS, NAME)
#define DECLARE_SETTINGGROUP(NAME, GROUP)
VideoDecoderOption
The decoders VideoSettings' forceVideoDecoder can force. The values are persisted.
#define DECLARE_VIDEO_SETTINGSFACT_VISIBLE(NAME, VISIBLE)
A Fact is used to hold a single value within the system.
void setEnumInfo(const QStringList &strings, const QVariantList &values)
Generally this is done during parsing. But if you know what you are doing, you can.
void rawValueChanged(const QVariant &value)
void setRawValue(const QVariant &value)
QVariant rawValue() const
QMap< QString, FactMetaData * > _nameToMetaDataMap
static VideoBackend & instance()
virtual QList< VideoDecoderOption > availableDecoderFamilies()
The hardware decoder families present, as forceVideoDecoder values (never Default or Software).
virtual Capabilities capabilities() const =0
static constexpr const char * videoSource3DRSolo
static constexpr const char * videoSourceParrotDiscovery
static constexpr const char * videoSourceTCP
static constexpr const char * videoSourceUDPH264
static constexpr const char * videoSourceHerelinkHotspot
static constexpr const char * videoSourceRTSP
static constexpr const char * videoDisabled
void pruneUnavailableDecoders()
static constexpr const char * videoSourceYuneecMantisG
static constexpr const char * videoSourceUDPH265
static constexpr const char * videoSourceMPEGTS
static constexpr const char * videoSourceHerelinkAirUnit
QStringList deviceNames()
Descriptions of the attached cameras.
bool streaming
Plays network video streams; their settings are shown only then.