Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtMultimedia More...
#include <qmediarecorder.h>
Signals | |
void | encoderSettingsChanged () |
Signals when the encoder settings change. | |
void | errorChanged () |
void | mediaFormatChanged () |
Q_REVISION (6, 8) void autoStopChanged() | |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
This signal is emitted after the object's name has been changed. | |
Public Member Functions | |
QMediaRecorder (QObject *parent=nullptr) | |
Constructs a media recorder. | |
~QMediaRecorder () | |
Destroys a media recorder object. | |
bool | isAvailable () const |
Returns true if media recorder service ready to use. | |
QUrl | outputLocation () const |
void | setOutputLocation (const QUrl &location) |
void | setOutputDevice (QIODevice *device) |
Set the output IO device for media content. | |
QIODevice * | outputDevice () const |
Returns the output IO device for media content. | |
QUrl | actualLocation () const |
RecorderState | recorderState () const |
Returns the current media recorder state. | |
Error | error () const |
QString | errorString () const |
qint64 | duration () const |
QPlatformMediaRecorder * | platformRecoder () const |
Public Member Functions inherited from QObject | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
bool | moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL) |
Changes the thread affinity for this object and its children and returns true on success. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
void | killTimer (Qt::TimerId id) |
template<typename T > | |
T | findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T > | |
QList< T > | findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T > | |
T | findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename T > | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
Properties | |
qint64 | duration |
\qmlproperty qint64 QtMultimedia::MediaRecorder::duration | |
QUrl | outputLocation |
\qmlproperty QUrl QtMultimedia::MediaRecorder::outputLocation | |
QUrl | actualLocation |
\qmlproperty QUrl QtMultimedia::MediaRecorder::actualLocation | |
QMediaRecorder::Error | error |
Returns the current error state. | |
QString | errorString |
\qmlproperty string QtMultimedia::MediaRecorder::errorString | |
QMediaRecorder::EncodingMode | encodingMode |
QSize | videoResolution |
qreal | videoFrameRate |
int | videoBitRate |
int | audioBitRate |
int | audioChannelCount |
int | audioSampleRate |
Properties inherited from QObject | |
QString | objectName |
the name of this object | |
Friends | |
class | QMediaCaptureSession |
enum | Quality { VeryLowQuality , LowQuality , NormalQuality , HighQuality , VeryHighQuality } |
\qmlproperty enumeration QtMultimedia::MediaRecorder::quality More... | |
enum | EncodingMode { ConstantQualityEncoding , ConstantBitRateEncoding , AverageBitRateEncoding , TwoPassEncoding } |
Enumerates encoding modes. More... | |
enum | RecorderState { StoppedState , RecordingState , PausedState } |
\qmlproperty enumeration QtMultimedia::MediaRecorder::recorderState More... | |
enum | Error { NoError , ResourceError , FormatError , OutOfSpaceError , LocationNotWritable } |
\qmlproperty enumeration QtMultimedia::MediaRecorder::error More... | |
QMediaRecorder::RecorderState | recorderState |
The current state of the media recorder. | |
QMediaMetaData | metaData |
\qmlproperty mediaMetaData QtMultimedia::MediaRecorder::metaData | |
QMediaFormat | mediaFormat |
\qmlproperty MediaFormat QtMultimedia::MediaRecorder::mediaFormat | |
Quality | quality |
Returns the recording quality. | |
bool | autoStop |
This property controls whether the media recorder stops automatically when all media inputs have reported the end of the stream or have been deactivated. | |
QMediaFormat | mediaFormat () const |
void | setMediaFormat (const QMediaFormat &format) |
EncodingMode | encodingMode () const |
\qmlproperty enumeration QtMultimedia::MediaRecorder::encodingMode | |
void | setEncodingMode (EncodingMode) |
Sets the encoding mode setting. | |
Quality | quality () const |
void | setQuality (Quality quality) |
QSize | videoResolution () const |
\qmlproperty Size QtMultimedia::MediaRecorder::videoResolution | |
void | setVideoResolution (const QSize &) |
Sets the resolution of the encoded video to {size}. | |
void | setVideoResolution (int width, int height) |
Sets the width and height of the resolution of the encoded video. | |
qreal | videoFrameRate () const |
\qmlproperty real QtMultimedia::MediaRecorder::videoFrameRate | |
void | setVideoFrameRate (qreal frameRate) |
Sets the video frameRate. | |
int | videoBitRate () const |
\qmlproperty int QtMultimedia::MediaRecorder::videoBitRate | |
void | setVideoBitRate (int bitRate) |
Sets the video bitRate in bits per second. | |
int | audioBitRate () const |
\qmlproperty int QtMultimedia::MediaRecorder::audioBitRate | |
void | setAudioBitRate (int bitRate) |
Sets the audio bitRate in bits per second. | |
int | audioChannelCount () const |
\qmlproperty int QtMultimedia::MediaRecorder::audioChannelCount | |
void | setAudioChannelCount (int channels) |
Sets the number of audio channels. | |
int | audioSampleRate () const |
\qmlproperty int QtMultimedia::MediaRecorder::audioSampleRate | |
void | setAudioSampleRate (int sampleRate) |
Sets the audio sampleRate in Hz. | |
QMediaMetaData | metaData () const |
void | setMetaData (const QMediaMetaData &metaData) |
Sets the meta data to metaData. | |
void | addMetaData (const QMediaMetaData &metaData) |
Adds metaData to the recorded media. | |
bool | autoStop () const |
void | setAutoStop (bool autoStop) |
QMediaCaptureSession * | captureSession () const |
Returns the media capture session. | |
void | record () |
\qmlmethod QtMultimedia::MediaRecorder::record() | |
void | pause () |
\qmlmethod QtMultimedia::MediaRecorder::pause() | |
void | stop () |
\qmlmethod QtMultimedia::MediaRecorder::stop() | |
void | recorderStateChanged (RecorderState state) |
\qmlsignal QtMultimedia::MediaRecorder::recorderStateChanged(RecorderState state) | |
void | durationChanged (qint64 duration) |
\qmlsignal QtMultimedia::MediaRecorder::durationChanged(qint64 duration) | |
void | actualLocationChanged (const QUrl &location) |
\qmlsignal QtMultimedia::MediaRecorder::actualLocationChanged(const QUrl &location) | |
void | errorOccurred (Error error, const QString &errorString) |
\qmlsignal QtMultimedia::MediaRecorder::errorOccurred(Error error, const QString &errorString) | |
void | metaDataChanged () |
\qmlsignal QtMultimedia::MediaRecorder::metaDataChanged() | |
void | encodingModeChanged () |
Signals when the encoding mode changes. | |
void | qualityChanged () |
Signals when the recording quality changes. | |
void | videoResolutionChanged () |
Signals when the video recording resolution changes. | |
void | videoFrameRateChanged () |
Signals when the recording video frame rate changes. | |
void | videoBitRateChanged () |
Signals when the recording video bit rate changes. | |
void | audioBitRateChanged () |
Signals when the recording audio bit rate changes. | |
void | audioChannelCountChanged () |
Signals when the recording audio channel count changes. | |
void | audioSampleRateChanged () |
Signals when the recording audio sample rate changes. | |
Additional Inherited Members | |
Public Slots inherited from QObject | |
void | deleteLater () |
\threadsafe | |
Static Public Member Functions inherited from QObject | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
Protected Member Functions inherited from QObject | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
Protected Attributes inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Related Symbols inherited from QObject | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
\inmodule QtMultimedia
The QMediaRecorder class is used for encoding and recording a capture session.
Use the QMediaRecorder class to encode and record media generated in \l QMediaCaptureSession. You can generate: \list
To record media, connect a generator to a corresponding media capture session.
Performance of video encoding and recording is limited by the hardware, the operating system, the installed graphic drivers, and the input video format. If QCamera
, QScreenCapture
, or QWindowCapture
produces video frames faster than QMediaRecorder
can encode and record them, the recorder may drop some frames. This is likely to occur if the input frame resolution is high, 4K for example, and hardware-accelerated encoding is unavailable. If you generate input video via QVideoFrameInput
, the method QVideoFrameInput::sendVideoFrame
will do nothing and return false
whenever this limitation is reached and the internal frame queue is full. Rely on the signal QVideoFrameInput::readyToSendVideoFrame
to know when the recorder is ready to receive new frames again. If you cannot change the rate of video frame generation and dropping frames is undesirable, we recommend implementing your own frame queue on top of QVideoFrameInput
, considering the memory limitations of the hardware.
Definition at line 27 of file qmediarecorder.h.
Enumerates encoding modes.
\value ConstantQualityEncoding Encoding will aim to have a constant quality, adjusting bitrate to fit. \value ConstantBitRateEncoding Encoding will use a constant bit rate, adjust quality to fit. \value AverageBitRateEncoding Encoding will try to keep an average bitrate setting, but will use more or less as needed. \value TwoPassEncoding The media will first be processed to determine the characteristics, and then processed a second time allocating more bits to the areas that need it.
Enumerator | |
---|---|
ConstantQualityEncoding | |
ConstantBitRateEncoding | |
AverageBitRateEncoding | |
TwoPassEncoding |
Definition at line 58 of file qmediarecorder.h.
\qmlproperty enumeration QtMultimedia::MediaRecorder::error
This property holds the current media recorder error state.
\value MediaRecorder.NoError Not in an error state. \value MediaRecorder.ResourceError Not enough system resources \value MediaRecorder.FormatError the current format is not supported. \value MediaRecorder.OutOfSpaceError No space left on device. \value MediaRecorder.LocationNotWriteable The output location is not writable.
\value NoError No Errors. \value ResourceError Device is not ready or not available. \value FormatError Current format is not supported. \value OutOfSpaceError No space left on device. \value LocationNotWritable The output location is not writable.
Enumerator | |
---|---|
NoError | |
ResourceError | |
FormatError | |
OutOfSpaceError | |
LocationNotWritable |
Definition at line 75 of file qmediarecorder.h.
\qmlproperty enumeration QtMultimedia::MediaRecorder::quality
Enumerates quality encoding levels.
\value MediaRecorder.VeryLowQuality \value MediaRecorder.LowQuality \value MediaRecorder.NormalQuality \value MediaRecorder.HighQuality \value MediaRecorder.VeryHighQuality
Enumerates quality encoding levels.
\value VeryLowQuality \value LowQuality \value NormalQuality \value HighQuality \value VeryHighQuality
Enumerator | |
---|---|
VeryLowQuality | |
LowQuality | |
NormalQuality | |
HighQuality | |
VeryHighQuality |
Definition at line 48 of file qmediarecorder.h.
\qmlproperty enumeration QtMultimedia::MediaRecorder::recorderState
This property holds the current media recorder state.
The state property represents the user request and is changed synchronously during record(), pause() or stop() calls. RecorderSstate may also change asynchronously when recording fails.
\value MediaRecorder.StoppedState The recorder is not active. \value MediaRecorder.RecordingState The recording is requested. \value MediaRecorder.PausedState The recorder is pause.
\value StoppedState The recorder is not active. \value RecordingState The recording is requested. \value PausedState The recorder is paused.
Enumerator | |
---|---|
StoppedState | |
RecordingState | |
PausedState |
Definition at line 67 of file qmediarecorder.h.
Constructs a media recorder.
The media recorder is a child of {parent}.
Definition at line 139 of file qmediarecorder.cpp.
QMediaRecorder::~QMediaRecorder | ( | ) |
Destroys a media recorder object.
Definition at line 166 of file qmediarecorder.cpp.
QUrl QMediaRecorder::actualLocation | ( | ) | const |
Definition at line 344 of file qmediarecorder.cpp.
\qmlsignal QtMultimedia::MediaRecorder::actualLocationChanged(const QUrl &location)
Signals that the actual location of the recorded media has changed.
This signal is usually emitted when recording starts.
Signals that the actual location of the recorded media has changed. This signal is usually emitted when recording starts.
void QMediaRecorder::addMetaData | ( | const QMediaMetaData & | metaData | ) |
Adds metaData to the recorded media.
Definition at line 664 of file qmediarecorder.cpp.
int QMediaRecorder::audioBitRate | ( | ) | const |
\qmlproperty int QtMultimedia::MediaRecorder::audioBitRate
This property holds the bit rate of the compressed audio stream in bits per second.
Returns the bit rate of the compressed audio stream in bits per second.
Definition at line 994 of file qmediarecorder.cpp.
|
signal |
Signals when the recording audio bit rate changes.
int QMediaRecorder::audioChannelCount | ( | ) | const |
\qmlproperty int QtMultimedia::MediaRecorder::audioChannelCount
This property holds the number of audio channels.
Returns the number of audio channels.
Definition at line 1026 of file qmediarecorder.cpp.
|
signal |
Signals when the recording audio channel count changes.
int QMediaRecorder::audioSampleRate | ( | ) | const |
\qmlproperty int QtMultimedia::MediaRecorder::audioSampleRate
This property holds the audio sample rate in Hz.
Returns the audio sample rate in Hz.
Definition at line 1061 of file qmediarecorder.cpp.
|
signal |
Signals when the recording audio sample rate changes.
bool QMediaRecorder::autoStop | ( | ) | const |
Definition at line 692 of file qmediarecorder.cpp.
QMediaCaptureSession * QMediaRecorder::captureSession | ( | ) | const |
Returns the media capture session.
Definition at line 734 of file qmediarecorder.cpp.
qint64 QMediaRecorder::duration | ( | ) | const |
Definition at line 407 of file qmediarecorder.cpp.
\qmlsignal QtMultimedia::MediaRecorder::durationChanged(qint64 duration)
Signals that the duration of the recorded media has changed.
Signals that the duration of the recorded media has changed.
|
signal |
Signals when the encoder settings change.
QMediaRecorder::EncodingMode QMediaRecorder::encodingMode | ( | ) | const |
\qmlproperty enumeration QtMultimedia::MediaRecorder::encodingMode
This property holds the encoding mode.
Returns the encoding mode.
Definition at line 815 of file qmediarecorder.cpp.
|
signal |
Signals when the encoding mode changes.
QMediaRecorder::Error QMediaRecorder::error | ( | ) | const |
Definition at line 369 of file qmediarecorder.cpp.
|
signal |
|
signal |
\qmlsignal QtMultimedia::MediaRecorder::errorOccurred(Error error, const QString &errorString)
Signals that an error has occurred.
The errorString contains a description of the error.
Signals that an error has occurred, with errorString containing a description of the error.
QString QMediaRecorder::errorString | ( | ) | const |
Definition at line 389 of file qmediarecorder.cpp.
bool QMediaRecorder::isAvailable | ( | ) | const |
Returns true
if media recorder service ready to use.
Definition at line 273 of file qmediarecorder.cpp.
QMediaFormat QMediaRecorder::mediaFormat | ( | ) | const |
Definition at line 787 of file qmediarecorder.cpp.
|
signal |
QMediaMetaData QMediaRecorder::metaData | ( | ) | const |
Definition at line 640 of file qmediarecorder.cpp.
|
signal |
\qmlsignal QtMultimedia::MediaRecorder::metaDataChanged()
Signals that a media object's meta-data has changed.
If multiple meta-data elements are changed metaDataChanged() is emitted once.
Signals that a media object's meta-data has changed.
If multiple meta-data elements are changed metaDataChanged() is emitted once.
QIODevice * QMediaRecorder::outputDevice | ( | ) | const |
Returns the output IO device for media content.
Definition at line 338 of file qmediarecorder.cpp.
QUrl QMediaRecorder::outputLocation | ( | ) | const |
Definition at line 278 of file qmediarecorder.cpp.
|
slot |
\qmlmethod QtMultimedia::MediaRecorder::pause()
Pauses recording.
The recorder state is changed to QMediaRecorder.PausedState.
Depending on the platform, pausing recording may be not supported. In this case the recorder state is unchanged.
Pauses recording.
The recorder state is changed to QMediaRecorder::PausedState.
Depending on the platform, pausing recording may be not supported. In this case the recorder state is unchanged.
Definition at line 501 of file qmediarecorder.cpp.
QPlatformMediaRecorder * QMediaRecorder::platformRecoder | ( | ) | const |
Definition at line 177 of file qmediarecorder.cpp.
|
signal |
QMediaRecorder::Quality QMediaRecorder::quality | ( | ) | const |
Definition at line 849 of file qmediarecorder.cpp.
|
signal |
Signals when the recording quality changes.
|
slot |
\qmlmethod QtMultimedia::MediaRecorder::record()
Starts recording.
While the recorder state is changed immediately to MediaRecorder.RecordingState
, recording may start asynchronously.
If recording fails, the error() signal is emitted with recorder state being reset back to {QMediaRecorder.StoppedState}.
This method updates \l actualLocation according to its generation rules.
Starts recording.
While the recorder state is changed immediately to cQMediaRecorder::RecordingState}, recording may start asynchronously.
If recording fails error() signal is emitted with recorder state being reset back to {QMediaRecorder::StoppedState}.
This method updates \l actualLocation according to its generation rules.
Definition at line 454 of file qmediarecorder.cpp.
QMediaRecorder::RecorderState QMediaRecorder::recorderState | ( | ) | const |
Returns the current media recorder state.
Definition at line 356 of file qmediarecorder.cpp.
|
signal |
\qmlsignal QtMultimedia::MediaRecorder::recorderStateChanged(RecorderState state)
Signals that a media recorder's state has changed.
Signals that a media recorder's state has changed.
void QMediaRecorder::setAudioBitRate | ( | int | bitRate | ) |
Sets the audio bitRate in bits per second.
Definition at line 1008 of file qmediarecorder.cpp.
void QMediaRecorder::setAudioChannelCount | ( | int | channels | ) |
Sets the number of audio channels.
A value of -1 indicates the recorder should make an optimal choice based on what is available from the audio source and the limitations of the codec.
Definition at line 1043 of file qmediarecorder.cpp.
void QMediaRecorder::setAudioSampleRate | ( | int | sampleRate | ) |
Sets the audio sampleRate in Hz.
A value of -1
indicates the recorder should make an optimal choice based on what is available from the audio source, and the limitations of the codec.
Definition at line 1077 of file qmediarecorder.cpp.
void QMediaRecorder::setAutoStop | ( | bool | autoStop | ) |
Definition at line 699 of file qmediarecorder.cpp.
void QMediaRecorder::setEncodingMode | ( | EncodingMode | mode | ) |
Sets the encoding mode setting.
If ConstantQualityEncoding is set, the quality encoding parameter is used and bit rates are ignored, otherwise the bitrates are used.
Definition at line 835 of file qmediarecorder.cpp.
void QMediaRecorder::setMediaFormat | ( | const QMediaFormat & | format | ) |
Definition at line 793 of file qmediarecorder.cpp.
void QMediaRecorder::setMetaData | ( | const QMediaMetaData & | metaData | ) |
Sets the meta data to metaData.
Definition at line 653 of file qmediarecorder.cpp.
Set the output IO device for media content.
The device must have been opened in the \l{QIODevice::WriteOnly}{WriteOnly} or \l{QIODevice::ReadWrite}{ReadWrite} modes before the recording starts.
The media recorder doesn't take ownership of the specified device. If the recording has been started, the device must be kept alive and open until the signal recorderStateChanged(StoppedState)
is emitted.
This method resets \l actualLocation immediately unless the specified device is null
.
If a writable output device is assigned to the recorder, \l outputLocation is ignored, and \l actualLocation is not generated when recording starts. This behavior may change in the future, so we recommend setting only one output, either outputLocation
or outputDevice
.
QMediaRecorder::setOutputDevice
is only supported with the FFmpeg backend.
Definition at line 319 of file qmediarecorder.cpp.
Definition at line 283 of file qmediarecorder.cpp.
Definition at line 860 of file qmediarecorder.cpp.
void QMediaRecorder::setVideoBitRate | ( | int | bitRate | ) |
Sets the video bitRate in bits per second.
Definition at line 976 of file qmediarecorder.cpp.
Sets the video frameRate.
A value of 0 indicates the recorder should make an optimal choice based on what is available from the video source and the limitations of the codec.
Definition at line 944 of file qmediarecorder.cpp.
Sets the resolution of the encoded video to {size}.
Pass an empty QSize to make the recorder choose an optimal resolution based on what is available from the video source and the limitations of the codec.
Definition at line 899 of file qmediarecorder.cpp.
|
inline |
Sets the width and height of the resolution of the encoded video.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 116 of file qmediarecorder.h.
|
slot |
\qmlmethod QtMultimedia::MediaRecorder::stop()
Stops the recording.
The recorder will stop the recording. Processing pending video and audio data might however still take some time. The recording is finished, once the state of the media recorder changes to QMediaRecorder::StoppedState.
The recorder will stop the recording. Processing pending video and audio data might however still take some time. The recording is finished, once the state of the media recorder changes to QMediaRecorder::StoppedState.
Definition at line 521 of file qmediarecorder.cpp.
int QMediaRecorder::videoBitRate | ( | ) | const |
\qmlproperty int QtMultimedia::MediaRecorder::videoBitRate
This property holds the bit rate of the compressed video stream in bits per second.
Returns the bit rate of the compressed video stream in bits per second.
Definition at line 962 of file qmediarecorder.cpp.
|
signal |
Signals when the recording video bit rate changes.
qreal QMediaRecorder::videoFrameRate | ( | ) | const |
\qmlproperty real QtMultimedia::MediaRecorder::videoFrameRate
This property holds the video frame rate.
A value of 0 indicates the recorder should make an optimal choice based on what is available from the video source and the limitations of the codec.
Returns the video frame rate.
Definition at line 927 of file qmediarecorder.cpp.
|
signal |
Signals when the recording video frame rate changes.
QSize QMediaRecorder::videoResolution | ( | ) | const |
\qmlproperty Size QtMultimedia::MediaRecorder::videoResolution
This property holds the resolution of the encoded video.
Set an empty Size to make the recorder choose an optimal resolution based on what is available from the video source and the limitations of the codec.
Returns the resolution of the encoded video.
Definition at line 882 of file qmediarecorder.cpp.
|
signal |
Signals when the video recording resolution changes.
|
friend |
Definition at line 172 of file qmediarecorder.h.
|
read |
\qmlproperty QUrl QtMultimedia::MediaRecorder::actualLocation
The actual location of the last media content.
The actual location is reset when a new \l outputLocation is assigned. When \l record() is invoked, the recorder generates the actual location basing on the following rules. \list
outputLocation
is empty, a directory, or a file without an extension, the recorder generates the appropriate extension based on the selected media format and system MIME types. outputLocation
is a directory, the recorder generates a new file name within it. outputLocation
is empty, the recorder generates a new file name in the system-specific directory for audio or video. recorderStateChanged(RecordingState)
. \endlistThe actual location of the last media content.
The actual location is reset when a new \l outputLocation or a non-null \l outputDevice is assigned. When \l record() is invoked and outputDevice
is null
or not writable, the recorder generates the actual location basing on the following rules. \list
outputLocation
is empty, a directory, or a file without an extension, the recorder generates the appropriate extension based on the selected media format and system MIME types. outputLocation
is a directory, the recorder generates a new file name within it. outputLocation
is empty, the recorder generates a new file name in the system-specific directory for audio or video. recorderStateChanged(RecordingState)
. \endlist Definition at line 33 of file qmediarecorder.h.
|
readwrite |
Definition at line 43 of file qmediarecorder.h.
|
readwrite |
Definition at line 44 of file qmediarecorder.h.
|
readwrite |
Definition at line 45 of file qmediarecorder.h.
|
readwrite |
This property controls whether the media recorder stops automatically when all media inputs have reported the end of the stream or have been deactivated.
The end of the stream is reported by sending an empty media frame, which you can send explicitly via \l QVideoFrameInput or \l QAudioBufferInput.
Video inputs, specificly, \l QCamera, \l QScreenCapture and \l QWindowCapture, can be deactivated via the function setActive
.
Defaults to false
.
QMediaRecorder::autoStop is only supported with the FFmpeg backend.
Definition at line 46 of file qmediarecorder.h.
|
read |
\qmlproperty qint64 QtMultimedia::MediaRecorder::duration
This property holds the recorded media duration in milliseconds.
the recorded media duration in milliseconds.
Definition at line 31 of file qmediarecorder.h.
|
readwrite |
Definition at line 39 of file qmediarecorder.h.
|
read |
Returns the current error state.
Definition at line 35 of file qmediarecorder.h.
|
read |
\qmlproperty string QtMultimedia::MediaRecorder::errorString
This property holds a string describing the current error state.
Returns a string describing the current error state.
Definition at line 36 of file qmediarecorder.h.
|
readwrite |
\qmlproperty MediaFormat QtMultimedia::MediaRecorder::mediaFormat
This property holds the current MediaFormat of the recorder.
Returns the recording media format.
Definition at line 37 of file qmediarecorder.h.
|
readwrite |
\qmlproperty mediaMetaData QtMultimedia::MediaRecorder::metaData
This property holds meta data associated with the recording.
When a recording is started, any meta-data assigned will be attached to that recording.
Returns the metaData associated with the recording.
Definition at line 34 of file qmediarecorder.h.
|
readwrite |
\qmlproperty QUrl QtMultimedia::MediaRecorder::outputLocation
The destination location of media content.
Setting the location can fail, for example when the service supports only local file system locations but a network URL was passed. If the operation fails an \l errorOccured() signal is emitted.
The output location can be empty, a directory, or a file. The path to a directory or file can be relative or absolute. The \l record() method generates the actual location according to the specified output location and system-specific settings. Refer to the \l actualLocation property description for details.
The destination location of media content.
Setting the location can fail, for example when the service supports only local file system locations but a network URL was passed. If the operation fails, the \l errorOccured() signal is emitted.
The output location is ignored if a writable \l outputDevice has been assigned to the recorder. This behavior may change in the future, so we recommend setting only one output, either outputLocation
or outputDevice
.
The output location can be empty, a directory, or a file. The path to a directory or file can be relative or absolute. The \l record() method generates the actual location according to the specified output location and system-specific settings. Refer to the \l actualLocation property description for details.
Definition at line 32 of file qmediarecorder.h.
|
readwrite |
Returns the recording quality.
Definition at line 38 of file qmediarecorder.h.
|
read |
The current state of the media recorder.
The state property represents the user request and is changed synchronously during record(), pause() or stop() calls. Recorder state may also change asynchronously when recording fails.
Definition at line 30 of file qmediarecorder.h.
|
readwrite |
Definition at line 42 of file qmediarecorder.h.
|
readwrite |
Definition at line 41 of file qmediarecorder.h.
|
readwrite |
Definition at line 40 of file qmediarecorder.h.