6#include <QtCore/QObject>
7#include <QtCore/QString>
8#include <QtCore/QStringList>
9#include <QtMultimedia/QMediaFormat>
10#include <QtMultimedia/QMediaRecorder>
41 bool active()
const {
return _recorder->recorderState() != QMediaRecorder::StoppedState; }
47 void start(
const QString& file, QMediaFormat::FileFormat
container,
48 QMediaFormat::VideoCodec codec = QMediaFormat::VideoCodec::Unspecified,
49 QMediaRecorder::Quality quality = QMediaRecorder::HighQuality);
59 QMediaFormat::VideoCodec codec = QMediaFormat::VideoCodec::Unspecified);
65 static QMediaFormat::VideoCodec
recordingCodec(
const QString& key);
81 void _recordNextFormat();
83 void _retryNextFormat();
84 void _onRecorderStateChanged(QMediaRecorder::RecorderState state);
85 void _onRecorderError(
const QString& errorString);
87 void _onRecordingNotStarted();
89 QMediaRecorder*
const _recorder;
90 QList<QMediaFormat> _pendingFormats;
91 QMediaRecorder::Quality _quality = QMediaRecorder::HighQuality;
93 QString _recordingBase;
94 QString _recordingFile;
95 QString _recordingError;
96 bool _recording =
false;
97 bool _stopRequested =
false;
friend class QtVideoRecorderTest
static QList< QMediaFormat > recordingFormats(QMediaFormat::FileFormat container, QMediaFormat::VideoCodec codec=QMediaFormat::VideoCodec::Unspecified)
bool recording() const
From the first encoded frame until the recorder stops.
void recordingChanged(bool recording)
static QMediaFormat::VideoCodec recordingCodec(const QString &key)
The codec of key key, as recordingCodecs() names it; Unspecified for an empty or unknown key.
static QMediaFormat::FileFormat container(VideoReceiver::FileFormat format)
The container of format.
static constexpr std::chrono::seconds kFinishTimeout
How long an owner going away waits for a recording's file to be finished.
void recordingFinished(const QString &file, const QString &error)
error is empty for a recording that finished normally.
QtVideoRecorder(QObject *parent=nullptr)
static QStringList recordingCodecs()
void recordingStarted(const QString &file)
void stopAndWait(std::chrono::milliseconds timeout=kFinishTimeout)
static QMediaRecorder::Quality recordingQuality(int value)
The quality of value value, one of VideoSettings::uvcRecordingQuality's; HighQuality for any other.
static QString recordingCodecName(const QString &key)
The name of the codec of key key, such as "H.264", for display.
void start(const QString &file, QMediaFormat::FileFormat container, QMediaFormat::VideoCodec codec=QMediaFormat::VideoCodec::Unspecified, QMediaRecorder::Quality quality=QMediaRecorder::HighQuality)
~QtVideoRecorder() override
QMediaRecorder * mediaRecorder() const
bool active() const
Recording, or waiting for the first frame to encode.
FileFormat
Values are persisted by VideoSettings::recordingFormat.