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

What a receiver was asked to record, across the sessions reconnects start and the hours it runs for. More...

#include <RecordingPlan.h>

Public Types

using Clock = std::chrono::steady_clock

Public Member Functions

 RecordingPlan (const QString &file, VideoReceiver::FileFormat format, std::chrono::milliseconds maxPartDuration=kMaxPartDuration)
VideoReceiver::FileFormat format () const
int part () const
QString currentFile () const
 The file the current part records to.
bool opened () const
 The current part got a frame.
bool onFileOpened (const QString &file, Clock::time_point now=Clock::now())
 file got its first frame at now. False, changing nothing, unless it is the current part's file.
void onFileClosed (const QString &file)
 file is closed. Counts for the one that opened last only: a file of an earlier recording can close late.
bool partDue (Clock::time_point now=Clock::now()) const
 The current part has recorded for its maximum duration by now.
void nextPart ()
qint64 recordingMs (Clock::time_point now=Clock::now()) const
 For VideoStreamStats::recordingMs: since the first part got its first frame; -1 before.
qint64 bytesWritten () const
 For VideoStreamStats::recordingBytes: what the parts' files held when they closed, and the open one holds now.

Static Public Member Functions

static QString insertBeforeExtension (const QString &file, const QString &tag)
 "<base><tag>.<ext>" for file "<base>.<ext>", and "<file><tag>" for one without an extension.
static QString partFile (const QString &file, int part)
 "<base>_part<part>.<ext>" for file "<base>.<ext>"; file itself for part 1.

Static Public Attributes

static constexpr std::chrono::minutes kMaxPartDuration {60}

Detailed Description

What a receiver was asked to record, across the sessions reconnects start and the hours it runs for.

Owns VideoReceiver::startRecording()'s file contract for a receiver that records the stream as it arrives: it starts in the file asked for and continues in "<base>_part<N>.<ext>", N counting from 2, after each session that got frames and whenever a part has recorded for kMaxPartDuration. A receiver that encodes the frames anew keeps one part. Also tells the recording's time and size for VideoStreamStats.

Definition at line 16 of file RecordingPlan.h.

Member Typedef Documentation

◆ Clock

using RecordingPlan::Clock = std::chrono::steady_clock

Definition at line 19 of file RecordingPlan.h.

Constructor & Destructor Documentation

◆ RecordingPlan()

RecordingPlan::RecordingPlan ( const QString & file,
VideoReceiver::FileFormat format,
std::chrono::milliseconds maxPartDuration = kMaxPartDuration )

Definition at line 7 of file RecordingPlan.cc.

References format().

Member Function Documentation

◆ bytesWritten()

qint64 RecordingPlan::bytesWritten ( ) const

For VideoStreamStats::recordingBytes: what the parts' files held when they closed, and the open one holds now.

Definition at line 66 of file RecordingPlan.cc.

Referenced by VideoStreamStatsSampler::sample().

◆ currentFile()

QString RecordingPlan::currentFile ( ) const
inline

The file the current part records to.

Definition at line 38 of file RecordingPlan.h.

References partFile().

Referenced by onFileOpened().

◆ format()

VideoReceiver::FileFormat RecordingPlan::format ( ) const
inline

Definition at line 33 of file RecordingPlan.h.

Referenced by RecordingPlan().

◆ insertBeforeExtension()

QString RecordingPlan::insertBeforeExtension ( const QString & file,
const QString & tag )
static

"<base><tag>.<ext>" for file "<base>.<ext>", and "<file><tag>" for one without an extension.

Definition at line 14 of file RecordingPlan.cc.

Referenced by partFile(), and VideoStreamController::taggedFile().

◆ nextPart()

void RecordingPlan::nextPart ( )

What is recorded next goes to the next part, if the current one got frames: after partDue(), and once the session ended.

Definition at line 53 of file RecordingPlan.cc.

◆ onFileClosed()

void RecordingPlan::onFileClosed ( const QString & file)

file is closed. Counts for the one that opened last only: a file of an earlier recording can close late.

Definition at line 40 of file RecordingPlan.cc.

◆ onFileOpened()

bool RecordingPlan::onFileOpened ( const QString & file,
Clock::time_point now = Clock::now() )

file got its first frame at now. False, changing nothing, unless it is the current part's file.

Definition at line 26 of file RecordingPlan.cc.

References currentFile().

◆ opened()

bool RecordingPlan::opened ( ) const
inline

The current part got a frame.

Definition at line 41 of file RecordingPlan.h.

◆ part()

int RecordingPlan::part ( ) const
inline

Definition at line 35 of file RecordingPlan.h.

Referenced by partFile().

◆ partDue()

bool RecordingPlan::partDue ( Clock::time_point now = Clock::now()) const

The current part has recorded for its maximum duration by now.

Definition at line 48 of file RecordingPlan.cc.

◆ partFile()

QString RecordingPlan::partFile ( const QString & file,
int part )
static

"<base>_part<part>.<ext>" for file "<base>.<ext>"; file itself for part 1.

Definition at line 21 of file RecordingPlan.cc.

References insertBeforeExtension(), and part().

Referenced by currentFile().

◆ recordingMs()

qint64 RecordingPlan::recordingMs ( Clock::time_point now = Clock::now()) const

For VideoStreamStats::recordingMs: since the first part got its first frame; -1 before.

Definition at line 61 of file RecordingPlan.cc.

Referenced by VideoStreamStatsSampler::sample().

Member Data Documentation

◆ kMaxPartDuration

std::chrono::minutes RecordingPlan::kMaxPartDuration {60}
staticconstexpr

How long a part records before the next one takes over. It bounds what a file holds, for the storage limit to remove a long recording's oldest parts, and what an MP4 or MOV muxer must reserve header space for.

Definition at line 23 of file RecordingPlan.h.


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