#include <VideoManager.h>
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 |
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.
|
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.
|
explicit |
Definition at line 85 of file VideoManager.cc.
References QGCCorePlugin::instance(), instance(), and VideoSettings::VideoBackendQtMultimedia.
Referenced by instance(), sources(), and VideoManagerVehicleTest.
|
override |
Definition at line 135 of file VideoManager.cc.
| double VideoManager::aspectRatio | ( | ) | const |
Definition at line 563 of file VideoManager.cc.
|
signal |
|
inline |
Definition at line 139 of file VideoManager.h.
|
signal |
| 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().
| bool VideoManager::decoding | ( | ) | const |
Definition at line 548 of file VideoManager.cc.
Referenced by SimulatedCameraControl::hasVideoStream().
|
signal |
Referenced by SimulatedCameraControl::SimulatedCameraControl().
|
inline |
Definition at line 143 of file VideoManager.h.
|
signal |
|
inline |
Definition at line 145 of file VideoManager.h.
|
signal |
Referenced by setFullScreen().
| 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().
|
inline |
Definition at line 147 of file VideoManager.h.
|
signal |
|
inline |
Definition at line 149 of file VideoManager.h.
|
signal |
|
inline |
Definition at line 151 of file VideoManager.h.
Referenced by SimulatedCameraControl::capturesVideo().
|
signal |
Referenced by SimulatedCameraControl::SimulatedCameraControl().
| void VideoManager::init | ( | QQuickWindow * | mainWindow | ) |
Definition at line 399 of file VideoManager.cc.
References MultiVehicleManager::activeVehicle(), MultiVehicleManager::activeVehicleChanged(), MultiVehicleManager::instance(), SettingsManager::instance(), VideoBackend::instance(), VideoBackend::onMainWindowReady(), Fact::rawValueChanged(), and VideoBackend::setDebugLevel().
|
static |
Definition at line 140 of file VideoManager.cc.
References VideoManager().
Referenced by VehicleCameraControl::_initWhenReady(), SimulatedCameraControl::capturesVideo(), SimulatedCameraControl::captureVideoState(), VehicleCameraControl::captureVideoState(), SimulatedCameraControl::hasVideoStream(), QGCApplication::shutdown(), SimulatedCameraControl::SimulatedCameraControl(), SimulatedCameraControl::startVideoRecording(), VehicleCameraControl::startVideoRecording(), SimulatedCameraControl::stopVideoRecording(), VehicleCameraControl::stopVideoRecording(), VehicleCameraControl::takePhoto(), VideoManager(), and VideoManagerVehicleTest.
|
inline |
Definition at line 153 of file VideoManager.h.
|
signal |
|
inline |
Definition at line 155 of file VideoManager.h.
|
signal |
|
inline |
Definition at line 157 of file VideoManager.h.
|
signal |
|
inline |
Definition at line 159 of file VideoManager.h.
|
signal |
|
inline |
Definition at line 133 of file VideoManager.h.
|
signal |
| bool VideoManager::recording | ( | ) | const |
Definition at line 558 of file VideoManager.cc.
Referenced by recordingChanged().
|
signal |
References recording().
Referenced by VehicleCameraControl::_initWhenReady(), and SimulatedCameraControl::SimulatedCameraControl().
| 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().
| void VideoManager::setFullScreen | ( | bool | on | ) |
Definition at line 573 of file VideoManager.cc.
References fullScreenChanged().
| 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().
| QQmlListProperty< VideoStreamController > VideoManager::sources | ( | ) |
Definition at line 537 of file VideoManager.cc.
References sources(), and VideoManager().
Referenced by sources().
|
signal |
| void VideoManager::startRecording | ( | const QString & | baseName = QString() | ) |
See VideoRecordingService::startRecording().
Definition at line 493 of file VideoManager.cc.
Referenced by SimulatedCameraControl::startVideoRecording(), and VehicleCameraControl::startVideoRecording().
| void VideoManager::startVideo | ( | ) |
Undoes stopVideo() and "disable when disarmed", and reconnects the streams.
Definition at line 472 of file VideoManager.cc.
| void VideoManager::startVideoBackendInit | ( | ) |
Starts the video backend's asynchronous global init. GUI thread only, like everything else here.
Definition at line 328 of file VideoManager.cc.
References VideoBackend::Capabilities::asyncInit, VideoBackend::capabilities(), VideoBackend::disabledForUnitTests(), VideoBackend::initialize(), VideoBackend::instance(), VideoBackend::persistedDebugLevel(), and VideoBackend::prepareEnvironment().
Referenced by waitForVideoBackendReady().
| void VideoManager::stopRecording | ( | ) |
Definition at line 498 of file VideoManager.cc.
Referenced by SimulatedCameraControl::stopVideoRecording(), and VehicleCameraControl::stopVideoRecording().
| void VideoManager::stopVideo | ( | ) |
Stops the sources, and any recording, until startVideo().
Definition at line 482 of file VideoManager.cc.
References VideoStreamController::stop().
| QString VideoManager::telemetryOverlayText | ( | ) | const |
Definition at line 553 of file VideoManager.cc.
|
signal |
| double VideoManager::thermalAspectRatio | ( | ) | const |
Definition at line 568 of file VideoManager.cc.
|
inline |
Definition at line 135 of file VideoManager.h.
|
inline |
Definition at line 163 of file VideoManager.h.
|
signal |
|
inline |
Definition at line 165 of file VideoManager.h.
|
signal |
Referenced by setTileRoom().
|
inline |
Definition at line 137 of file VideoManager.h.
|
inline |
Definition at line 170 of file VideoManager.h.
|
signal |
References Pending.
| 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().
|
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.
|
friend |
Definition at line 85 of file VideoManager.h.
References VideoManagerInitTest.
Referenced by VideoManagerInitTest.
|
friend |
Definition at line 86 of file VideoManager.h.
References VideoManagerTest.
Referenced by VideoManagerTest.
|
friend |
Definition at line 87 of file VideoManager.h.
References instance(), VideoManager(), and VideoManagerVehicleTest.
Referenced by VideoManagerVehicleTest.