#include <QtMultimediaVideoReceiver.h>
Classes | |
| struct | Source |
| What QMediaPlayer plays for a stream URI: a URL, or for RTP over UDP an SDP description of it. More... | |
Public Member Functions | |
| QtMultimediaVideoReceiver (QObject *parent=nullptr) | |
| ~QtMultimediaVideoReceiver () override | |
| bool | encodesRecordings () const override |
| Public Member Functions inherited from VideoReceiver | |
| VideoReceiver (QObject *parent=nullptr) | |
| ~VideoReceiver () override | |
| QString | name () const |
| void | setName (const QString &name) |
| Names the stream in logs and pipeline dumps. Call once, before the first setActive(true). | |
| const Config & | config () const |
| const DisplayConfig & | displayConfig () const |
| bool | active () const |
| QQuickItem * | videoOutput () const |
| State | state () const |
| bool | streaming () const |
| bool | decoding () const |
| bool | recording () const |
| QSize | videoSize () const |
| The size of the frames as they are presented, before the orientation the VideoOutput adds. | |
| VideoStreamStats | stats () const |
| The stream's health, measured about once a second while it streams; invalid while it doesn't. | |
| void | setConfig (const Config &config) |
| void | setDisplayConfig (const DisplayConfig &config) |
Stores config for the display sink restart() builds next. | |
| const RecordingEncoding & | recordingEncoding () const |
| void | setRecordingEncoding (const RecordingEncoding &encoding) |
Stores encoding for the recordings that start from now on; one in progress keeps its own. | |
| void | setActive (bool active) |
| Streams while true and the URI is set. False stops the stream, any pending reconnect and any recording. | |
| virtual void | shutDown () |
| void | restart () |
| void | reconnectNow () |
| void | setVideoOutput (QQuickItem *videoOutput) |
| void | startRecording (const QString &file, FileFormat format) |
| void | stopRecording () |
| bool | takeScreenshot (const QString &file, const VideoScreenshot::Exif &exif={}) |
Static Public Member Functions | |
| static std::optional< Source > | playerSource (const QString &uri) |
| Static Public Member Functions inherited from VideoReceiver | |
| static QString | fileExtension (FileFormat format) |
| "mkv", "mov" or "mp4". | |
| static QString | recordingComment () |
| The comment recordings carry, of GStreamer and of a USB camera alike: the application and its version. | |
| static bool | isValidFileFormat (int format) |
| static QSize | presentedSize (const QVideoFrame &frame, QSize pictureSize={}) |
Protected Member Functions | |
| void | onConfigChanged () override |
| void | onActiveChanged () override |
| void | onRestartRequested () override |
| void | onReconnectRequested () override |
| void | onVideoOutputChanged () override |
| Also called when the current output is set again. | |
| void | onStartRecording (const QString &file, FileFormat format) override |
| void | onStopRecording () override |
| Protected Member Functions inherited from VideoReceiver | |
| virtual bool | onTakeScreenshot (const QString &file, const VideoScreenshot::Exif &exif) |
| takeScreenshot() with an output set: saves the frame on display, unless overridden. | |
| QVideoSink * | videoSink () const |
| The VideoOutput's QVideoSink, or nullptr. | |
| void | setState (State state) |
| void | setDecoding (bool decoding) |
| void | setRecording (bool recording) |
| void | setVideoSize (QSize size) |
| void | setStats (const VideoStreamStats &stats) |
| Backends publish a new measurement, and an invalid one once the stream stops or reconnects. | |
Friends | |
| class | QtMultimediaVideoReceiverTest |
Additional Inherited Members | |
| Public Types inherited from VideoReceiver | |
| enum class | State : uint8_t { Stopped , Connecting , Streaming , Reconnecting } |
| enum class | FileFormat : uint8_t { Mkv = 0 , Mov = 1 , Mp4 = 2 } |
| Values are persisted by VideoSettings::recordingFormat. More... | |
| Signals inherited from VideoReceiver | |
| void | stateChanged (VideoReceiver::State state) |
| void | streamingChanged (bool streaming) |
| void | decodingChanged (bool decoding) |
| void | recordingChanged (bool recording) |
| void | recordingStarted (const QString &file) |
| A recording file opened: the first one after startRecording(), or the recording's next part. | |
| void | recordingFinished (const QString &file, const QString &error) |
A recording file closed. error is empty when the file was finalized cleanly. | |
| void | videoSizeChanged (QSize size) |
| void | statsChanged (const VideoStreamStats &stats) |
| void | errorOccurred (const QString &message) |
A network video stream played by Qt Multimedia's QMediaPlayer (FFmpeg): the receiver of builds without GStreamer, and of VideoSettings::videoBackend's Qt Multimedia choice. Plays RTSP, MPEG-TS over UDP or TCP, and H.264 or H.265 RTP over UDP with payload type 96, which an SDP description tells FFmpeg about. Records by encoding the frames it displays anew (QtVideoRecorder), as recordingEncoding() says: only while an output displays the stream, and after a reconnect in the same file.
Streaming once the first frame arrives; decoding while frames reach the output. A stream that errors, ends, or shows no frame for the config's timeout while displaying (5 s more for the first, while FFmpeg probes the stream) has failed: its StreamSupervisor reconnects it after 1 s, doubling up to 30 s, while autoReconnect is on, and it stops with errorOccurred() otherwise. A UDP port nobody sends to yet hasn't failed: once FFmpeg gives up on it, the receiver listens again at once, for as long as it takes.
Definition at line 30 of file QtMultimediaVideoReceiver.h.
|
explicit |
Definition at line 79 of file QtMultimediaVideoReceiver.cc.
References QtVideoRecorder::recordingChanged(), QtVideoRecorder::recordingFinished(), VideoReceiver::recordingFinished(), QtVideoRecorder::recordingStarted(), VideoReceiver::recordingStarted(), VideoReceiver::setRecording(), VideoReceiver::setState(), VideoReceiver::state(), StreamSupervisor::stateChanged(), and VideoReceiver::VideoReceiver().
|
override |
Definition at line 103 of file QtMultimediaVideoReceiver.cc.
|
inlineoverridevirtual |
True for a receiver that encodes its recordings anew, as recordingEncoding() says: a USB camera, or Qt Multimedia's player. False for one that records the stream as it arrives.
Reimplemented from VideoReceiver.
Definition at line 56 of file QtMultimediaVideoReceiver.h.
|
overrideprotectedvirtual |
Implements VideoReceiver.
Definition at line 160 of file QtMultimediaVideoReceiver.cc.
References VideoReceiver::active().
|
overrideprotectedvirtual |
Implements VideoReceiver.
Definition at line 146 of file QtMultimediaVideoReceiver.cc.
References VideoReceiver::Config::autoReconnect, and VideoReceiver::config().
|
overrideprotectedvirtual |
Implements VideoReceiver.
Definition at line 173 of file QtMultimediaVideoReceiver.cc.
|
overrideprotectedvirtual |
Implements VideoReceiver.
Definition at line 168 of file QtMultimediaVideoReceiver.cc.
|
overrideprotectedvirtual |
Implements VideoReceiver.
Definition at line 196 of file QtMultimediaVideoReceiver.cc.
References QtVideoRecorder::container(), VideoReceiver::name(), and VideoReceiver::recordingEncoding().
|
overrideprotectedvirtual |
Implements VideoReceiver.
Definition at line 212 of file QtMultimediaVideoReceiver.cc.
|
overrideprotectedvirtual |
Also called when the current output is set again.
Implements VideoReceiver.
Definition at line 184 of file QtMultimediaVideoReceiver.cc.
References VideoReceiver::videoSink().
|
static |
The source for uri, one of VideoStreamResolver's: rtsp(s):// and tcp:// as they are, rtspt:// as rtsp:// over TCP, as GStreamer plays it, mpegts:// as udp://, and udp:// (H.264) or udp265:// (H.265) RTP as an SDP description. Other URLs play as they are; nullopt for an invalid one.
Definition at line 115 of file QtMultimediaVideoReceiver.cc.
References VideoStreamUri::transportFor().
|
friend |
Definition at line 34 of file QtMultimediaVideoReceiver.h.
References QtMultimediaVideoReceiverTest.
Referenced by QtMultimediaVideoReceiverTest.