6#include <QtConcurrent/QtConcurrentRun>
7#include <QtCore/QApplicationStatic>
8#include <QtCore/QCoreApplication>
9#include <QtCore/QDateTime>
10#include <QtCore/QScopedValueRollback>
12#include <QtGui/QGuiApplication>
41#if defined(Q_OS_ANDROID)
50constexpr uint kMaxVideoTiles = 4;
61QString streamAddress(
const QString& uri)
69QList<MavlinkCameraControlInterface*> vehicleCameras(
QGCCameraManager* cameraManager)
71 QList<MavlinkCameraControlInterface*> cameras;
73 for (
int i = 0; i < model->
count(); ++i) {
74 if (
auto*
const camera = qobject_cast<MavlinkCameraControlInterface*>(model->
get(i))) {
75 cameras.append(camera);
92 , _sources{_primaryStream, _thermalStream, _cameraSource}
93 , _measuredSource(_primaryStream)
98 return new QtMultimediaVideoReceiver(owner);
104 qCDebug(VideoManagerLog) <<
this;
107 _connectSource(source);
113 _cameraSource->scheduleApply();
119#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
122 (void) connect(
qGuiApp, &QGuiApplication::applicationStateChanged,
this, &VideoManager::_onApplicationStateChanged);
124#if defined(Q_OS_ANDROID)
137 qCDebug(VideoManagerLog) <<
this;
142 return _videoManagerInstance();
145void VideoManager::_onApplicationStateChanged(Qt::ApplicationState state)
148 const bool suspended = (state == Qt::ApplicationHidden) || (state == Qt::ApplicationSuspended);
149 if (suspended == _displaySuspended) {
152 _displaySuspended = suspended;
153 qCDebug(VideoManagerLog) << (suspended ?
"In the background: display suspended" :
"Display resumed");
154 for (VideoStreamController* source : std::as_const(_sources)) {
155 source->setDisplaySuspended(suspended);
162 if (source == _primaryStream) {
170 (void) connect(source, changed,
this, &VideoManager::_updateSourceSummary);
173 qCWarning(VideoManagerLog) << source->
name() << message;
178void VideoManager::_updateSourceSummary()
181 VideoStreamController* measured =
nullptr;
182 VideoStreamController* measuredInTile =
nullptr;
184 for (VideoStreamController* source : std::as_const(_sources)) {
185 const VideoStreamStats stats = source->
stats();
186 if (source->
tile()) {
190 VideoStreamController*& first = source->
tile() ? measuredInTile : measured;
197 const QGCVideoStreamInfo*
const streamInfo = source->
decoding() ? source->
streamInfo() :
nullptr;
198 const double cameraFps = (source == _cameraSource) ? _uvcCamera->monitor()->cameraFrameRate()
199 : (streamInfo ? streamInfo->
framerate() : 0.0);
203 measured = measuredInTile ? measuredInTile : _primaryStream;
210 if (measured != _measuredSource) {
211 _measuredSource = measured;
220void VideoManager::_connectSettings()
225 [
this] { _videoSettings->uvcTileCameraAsMainPicture()->setRawValue(false); });
236 const auto reconfigure = [
this] {
238 for (VideoStreamController* source : std::as_const(_sources)) {
242 for (Fact*
const fact :
243 {_videoSettings->videoSource(), _videoSettings->udpUrl(), _videoSettings->tcpUrl(), _videoSettings->rtspUrl(),
244 _videoSettings->rtspTimeout(), _videoSettings->lowLatencyMode(), _videoSettings->rtpJitterLatencyMs(),
245 _videoSettings->rtspAutoReconnect(), _videoSettings->disableWhenDisarmed(),
247 _videoSettings->maxVideoTiles(), _videoSettings->uvcTileCamera(),
248 _videoSettings->uvcTileCameraAsMainPicture()}) {
253 for (Fact*
const fact : {_videoSettings->videoConversionElement(), _videoSettings->disablePixelAspectRatio(),
254 _videoSettings->forceCpuVideoPath()}) {
260 (void) connect(_videoSettings->forceVideoDecoder(), &
Fact::rawValueChanged,
this, [
this](
const QVariant& value) {
262 if (_initState == InitState::Ready) {
263 VideoBackend::instance().applyDecoderPriorities(videoDecoderOptionFromSetting(value.toInt()));
273 const QScopedValueRollback<bool> sourcesHeld(_updatingState, true);
274 for (VideoStreamController* source : std::as_const(_sources)) {
275 source->setReceiver(nullptr);
278 if (_backendInitFinished() && _hasMainWindow) {
279 _createVideoReceivers();
281 if (!_updatingState && _updateStatePending) {
286 Fact*
const uvcCameraFormat = _videoSettings->uvcCameraFormat();
287 _uvcCamera->setFormat(uvcCameraFormat->
rawValue().toString());
289 [
this](
const QVariant& value) { _uvcCamera->setFormat(value.toString()); });
291 const auto applyUvcTransform = [
this] {
293 _uvcCamera->setTransform(
294 static_cast<QtVideo::Rotation
>(_videoSettings->uvcCameraRotation()->rawValue().toInt()),
295 _videoSettings->uvcCameraMirror()->rawValue().toBool());
298 (void) connect(_videoSettings->uvcCameraRotation(), &
Fact::rawValueChanged,
this, applyUvcTransform);
301 const auto applyUvcControls = [
this] {
305 static_cast<QCamera::WhiteBalanceMode
>(_videoSettings->uvcWhiteBalance()->rawValue().toInt());
306 controls.
zoom = _videoSettings->uvcZoom()->rawValue().toFloat();
307 controls.
exposureCompensation = _videoSettings->uvcExposureCompensation()->rawValue().toFloat();
308 controls.
focusMode =
static_cast<QCamera::FocusMode
>(_videoSettings->uvcFocusMode()->rawValue().toInt());
309 _uvcCamera->setControls(controls);
312 for (
Fact*
const fact : {_videoSettings->uvcWhiteBalance(), _videoSettings->uvcZoom(),
313 _videoSettings->uvcExposureCompensation(), _videoSettings->uvcFocusMode()}) {
317 const auto applyRecordingEncoding = [
this] {
323 applyRecordingEncoding();
324 (void) connect(_videoSettings->uvcRecordingCodec(), &
Fact::rawValueChanged,
this, applyRecordingEncoding);
325 (void) connect(_videoSettings->uvcRecordingQuality(), &
Fact::rawValueChanged,
this, applyRecordingEncoding);
330 if (_initState != InitState::NotStarted) {
336 _initState = InitState::Ready;
340 _initState = InitState::Pending;
344 _watchBackendInit(QtConcurrent::run([&backend, params] {
return backend.
initialize(params); }));
347void VideoManager::_watchBackendInit(
const QFuture<bool>& future)
349 _backendInitFuture = future;
351 (void) _backendInitFuture.then(
this, [
this](
bool success) { _onBackendInitComplete(success); })
352 .onCanceled(
this, [
this] { _onBackendInitComplete(
false); });
357 if (_initState == InitState::NotStarted) {
361 if (_initState == InitState::Pending) {
362 _backendInitFuture.waitForFinished();
364 !_backendInitFuture.isCanceled() && (_backendInitFuture.resultCount() > 0) && _backendInitFuture.result();
365 _onBackendInitComplete(success);
368 return _initState == InitState::Ready;
371void VideoManager::_onBackendInitComplete(
bool success)
373 if (_initState != InitState::Pending) {
378 _initState = InitState::Failed;
379 qCCritical(VideoManagerLog) <<
"video initialization failed";
382 if (_hasMainWindow) {
383 _createVideoReceivers();
388 _videoSettings->pruneUnavailableDecoders();
392 _initState = InitState::Ready;
393 qCDebug(VideoManagerLog) <<
"video backend ready";
394 if (_hasMainWindow) {
395 _createVideoReceivers();
401 if (_hasMainWindow) {
402 qCDebug(VideoManagerLog) <<
"Video Manager already initialized";
407 qCCritical(VideoManagerLog) <<
"Failed To Init Video Manager - mainWindow is NULL";
417 &VideoManager::_setActiveVehicle);
420 _onMainWindowReady();
423void VideoManager::_onMainWindowReady()
425 _hasMainWindow =
true;
428 if (_backendInitFinished()) {
429 _createVideoReceivers();
433void VideoManager::_createVideoReceivers()
438 for (VideoStreamController* source : std::as_const(_sources)) {
443 VideoReceiver*
const receiver = _receiverFactory(source);
445 qCDebug(VideoManagerLog) <<
"No video receiver for" << source->
name();
452void VideoManager::_restartSources()
454 for (VideoStreamController* source : std::as_const(_sources)) {
474 qCDebug(VideoManagerLog) <<
"startVideo";
476 _videoStopped =
false;
477 _disabledWhileDisarmed =
false;
484 qCDebug(VideoManagerLog) <<
"stopVideo";
486 _videoStopped =
true;
495 _recordingService->startRecording(baseName);
500 _recordingService->stopRecording();
506 const QDateTime now = QDateTime::currentDateTime();
507 QString file = imageFile;
508 if (file.isEmpty()) {
510 if (directory.isEmpty()) {
511 QGC::showAppMessage(tr(
"Unable to save the photo. The save path must be specified in Settings."));
514 file = QStringLiteral(
"%1/%2.jpg").arg(directory, now.toString(QStringLiteral(
"yyyy-MM-dd_hh.mm.ss.zzz")));
519 if (_activeVehicle) {
520 exif.
position = _activeVehicle->coordinate();
532 qCWarning(VideoManagerLog) <<
"No video on display to take a screenshot from";
539 using Sources = QQmlListProperty<VideoStreamController>;
543 [](Sources*
sources, qsizetype index) {
550 return _primaryStream->decoding();
555 return _telemetryOverlay->text();
560 return _recordingService->recording();
565 return _primaryStream->aspectRatio();
570 return _thermalStream->aspectRatio();
575 if (on && (!_hasVideo || !_activeVehicle || _activeVehicle->vehicleLinkManager()->communicationLost())) {
579 if (on != _fullScreen) {
587 if (room == _tileRoom) {
592 (void) QMetaObject::invokeMethod(
this, &VideoManager::_updateState, Qt::QueuedConnection);
597 if (!source || !source->
tile()) {
600 qCDebug(VideoManagerLog) <<
"select" << source->
name();
603 _videoSettings->uvcTileCameraAsMainPicture()->setRawValue(source == _cameraSource);
604 if (source == _cameraSource) {
609 std::find_if(_otherStreams.cbegin(), _otherStreams.cend(), [source](
const AdvertisedStream& other) {
610 return other.streamInfo && (other.streamInfo == source->streamInfo());
612 QGCCameraManager*
const cameraManager = _activeVehicle ? _activeVehicle->cameraManager() :
nullptr;
613 if ((source != _primaryStream) && (stream != _otherStreams.cend()) && stream->camera && cameraManager) {
616 const int streamIndex = camera->
streamLabels().indexOf(stream->streamInfo->name());
618 if (streamIndex >= 0) {
626void VideoManager::_updateState()
628 if (_updatingState) {
629 _updateStatePending =
true;
632 const QScopedValueRollback<bool> updating(_updatingState,
true);
634 _updateStatePending =
false;
636 }
while (_updateStatePending);
639void VideoManager::_updateStateNow()
644 if (!_videoSettings->disableWhenDisarmed()->rawValue().toBool()) {
645 _disabledWhileDisarmed =
false;
648 const QString videoSource = _videoSettings->videoSource()->rawValue().toString();
649 const bool streamWanted = !_disabledWhileDisarmed;
656 const int tilesAllowed =
657 static_cast<int>(std::min(_videoSettings->maxVideoTiles()->rawValue().toUInt(), kMaxVideoTiles));
658 const int maxTiles = (_tileRoom < 0) ? tilesAllowed : std::min(tilesAllowed, _tileRoom);
661 const QString cameraName =
663 : ((maxTiles > 0) ? _videoSettings->uvcTileCamera()->rawValue().
toString() : QString());
664 const bool cameraWanted = streamWanted && !cameraName.isEmpty();
667 _uvcCamera->watchCameras();
669 const QString camera = (cameraWanted && _cameraAttached(cameraName)) ? cameraName : QString();
673 const bool cameraOnMain =
674 isStreamSource && !camera.isEmpty() && _videoSettings->uvcTileCameraAsMainPicture()->rawValue().toBool();
675 const bool cameraTile =
isStreamSource && !camera.isEmpty() && !cameraOnMain;
678 const QGCVideoStreamInfo*
const thermalStreamInfo = _thermalStream->streamInfo();
680 const bool hasThermal = thermalStreamInfo && thermalStreamInfo->
isThermal() && !cameraOnMain;
682 _cameraSource->setCamera(camera);
683 _cameraSource->setDisplayName(camera);
684 _cameraSource->setTile(cameraTile);
685 _primaryStream->setTile(cameraOnMain);
687 _primaryStream->setDisplayName(_videoSettings->videoSource()->enumStringValue());
691 _updateTileStreams(
hasVideo ? (maxTiles - ((cameraTile || cameraOnMain) ? 1 : 0)) : 0);
693 for (VideoStreamController* source : std::as_const(_sources)) {
694 source->
setEnabled(streamWanted && !_videoStopped && ((source != _thermalStream) || !cameraOnMain));
706 qCDebug(VideoManagerLog) <<
"UVC changed from [" << _uvcVideoSourceID <<
"] to [" <<
uvcVideoSourceID <<
"]";
736 std::find_if(_tileStreams.cbegin(), _tileStreams.cend(),
737 [streamInfo](
const VideoStreamController* source) { return source->streamInfo() == streamInfo; });
738 return (streamInfo && (tile != _tileStreams.cend())) ? *tile :
nullptr;
741void VideoManager::_updateTileStreams(
int count)
744 QStringList shownAddresses;
745 for (
const VideoStreamController* source : {_primaryStream, _thermalStream}) {
747 shownAddresses.append(streamAddress(config->uri));
751 QList<VideoStreamController*> tiles;
752 for (
const AdvertisedStream& stream : std::as_const(_otherStreams)) {
753 if (tiles.size() >= count) {
758 if (!config || shownAddresses.contains(streamAddress(config->uri))) {
761 shownAddresses.append(streamAddress(config->uri));
763 VideoStreamController* tile = _tileStream(stream.streamInfo);
765 tile =
new VideoStreamController(VideoStreamController::Role::Tile, _videoSettings,
this);
766 tile->
setName(QStringLiteral(
"videoTile%1").arg(++_tileStreamSerial));
771 _connectSource(tile);
772 _recordingService->addSource(tile);
779 QList<VideoStreamController*> removed;
780 for (VideoStreamController*
const tile : std::as_const(_tileStreams)) {
781 if (!tiles.contains(tile)) {
782 removed.append(tile);
785 _tileStreams = tiles;
787 const QList<VideoStreamController*>
sources =
788 QList<VideoStreamController*>{_primaryStream, _thermalStream, _cameraSource} + _tileStreams;
792 _updateSourceSummary();
796 for (VideoStreamController*
const tile : std::as_const(removed)) {
797 qCDebug(VideoManagerLog) <<
"tile removed" << tile->
name();
802 if (_thermalStream->receiver()) {
803 _createVideoReceivers();
808void VideoManager::_nameExtraStreams()
810 QGCCameraManager*
const cameraManager = _activeVehicle ? _activeVehicle->cameraManager() :
nullptr;
811 if (!cameraManager) {
814 const QList<MavlinkCameraControlInterface*> cameras = vehicleCameras(cameraManager);
815 for (MavlinkCameraControlInterface*
const camera : cameras) {
816 QList<quint8> streamIds;
817 for (
const AdvertisedStream& stream : std::as_const(_otherStreams)) {
818 if ((stream.camera == camera) && _tileStream(stream.streamInfo)) {
819 streamIds.append(stream.streamInfo->streamID());
822 camera->setExtraStreams(streamIds);
826void VideoManager::_setActiveVehicle(
Vehicle* vehicle)
828 qCDebug(VideoManagerLog) <<
"new vehicle" << vehicle <<
"old active vehicle" << _activeVehicle;
830 if (_activeVehicle) {
831 (void) disconnect(_activeVehicle,
nullptr,
this,
nullptr);
832 (void) disconnect(_activeVehicle->vehicleLinkManager(),
nullptr,
this,
nullptr);
833 QGCCameraManager*
const cameraManager = _activeVehicle->cameraManager();
835 (void) disconnect(cameraManager,
nullptr,
this,
nullptr);
837 const QList<MavlinkCameraControlInterface*> cameras = vehicleCameras(cameraManager);
838 for (MavlinkCameraControlInterface*
const camera : cameras) {
839 camera->setExtraStreams({});
848 _activeVehicle = vehicle;
849 _disabledWhileDisarmed =
false;
851 if (_activeVehicle) {
853 &VideoManager::_communicationLostChanged);
855 QGCCameraManager*
const cameraManager = _activeVehicle->cameraManager();
871void VideoManager::_updateStreamInfo()
873 QGCCameraManager*
const cameraManager = _activeVehicle ? _activeVehicle->cameraManager() :
nullptr;
874 if (!cameraManager) {
875 _setAdvertisedStreams({},
nullptr, {});
880 QList<MavlinkCameraControlInterface*> cameras = vehicleCameras(cameraManager);
882 if (cameras.removeOne(currentCamera)) {
883 cameras.prepend(currentCamera);
886 AdvertisedStream current;
887 QList<AdvertisedStream> others;
888 for (MavlinkCameraControlInterface*
const camera : std::as_const(cameras)) {
889 QmlObjectListModel*
const streams = camera->
streams();
890 for (
int i = 0; streams && (i < streams->
count()); ++i) {
891 auto*
const streamInfo = qobject_cast<QGCVideoStreamInfo*>(streams->
get(i));
892 if (!streamInfo || streamInfo->
isThermal()) {
895 const QString name = (cameras.size() > 1)
896 ? QStringLiteral(
"%1: %2").arg(camera->
modelName(), streamInfo->
name())
897 : streamInfo->
name();
898 if (streamInfo == currentStreamInfo) {
899 current = {streamInfo, camera, name};
901 others.append({streamInfo, camera, name});
908void VideoManager::_setAdvertisedStreams(
const AdvertisedStream& current,
QGCVideoStreamInfo* thermal,
909 const QList<AdvertisedStream>& others)
914 _otherStreams = others;
916 if (VideoStreamController*
const playing = _tileStream(current.streamInfo)) {
919 VideoStreamController*
const former = _primaryStream;
920 _tileStreams.replace(_tileStreams.indexOf(playing), former);
921 _primaryStream = playing;
922 playing->setTile(former->
tile());
923 former->
setRole(VideoStreamController::Role::Tile);
924 playing->setRole(VideoStreamController::Role::Primary);
929 _primaryStream->setStreamInfo(current.streamInfo);
931 if (current.streamInfo) {
932 _primaryStream->setDisplayName(current.name);
934 _thermalStream->setStreamInfo(thermal);
938void VideoManager::_onArmedChanged(
bool armed)
940 const bool disabled = !armed && _videoSettings->disableWhenDisarmed()->rawValue().toBool();
941 if (disabled != _disabledWhileDisarmed) {
942 qCDebug(VideoManagerLog) <<
"disabled while disarmed:" << disabled;
943 _disabledWhileDisarmed = disabled;
948void VideoManager::_communicationLostChanged(
bool communicationLost)
950 if (communicationLost) {
957void VideoManager::_reconnectStreams()
959 for (VideoStreamController* source : std::as_const(_sources)) {
#define QGC_LOGGING_CATEGORY(name, categoryStr)
constexpr VideoDecoderOption videoDecoderOptionFromSetting(int value)
The option a stored forceVideoDecoder value names: the default for a value that names none.
Q_APPLICATION_STATIC(VideoManager, _videoManagerInstance)
A Fact is used to hold a single value within the system.
void rawValueChanged(const QVariant &value)
QVariant rawValue() const
Abstract base class for all camera controls: real and simulated.
virtual QStringList streamLabels() const =0
Stream names to show the user (for selection).
virtual QmlObjectListModel * streams()=0
virtual QString modelName() const =0
virtual Q_INVOKABLE void stopStream()=0
virtual Q_INVOKABLE void resumeStream()=0
virtual void setCurrentStream(int stream)=0
static MultiVehicleManager * instance()
Vehicle * activeVehicle() const
void activeVehicleChanged(Vehicle *activeVehicle)
void setCurrentCamera(int sel)
QmlObjectListModel * cameras()
MavlinkCameraControlInterface * currentCameraInstance()
QGCVideoStreamInfo * currentStreamInstance()
QGCVideoStreamInfo * thermalStreamInstance()
static QGCCorePlugin * instance()
Encapsulates the contents of a VIDEO_STREAM_INFORMATION message.
Q_INVOKABLE QObject * get(int index)
int count() const override final
int indexOf(const QObject *object)
static QMediaFormat::VideoCodec recordingCodec(const QString &key)
The codec of key key, as recordingCodecs() names it; Unspecified for an empty or unknown key.
static QMediaRecorder::Quality recordingQuality(int value)
The quality of value value, one of VideoSettings::uvcRecordingQuality's; HighQuality for any other.
Provides access to all app settings.
static SettingsManager * instance()
AppSettings * appSettings() const
void camerasChanged()
A camera was plugged in or unplugged.
void communicationLostChanged(bool communicationLost)
void armedChanged(bool armed)
virtual bool initialize(const InitParams ¶ms)
virtual void applyDecoderPriorities(VideoDecoderOption option)
static VideoBackend & instance()
virtual Capabilities capabilities() const =0
virtual EnvPrepResult prepareEnvironment()
GUI thread, before initialize().
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 neve...
virtual void onMainWindowReady(QQuickWindow *window)
virtual void setDebugLevel(int level)
bool isStreamSource() const
NoVideoReason noVideoReason() const
Q_INVOKABLE void selectSource(VideoStreamController *source)
void setTileRoom(int room)
void startVideoBackendInit()
Starts the video backend's asynchronous global init. GUI thread only, like everything else here.
Q_INVOKABLE void stopRecording()
void uvcVideoSourceIDChanged()
Q_INVOKABLE void startVideo()
Undoes stopVideo() and "disable when disarmed", and reconnects the streams.
bool autoStreamConfigured() const
void hasUvcCameraChanged()
NoVideoReason
Why a video view without a picture has none.
@ DisabledWhileDisarmed
VideoSettings::disableWhenDisarmed, until the vehicle arms.
@ Waiting
Nothing keeps the video from playing: it is awaited.
@ Stopped
stopVideo(), until startVideo().
double thermalAspectRatio() const
void isStreamSourceChanged()
static VideoManager * instance()
VideoManager(QObject *parent=nullptr)
QString uvcVideoSourceID() const
void autoStreamConfiguredChanged()
Q_INVOKABLE void startRecording(const QString &baseName=QString())
See VideoRecordingService::startRecording().
void init(QQuickWindow *mainWindow)
Q_INVOKABLE void stopVideo()
Stops the sources, and any recording, until startVideo().
void setFullScreen(bool on)
double aspectRatio() const
bool waitForVideoBackendReady()
Blocks until the backend init finishes, starting it if needed. True when the backend is ready.
void noVideoReasonChanged()
void measuredSourceChanged()
void primaryStreamChanged()
QQmlListProperty< VideoStreamController > sources()
void recordingChanged(bool recording)
void aspectRatioChanged()
void telemetryOverlayTextChanged()
QString telemetryOverlayText() const
bool hasUvcCamera() const
Q_INVOKABLE void grabImage(const QString &imageFile=QString())
void recordingChanged(bool recording)
@ VideoBackendQtMultimedia
void setDisplaySuspended(bool suspended)
QGCVideoStreamInfo * streamInfo() const
void setDisplayName(const QString &displayName)
void restart()
Reconnects now and rebuilds the receiver's display sink, so construct-only sink settings apply.
VideoReceiver * receiver() const
QString taggedFile(const QString &file) const
file for this source: the thermal stream's name goes before the extension, "<base>....
bool takeScreenshot(const QString &file, const VideoScreenshot::Exif &exif={}) const
void setReceiver(VideoReceiver *receiver)
void setEnabled(bool enabled)
The stream plays while it is enabled and configured().
void setRecordingEncoding(const VideoReceiver::RecordingEncoding &encoding)
VideoReceiver::setRecordingEncoding(), for the receiver and for each one set later.
void reconnectNow()
VideoReceiver::reconnectNow(): the stream's source is likely back, so a reconnect doesn't wait out it...
void aspectRatioChanged()
void setName(const QString &name)
Names a source that has no receiver yet.
VideoStreamStats stats() const
The receiver's VideoReceiver::stats(); invalid without a receiver.
void setRole(Role role)
Makes a stream in a tile the primary stream, or the reverse. What the source plays stays.
void setStreamInfo(QGCVideoStreamInfo *streamInfo)
The stream the camera advertises for this role, which takes precedence over the manual settings.
void stop()
Disables the stream and stops the receiver now.
void errorOccurred(const QString &message)
bool canTakeScreenshot() const
True while the stream is streaming into a registered output.
void setBackgroundWork(BackgroundWork work, bool active)
constexpr const char * toString(HwVideoBufferPath path) noexcept
void showAppMessage(const QString &message, const QString &title)
Modal application message. Queued if the UI isn't ready yet.
bool deviceExists(const QString &description)
Settings snapshot(VideoSettings *videoSettings)
bool isNetworkSource(const QString &videoSource)
True for the manual sources that are network streams (not "disabled", not a local camera).
bool isAutoStream(const QGCVideoStreamInfo *streamInfo)
True when streamInfo advertises a URI, which then takes precedence over the manual settings.
std::optional< VideoReceiver::Config > resolve(const Settings &settings, const QGCVideoStreamInfo *streamInfo, Role role)
constexpr bool listens(Transport transport)
The receiver listens on a local UDP port for transport, rather than connect to a server.
std::optional< Transport > transportFor(const QUrl &url)
The transport url's scheme selects, case-insensitively; nullopt for any other scheme.
QCamera::WhiteBalanceMode whiteBalance
QCamera::FocusMode focusMode
float exposureCompensation
bool asyncInit
initialize() must run, off the GUI thread, before receivers are created.
bool degraded(double cameraFps) const
bool valid
Measured at least once for the current stream; the other fields mean nothing while false.