QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VideoManager Class Reference

#include <VideoManager.h>

Inheritance diagram for VideoManager:
Collaboration diagram for VideoManager:

Public Types

enum class  NoVideoReason : uint8_t { Waiting , Stopped , DisabledWhileDisarmed }
 Why a video view without a picture has none. More...

Signals

void sourcesChanged ()
void primaryStreamChanged ()
void aspectRatioChanged ()
void autoStreamConfiguredChanged ()
void decodingChanged ()
void degradedChanged ()
void fullScreenChanged ()
void hasThermalChanged ()
void hasUvcCameraChanged ()
void hasVideoChanged ()
void isStreamSourceChanged ()
void isUvcChanged ()
void measuredSourceChanged ()
void noVideoReasonChanged ()
void recordingChanged (bool recording)
void telemetryOverlayTextChanged ()
void tileCountChanged ()
void tileRoomChanged ()
void uvcVideoSourceIDChanged ()

Public Member Functions

 VideoManager (QObject *parent=nullptr)
 ~VideoManager () override
Q_INVOKABLE void grabImage (const QString &imageFile=QString())
Q_INVOKABLE void startRecording (const QString &baseName=QString())
 See VideoRecordingService::startRecording().
Q_INVOKABLE void startVideo ()
 Undoes stopVideo() and "disable when disarmed", and reconnects the streams.
Q_INVOKABLE void stopRecording ()
Q_INVOKABLE void stopVideo ()
 Stops the sources, and any recording, until startVideo().
Q_INVOKABLE void selectSource (VideoStreamController *source)
void init (QQuickWindow *mainWindow)
void startVideoBackendInit ()
 Starts the video backend's asynchronous global init. GUI thread only, like everything else here.
bool waitForVideoBackendReady ()
 Blocks until the backend init finishes, starting it if needed. True when the backend is ready.
void cleanup ()
QQmlListProperty< VideoStreamController > sources ()
VideoStreamController * primaryStream () const
VideoStreamController * thermalStream () const
UVCCameraController * uvcCamera () const
bool autoStreamConfigured () const
bool decoding () const
bool degraded () const
bool fullScreen () const
bool hasThermal () const
bool hasUvcCamera () const
bool hasVideo () const
bool isStreamSource () const
bool isUvc () const
VideoStreamController * measuredSource () const
NoVideoReason noVideoReason () const
bool recording () const
int tileCount () const
int tileRoom () const
double aspectRatio () const
double thermalAspectRatio () const
QString uvcVideoSourceID () const
QString telemetryOverlayText () const
void setFullScreen (bool on)
void setTileRoom (int room)

Static Public Member Functions

static VideoManager * instance ()

Friends

class TopLevelViewsTest
 The source of the vehicle's current stream, or of the stream the settings configure. Never null.
class VideoManagerInitTest
class VideoManagerTest
class VideoManagerVehicleTest

Detailed Description

QML facade of the video sources, each a VideoStreamController: the primary stream, the thermal stream, the USB camera, whose receiver is uvcCamera, and the streams shown in tiles. One of the primary stream and the camera is the main picture: the camera while the video source setting names one and no vehicle camera advertises a stream. decoding and aspectRatio forward to the primary stream, thermalAspectRatio to the thermal stream, and recording covers the main picture and the thermal stream. The other properties, such as hasVideo and isUvc, are the manager's own state.

The tiles show what else there is to see, up to VideoSettings::maxVideoTiles of them, and no more than the row of tiles has room for (tileRoom): the USB camera VideoSettings::uvcTileCamera names, while a stream is the video source, then the other streams of the active vehicle's current camera, then its other cameras' streams. Each stream in a tile has a source of its own, which plays that stream for as long as it is shown. When the vehicle's current stream becomes one that plays in a tile, that source becomes the primary stream and the former one takes a tile: neither stream restarts. The camera selected in its tile (selectSource()) is the main picture as well, with the primary stream in a tile, until a stream is selected.

Definition at line 39 of file VideoManager.h.

Member Enumeration Documentation

◆ NoVideoReason

enum class VideoManager::NoVideoReason : uint8_t
strong

Why a video view without a picture has none.

Enumerator
Waiting 

Nothing keeps the video from playing: it is awaited.

Stopped 

stopVideo(), until startVideo().

DisabledWhileDisarmed 

VideoSettings::disableWhenDisarmed, until the vehicle arms.

Definition at line 96 of file VideoManager.h.

Constructor & Destructor Documentation

◆ VideoManager()

VideoManager::VideoManager ( QObject * parent = nullptr)
explicit

◆ ~VideoManager()

VideoManager::~VideoManager ( )
override

Definition at line 135 of file VideoManager.cc.

Member Function Documentation

◆ aspectRatio()

double VideoManager::aspectRatio ( ) const

Definition at line 563 of file VideoManager.cc.

◆ aspectRatioChanged

void VideoManager::aspectRatioChanged ( )
signal

◆ autoStreamConfigured()

bool VideoManager::autoStreamConfigured ( ) const
inline

Definition at line 139 of file VideoManager.h.

◆ autoStreamConfiguredChanged

void VideoManager::autoStreamConfiguredChanged ( )
signal

◆ cleanup()

void VideoManager::cleanup ( )

Shuts the sources down, for good: deletes the streams' receivers and stops the USB camera, and nothing starts again afterwards. Call before the QML engine and the application go away.

Definition at line 459 of file VideoManager.cc.

References VideoStreamController::shutDown().

Referenced by QGCApplication::shutdown().

◆ decoding()

bool VideoManager::decoding ( ) const

Definition at line 548 of file VideoManager.cc.

Referenced by SimulatedCameraControl::hasVideoStream().

◆ decodingChanged

void VideoManager::decodingChanged ( )
signal

◆ degraded()

bool VideoManager::degraded ( ) const
inline

Definition at line 143 of file VideoManager.h.

◆ degradedChanged

void VideoManager::degradedChanged ( )
signal

◆ fullScreen()

bool VideoManager::fullScreen ( ) const
inline

Definition at line 145 of file VideoManager.h.

◆ fullScreenChanged

void VideoManager::fullScreenChanged ( )
signal

Referenced by setFullScreen().

◆ grabImage()

void VideoManager::grabImage ( const QString & imageFile = QString())

Saves the frame on display, or the USB camera's photo, to imageFile (default: a timestamped file in the photo directory), and the thermal stream's frame, when it is streaming, to the same name tagged ".thermalVideo". The files are written off the GUI thread; the user is told when there is no video to save, or a file can't be written.

Definition at line 503 of file VideoManager.cc.

References SettingsManager::appSettings(), VideoStreamController::canTakeScreenshot(), SettingsManager::instance(), AppSettings::photoSavePath(), VideoScreenshot::Exif::position, QGC::showAppMessage(), VideoStreamController::taggedFile(), VideoScreenshot::Exif::taken, VideoStreamController::takeScreenshot(), and VideoStreamController::tile().

Referenced by VehicleCameraControl::takePhoto().

◆ hasThermal()

bool VideoManager::hasThermal ( ) const
inline

Definition at line 147 of file VideoManager.h.

◆ hasThermalChanged

void VideoManager::hasThermalChanged ( )
signal

◆ hasUvcCamera()

bool VideoManager::hasUvcCamera ( ) const
inline

Definition at line 149 of file VideoManager.h.

◆ hasUvcCameraChanged

void VideoManager::hasUvcCameraChanged ( )
signal

◆ hasVideo()

bool VideoManager::hasVideo ( ) const
inline

Definition at line 151 of file VideoManager.h.

Referenced by SimulatedCameraControl::capturesVideo().

◆ hasVideoChanged

void VideoManager::hasVideoChanged ( )
signal

◆ init()

◆ instance()

◆ isStreamSource()

bool VideoManager::isStreamSource ( ) const
inline

Definition at line 153 of file VideoManager.h.

◆ isStreamSourceChanged

void VideoManager::isStreamSourceChanged ( )
signal

◆ isUvc()

bool VideoManager::isUvc ( ) const
inline

Definition at line 155 of file VideoManager.h.

◆ isUvcChanged

void VideoManager::isUvcChanged ( )
signal

◆ measuredSource()

VideoStreamController * VideoManager::measuredSource ( ) const
inline

Definition at line 157 of file VideoManager.h.

◆ measuredSourceChanged

void VideoManager::measuredSourceChanged ( )
signal

◆ noVideoReason()

NoVideoReason VideoManager::noVideoReason ( ) const
inline

Definition at line 159 of file VideoManager.h.

◆ noVideoReasonChanged

void VideoManager::noVideoReasonChanged ( )
signal

◆ primaryStream()

VideoStreamController * VideoManager::primaryStream ( ) const
inline

Definition at line 133 of file VideoManager.h.

◆ primaryStreamChanged

void VideoManager::primaryStreamChanged ( )
signal

◆ recording()

bool VideoManager::recording ( ) const

Definition at line 558 of file VideoManager.cc.

Referenced by recordingChanged().

◆ recordingChanged

void VideoManager::recordingChanged ( bool recording)
signal

◆ selectSource()

void VideoManager::selectSource ( VideoStreamController * source)

Makes source, one shown in a tile, the main picture. A stream of a vehicle's camera becomes that camera's current stream, and its camera the current camera, as the camera panel selects them. The USB camera takes the main picture from the stream, which takes its tile, until a stream is selected again or another camera is chosen for the tile: VideoSettings::uvcTileCameraAsMainPicture stores it.

Definition at line 595 of file VideoManager.cc.

References QGCCameraManager::cameras(), QmlObjectListModel::indexOf(), VideoStreamController::name(), QGCCameraManager::setCurrentCamera(), MavlinkCameraControlInterface::setCurrentStream(), MavlinkCameraControlInterface::streamLabels(), and VideoStreamController::tile().

◆ setFullScreen()

void VideoManager::setFullScreen ( bool on)

Definition at line 573 of file VideoManager.cc.

References fullScreenChanged().

◆ setTileRoom()

void VideoManager::setTileRoom ( int room)

The sources follow on the next pass of the event loop, with the room there is then: a view on its way from the picture-in-picture to its full size tells of the room it has on the way, which mustn't stop the tiles' streams.

Definition at line 585 of file VideoManager.cc.

References tileRoomChanged().

◆ sources()

QQmlListProperty< VideoStreamController > VideoManager::sources ( )

Definition at line 537 of file VideoManager.cc.

References sources(), and VideoManager().

Referenced by sources().

◆ sourcesChanged

void VideoManager::sourcesChanged ( )
signal

◆ startRecording()

void VideoManager::startRecording ( const QString & baseName = QString())

◆ startVideo()

void VideoManager::startVideo ( )

Undoes stopVideo() and "disable when disarmed", and reconnects the streams.

Definition at line 472 of file VideoManager.cc.

◆ startVideoBackendInit()

void VideoManager::startVideoBackendInit ( )

◆ stopRecording()

void VideoManager::stopRecording ( )

◆ stopVideo()

void VideoManager::stopVideo ( )

Stops the sources, and any recording, until startVideo().

Definition at line 482 of file VideoManager.cc.

References VideoStreamController::stop().

◆ telemetryOverlayText()

QString VideoManager::telemetryOverlayText ( ) const

Definition at line 553 of file VideoManager.cc.

◆ telemetryOverlayTextChanged

void VideoManager::telemetryOverlayTextChanged ( )
signal

◆ thermalAspectRatio()

double VideoManager::thermalAspectRatio ( ) const

Definition at line 568 of file VideoManager.cc.

◆ thermalStream()

VideoStreamController * VideoManager::thermalStream ( ) const
inline

Definition at line 135 of file VideoManager.h.

◆ tileCount()

int VideoManager::tileCount ( ) const
inline

Definition at line 163 of file VideoManager.h.

◆ tileCountChanged

void VideoManager::tileCountChanged ( )
signal

◆ tileRoom()

int VideoManager::tileRoom ( ) const
inline

Definition at line 165 of file VideoManager.h.

◆ tileRoomChanged

void VideoManager::tileRoomChanged ( )
signal

Referenced by setTileRoom().

◆ uvcCamera()

UVCCameraController * VideoManager::uvcCamera ( ) const
inline

Definition at line 137 of file VideoManager.h.

◆ uvcVideoSourceID()

QString VideoManager::uvcVideoSourceID ( ) const
inline

Definition at line 170 of file VideoManager.h.

◆ uvcVideoSourceIDChanged

void VideoManager::uvcVideoSourceIDChanged ( )
signal

References Pending.

◆ waitForVideoBackendReady()

bool VideoManager::waitForVideoBackendReady ( )

Blocks until the backend init finishes, starting it if needed. True when the backend is ready.

Definition at line 355 of file VideoManager.cc.

References startVideoBackendInit().

◆ TopLevelViewsTest

friend class TopLevelViewsTest
friend

The source of the vehicle's current stream, or of the stream the settings configure. Never null.

Every source, for what treats them alike: the primary stream, the thermal stream, the USB camera, then the streams in tiles, in the tiles' order. A source falls short (VideoStreamStats::degraded()) of the frame rate its camera is set up for: the one a stream's camera advertises, while the stream is decoded, or the USB camera's own. A USB camera plays, as the main picture (isUvc) or in a tile. The source whose figures stand for the video's: the first one that is measured, those of the main picture before those in tiles, which puts the primary stream before the thermal stream; the USB camera runs in the primary stream's place. The primary stream while none is measured. Never null. How many sources are shown in tiles. How many tiles the row of tiles has room for, which it tells while it is shown: no more sources than that play in tiles, whatever VideoSettings::maxVideoTiles allows. -1 until a row tells. The telemetry VideoView shows over the primary stream or the USB camera: empty while VideoSettings::showTelemetryOverlay is off.

Definition at line 84 of file VideoManager.h.

References TopLevelViewsTest.

Referenced by TopLevelViewsTest.

◆ VideoManagerInitTest

friend class VideoManagerInitTest
friend

Definition at line 85 of file VideoManager.h.

References VideoManagerInitTest.

Referenced by VideoManagerInitTest.

◆ VideoManagerTest

friend class VideoManagerTest
friend

Definition at line 86 of file VideoManager.h.

References VideoManagerTest.

Referenced by VideoManagerTest.

◆ VideoManagerVehicleTest

friend class VideoManagerVehicleTest
friend

Definition at line 87 of file VideoManager.h.

References instance(), VideoManager(), and VideoManagerVehicleTest.

Referenced by VideoManagerVehicleTest.


The documentation for this class was generated from the following files: