15#ifndef QGSVIDEOEXPORTER_H
16#define QGSVIDEOEXPORTER_H
25#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
26#include <QtMultimedia/QMediaFormat>
27#include <QtMultimedia/QMediaRecorder>
31class QMediaCaptureSession;
32class QVideoFrameInput;
98 QSize
size()
const {
return mSize; }
109 void setInputFiles(
const QStringList &files );
122 void setInputFilesByPattern(
const QString &directory,
const QString &pattern );
129 QStringList inputFiles()
const;
132#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
142 void setFileFormat( QMediaFormat::FileFormat format );
149 QMediaFormat::FileFormat fileFormat()
const;
159 void setVideoCodec( QMediaFormat::VideoCodec codec );
166 QMediaFormat::VideoCodec videoCodec()
const;
173 QMediaRecorder::Error error()
const;
187 void setFileFormat( QMediaFormat::FileFormat format );
194 QMediaFormat::FileFormat fileFormat()
const;
204 void setVideoCodec( QMediaFormat::VideoCodec codec );
211 QMediaFormat::VideoCodec videoCodec()
const;
218 QMediaRecorder::Error error()
const;
226 QString errorString()
const;
249#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
250 void checkStatus( QMediaRecorder::RecorderState state );
251 void handleError( QMediaRecorder::Error
error,
const QString &
errorString );
258 QStringList mInputFiles;
259 double mFramesPerSecond = 10;
260 qint64 mFrameDurationUs = 100000;
261#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
262 QMediaFormat::FileFormat mFormat = QMediaFormat::FileFormat::MPEG4;
263 QMediaFormat::VideoCodec mCodec = QMediaFormat::VideoCodec::H264;
264 QMediaRecorder::Error mError = QMediaRecorder::Error::NoError;
265 int mCurrentFrameIndex = 0;
267 QPointer< QgsFeedback > mFeedback;
269 QString mErrorString;
271#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
272 std::unique_ptr< QMediaCaptureSession > mSession;
273 std::unique_ptr< QMediaRecorder > mRecorder;
274 std::unique_ptr< QVideoFrameInput > mVideoInput;
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Custom exception class which is raised when an operation is not supported.
void finished()
Emitted when the video export finishes.
QMediaRecorder::Error error() const
Returns the last error received while writing the video.
qint64 frameDuration() const
Returns the duration of each frame, in micro-seconds.
QString errorString() const
Returns the string describing the last error received while writing the video.
QgsVideoExporter(const QString &filename, QSize size, double framesPerSecond)
Constructor for QgsVideoExporter.
double framesPerSecond() const
Returns the output video frames per second.
static bool isAvailable()
Returns true if the video export functionality is available on the current system.
void setFeedback(QgsFeedback *feedback)
Sets an optional feedback object, for progress reports and cancellation support.
QSize size() const
Returns the output video frame size.
QgsFeedback * feedback()
Returns the optional feedback object.
#define SIP_THROW(name,...)