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} |
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.
| using RecordingPlan::Clock = std::chrono::steady_clock |
Definition at line 19 of file RecordingPlan.h.
| RecordingPlan::RecordingPlan | ( | const QString & | file, |
| VideoReceiver::FileFormat | format, | ||
| std::chrono::milliseconds | maxPartDuration = kMaxPartDuration ) |
Definition at line 7 of file RecordingPlan.cc.
References format().
| 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().
|
inline |
The file the current part records to.
Definition at line 38 of file RecordingPlan.h.
References partFile().
Referenced by onFileOpened().
|
inline |
Definition at line 33 of file RecordingPlan.h.
Referenced by RecordingPlan().
|
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().
| 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.
| 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.
| 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().
|
inline |
The current part got a frame.
Definition at line 41 of file RecordingPlan.h.
|
inline |
Definition at line 35 of file RecordingPlan.h.
Referenced by partFile().
| 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.
|
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().
| 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().
|
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.