Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QMediaRecorder Class Reference

\inmodule QtMultimedia More...

#include <qmediarecorder.h>

+ Inheritance diagram for QMediaRecorder:
+ Collaboration diagram for QMediaRecorder:

Signals

void encoderSettingsChanged ()
 Signals when the encoder settings change.
 
void errorChanged ()
 
void mediaFormatChanged ()
 
- 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 which records the media produced by a microphone and camera.
 
 ~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.
 
QIODeviceoutputDevice () 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
 
QPlatformMediaRecorderplatformRecoder () 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< QStringbindableObjectName ()
 
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).
 
QThreadthread () 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 >
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 >
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 QObjectListchildren () 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< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () 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.
 
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.
 
QMediaCaptureSessioncaptureSession () 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
QObjectsender () 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< QObjectDatad_ptr
 

Detailed Description

\inmodule QtMultimedia

The QMediaRecorder class is used for encoding and recording a capture session.

The QMediaRecorder class is a class for encoding and recording media generated in a QMediaCaptureSession.

Definition at line 28 of file qmediarecorder.h.

Member Enumeration Documentation

◆ EncodingMode

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.

◆ Error

\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.

◆ Quality

\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.

◆ RecorderState

\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.

Constructor & Destructor Documentation

◆ QMediaRecorder()

QMediaRecorder::QMediaRecorder ( QObject * parent = nullptr)

Constructs a media recorder which records the media produced by a microphone and camera.

The media recorder is a child of {parent}.

Definition at line 108 of file qmediarecorder.cpp.

References d, QPlatformMediaIntegration::instance(), and qWarning.

+ Here is the call graph for this function:

◆ ~QMediaRecorder()

QMediaRecorder::~QMediaRecorder ( )

Destroys a media recorder object.

Definition at line 135 of file qmediarecorder.cpp.

References QMediaRecorderPrivate::captureSession, QMediaRecorderPrivate::control, and QMediaCaptureSession::setRecorder().

+ Here is the call graph for this function:

Member Function Documentation

◆ actualLocation()

QUrl QMediaRecorder::actualLocation ( ) const

Definition at line 256 of file qmediarecorder.cpp.

References d.

◆ actualLocationChanged

QMediaRecorder::actualLocationChanged ( const QUrl & location)
signal

\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.

◆ addMetaData()

void QMediaRecorder::addMetaData ( const QMediaMetaData & metaData)

Adds metaData to the recorded media.

Definition at line 572 of file qmediarecorder.cpp.

References QMediaMetaData::keys(), metaData, setMetaData(), and QMediaMetaData::value().

+ Here is the call graph for this function:

◆ audioBitRate()

int QMediaRecorder::audioBitRate ( ) const

\qmlproperty int QtMultimedia::MediaRecorder::audioBitRate

Since
6.6

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 860 of file qmediarecorder.cpp.

References d.

◆ audioBitRateChanged

void QMediaRecorder::audioBitRateChanged ( )
signal

Signals when the recording audio bit rate changes.

Referenced by setAudioBitRate().

+ Here is the caller graph for this function:

◆ audioChannelCount()

int QMediaRecorder::audioChannelCount ( ) const

\qmlproperty int QtMultimedia::MediaRecorder::audioChannelCount

Since
6.6

This property holds the number of audio channels.

Returns the number of audio channels.

Definition at line 892 of file qmediarecorder.cpp.

References d.

◆ audioChannelCountChanged

void QMediaRecorder::audioChannelCountChanged ( )
signal

Signals when the recording audio channel count changes.

Referenced by setAudioChannelCount().

+ Here is the caller graph for this function:

◆ audioSampleRate()

int QMediaRecorder::audioSampleRate ( ) const

\qmlproperty int QtMultimedia::MediaRecorder::audioSampleRate

Since
6.6

This property holds the audio sample rate in Hz.

Returns the audio sample rate in Hz.

Definition at line 927 of file qmediarecorder.cpp.

References d.

◆ audioSampleRateChanged

void QMediaRecorder::audioSampleRateChanged ( )
signal

Signals when the recording audio sample rate changes.

Referenced by setAudioSampleRate().

+ Here is the caller graph for this function:

◆ captureSession()

QMediaCaptureSession * QMediaRecorder::captureSession ( ) const

Returns the media capture session.

Definition at line 600 of file qmediarecorder.cpp.

References d.

Referenced by QMediaCaptureSession::setRecorder().

+ Here is the caller graph for this function:

◆ duration()

qint64 QMediaRecorder::duration ( ) const

Definition at line 319 of file qmediarecorder.cpp.

◆ durationChanged

QMediaRecorder::durationChanged ( qint64 duration)
signal

\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.

◆ encoderSettingsChanged

void QMediaRecorder::encoderSettingsChanged ( )
signal

Signals when the encoder settings change.

Referenced by record().

+ Here is the caller graph for this function:

◆ encodingMode()

QMediaRecorder::EncodingMode QMediaRecorder::encodingMode ( ) const

\qmlproperty enumeration QtMultimedia::MediaRecorder::encodingMode

Since
6.6

This property holds the encoding mode.

See also
QMediaRecorder::EncodingMode

Returns the encoding mode.

See also
EncodingMode

Definition at line 681 of file qmediarecorder.cpp.

References d.

◆ encodingModeChanged

void QMediaRecorder::encodingModeChanged ( )
signal

Signals when the encoding mode changes.

Referenced by setEncodingMode().

+ Here is the caller graph for this function:

◆ error()

QMediaRecorder::Error QMediaRecorder::error ( ) const

Definition at line 281 of file qmediarecorder.cpp.

References d, and ResourceError.

◆ errorChanged

void QMediaRecorder::errorChanged ( )
signal

◆ errorOccurred

QMediaRecorder::errorOccurred ( QMediaRecorder::Error error,
const QString & errorString )
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.

Referenced by setOutputLocation().

+ Here is the caller graph for this function:

◆ errorString()

QString QMediaRecorder::errorString ( ) const

Definition at line 301 of file qmediarecorder.cpp.

References d.

◆ isAvailable()

bool QMediaRecorder::isAvailable ( ) const

Returns true if media recorder service ready to use.

Definition at line 204 of file qmediarecorder.cpp.

◆ mediaFormat()

QMediaFormat QMediaRecorder::mediaFormat ( ) const

Definition at line 653 of file qmediarecorder.cpp.

References d.

◆ mediaFormatChanged

void QMediaRecorder::mediaFormatChanged ( )
signal

Referenced by record(), and setMediaFormat().

+ Here is the caller graph for this function:

◆ metaData()

QMediaMetaData QMediaRecorder::metaData ( ) const

Definition at line 548 of file qmediarecorder.cpp.

References d.

◆ metaDataChanged

QMediaRecorder::metaDataChanged ( )
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.

◆ outputDevice()

QIODevice * QMediaRecorder::outputDevice ( ) const

Returns the output IO device for media content.

See also
setOutputDevice()

Definition at line 250 of file qmediarecorder.cpp.

References d.

◆ outputLocation()

QUrl QMediaRecorder::outputLocation ( ) const

Definition at line 209 of file qmediarecorder.cpp.

◆ pause

void QMediaRecorder::pause ( )
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 409 of file qmediarecorder.cpp.

References d.

◆ platformRecoder()

QPlatformMediaRecorder * QMediaRecorder::platformRecoder ( ) const

Definition at line 146 of file qmediarecorder.cpp.

References QMediaRecorderPrivate::control.

Referenced by QMediaCaptureSession::setRecorder().

+ Here is the caller graph for this function:

◆ quality()

QMediaRecorder::Quality QMediaRecorder::quality ( ) const

Definition at line 715 of file qmediarecorder.cpp.

References d.

◆ qualityChanged

void QMediaRecorder::qualityChanged ( )
signal

Signals when the recording quality changes.

Referenced by setQuality().

+ Here is the caller graph for this function:

◆ record

void QMediaRecorder::record ( )
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}.

Note
On mobile devices, recording will happen in the orientation the device had when calling record and is locked for the duration of the recording. To avoid artifacts on the user interface, we recommend to keep the user interface locked to the same orientation as long as the recording is ongoing using the contentOrientation property of the Window and unlock it again once the recording is finished.

Start 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}.

Note
On mobile devices, recording will happen in the orientation the device had when calling record and is locked for the duration of the recording. To avoid artifacts on the user interface, we recommend to keep the user interface locked to the same orientation as long as the recording is ongoing using the contentOrientation property of QWindow and unlock it again once the recording is finished.

Definition at line 362 of file qmediarecorder.cpp.

References d, emit, encoderSettingsChanged(), mediaFormatChanged(), QMediaFormat::NoFlags, PausedState, QMediaFormat::RequiresVideo, and settings.

Referenced by overview_movie().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recorderState()

QMediaRecorder::RecorderState QMediaRecorder::recorderState ( ) const

Returns the current media recorder state.

See also
QMediaRecorder::RecorderState

Definition at line 268 of file qmediarecorder.cpp.

References StoppedState.

◆ recorderStateChanged

QMediaRecorder::recorderStateChanged ( QMediaRecorder::RecorderState state)
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.

Referenced by QGstreamerMediaEncoder::setCaptureSession().

+ Here is the caller graph for this function:

◆ setAudioBitRate()

void QMediaRecorder::setAudioBitRate ( int bitRate)

Sets the audio bitRate in bits per second.

Definition at line 874 of file qmediarecorder.cpp.

References audioBitRateChanged(), d, and emit.

+ Here is the call graph for this function:

◆ setAudioChannelCount()

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 909 of file qmediarecorder.cpp.

References audioChannelCountChanged(), d, and emit.

+ Here is the call graph for this function:

◆ setAudioSampleRate()

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 943 of file qmediarecorder.cpp.

References audioSampleRateChanged(), d, and emit.

+ Here is the call graph for this function:

◆ setEncodingMode()

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.

See also
encodingMode(), EncodingMode

Definition at line 701 of file qmediarecorder.cpp.

References d, emit, and encodingModeChanged().

+ Here is the call graph for this function:

◆ setMediaFormat()

void QMediaRecorder::setMediaFormat ( const QMediaFormat & format)

Definition at line 659 of file qmediarecorder.cpp.

References d, emit, and mediaFormatChanged().

Referenced by overview_movie().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMetaData()

void QMediaRecorder::setMetaData ( const QMediaMetaData & metaData)

Sets the meta data to metaData.

Note
To ensure that meta-data is set correctly, it should be set before starting the recording. Once the recording is started, any meta-data set will be attached to the next recording.

Definition at line 561 of file qmediarecorder.cpp.

References d, and metaData.

Referenced by addMetaData().

+ Here is the caller graph for this function:

◆ setOutputDevice()

void QMediaRecorder::setOutputDevice ( QIODevice * device)

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.

See also
outputDevice()

Definition at line 239 of file qmediarecorder.cpp.

References d, and device.

◆ setOutputLocation()

void QMediaRecorder::setOutputLocation ( const QUrl & location)

Definition at line 214 of file qmediarecorder.cpp.

References d, emit, errorOccurred(), LocationNotWritable, ResourceError, and tr.

+ Here is the call graph for this function:

◆ setQuality()

void QMediaRecorder::setQuality ( Quality quality)

Definition at line 726 of file qmediarecorder.cpp.

References d, emit, quality, and qualityChanged().

+ Here is the call graph for this function:

◆ setVideoBitRate()

void QMediaRecorder::setVideoBitRate ( int bitRate)

Sets the video bitRate in bits per second.

Definition at line 842 of file qmediarecorder.cpp.

References d, emit, and videoBitRateChanged().

+ Here is the call graph for this function:

◆ setVideoFrameRate()

void QMediaRecorder::setVideoFrameRate ( qreal frameRate)

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 810 of file qmediarecorder.cpp.

References d, emit, frameRate, and videoFrameRateChanged().

+ Here is the call graph for this function:

◆ setVideoResolution() [1/2]

void QMediaRecorder::setVideoResolution ( const QSize & size)

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 765 of file qmediarecorder.cpp.

References d, emit, and videoResolutionChanged().

+ Here is the call graph for this function:

◆ setVideoResolution() [2/2]

void QMediaRecorder::setVideoResolution ( int width,
int height )
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.

References setVideoResolution().

Referenced by setVideoResolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop

void QMediaRecorder::stop ( )
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 429 of file qmediarecorder.cpp.

References d.

Referenced by overview_movie().

+ Here is the caller graph for this function:

◆ videoBitRate()

int QMediaRecorder::videoBitRate ( ) const

\qmlproperty int QtMultimedia::MediaRecorder::videoBitRate

Since
6.6

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 828 of file qmediarecorder.cpp.

References d.

◆ videoBitRateChanged

void QMediaRecorder::videoBitRateChanged ( )
signal

Signals when the recording video bit rate changes.

Referenced by setVideoBitRate().

+ Here is the caller graph for this function:

◆ videoFrameRate()

qreal QMediaRecorder::videoFrameRate ( ) const

\qmlproperty real QtMultimedia::MediaRecorder::videoFrameRate

Since
6.6

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 793 of file qmediarecorder.cpp.

References d.

◆ videoFrameRateChanged

void QMediaRecorder::videoFrameRateChanged ( )
signal

Signals when the recording video frame rate changes.

Referenced by setVideoFrameRate().

+ Here is the caller graph for this function:

◆ videoResolution()

QSize QMediaRecorder::videoResolution ( ) const

\qmlproperty Size QtMultimedia::MediaRecorder::videoResolution

Since
6.6

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 748 of file qmediarecorder.cpp.

References d.

◆ videoResolutionChanged

void QMediaRecorder::videoResolutionChanged ( )
signal

Signals when the video recording resolution changes.

Referenced by setVideoResolution().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QMediaCaptureSession

friend class QMediaCaptureSession
friend

Definition at line 168 of file qmediarecorder.h.

Property Documentation

◆ actualLocation

QMediaRecorder::actualLocation
read

\qmlproperty QUrl QtMultimedia::MediaRecorder::actualLocation

The actual location of the last media content.

The actual location is usually available after recording starts, and reset when new location is set or new recording starts.

The actual location of the last media content.

The actual location is usually available after recording starts, and reset when new location is set or new recording starts.

Definition at line 34 of file qmediarecorder.h.

◆ audioBitRate

int QMediaRecorder::audioBitRate
readwrite

Definition at line 44 of file qmediarecorder.h.

◆ audioChannelCount

int QMediaRecorder::audioChannelCount
readwrite

Definition at line 45 of file qmediarecorder.h.

◆ audioSampleRate

int QMediaRecorder::audioSampleRate
readwrite

Definition at line 46 of file qmediarecorder.h.

◆ duration

QMediaRecorder::duration
read

\qmlproperty qint64 QtMultimedia::MediaRecorder::duration

This property holds the recorded media duration in milliseconds.

the recorded media duration in milliseconds.

Definition at line 32 of file qmediarecorder.h.

◆ encodingMode

QMediaRecorder::EncodingMode QMediaRecorder::encodingMode
readwrite

Definition at line 40 of file qmediarecorder.h.

◆ error

QMediaRecorder::error
read

Returns the current error state.

See also
errorString()

Definition at line 36 of file qmediarecorder.h.

◆ errorString

QMediaRecorder::errorString
read

\qmlproperty string QtMultimedia::MediaRecorder::errorString

This property holds a string describing the current error state.

See also
error

Returns a string describing the current error state.

See also
error()

Definition at line 37 of file qmediarecorder.h.

◆ mediaFormat

QMediaRecorder::mediaFormat
readwrite

\qmlproperty MediaFormat QtMultimedia::MediaRecorder::mediaFormat

This property holds the current MediaFormat of the recorder.

Returns the recording media format.

Definition at line 38 of file qmediarecorder.h.

◆ metaData

QMediaRecorder::metaData
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.

Note
Ensure that meta-data is assigned correctly by assigning it before starting the recording.
See also
mediaMetaData

Returns the metaData associated with the recording.

Definition at line 35 of file qmediarecorder.h.

Referenced by addMetaData(), and setMetaData().

◆ outputLocation

QMediaRecorder::outputLocation
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 errorOccured() signal is emitted.

The location can be relative or empty. If empty the recorder uses the system specific place and file naming scheme.

See also
errorOccurred()

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 errorOccured() signal is emitted.

The output location can be relative or empty; in the latter case the recorder uses the system specific place and file naming scheme.

Definition at line 33 of file qmediarecorder.h.

◆ quality

QMediaRecorder::quality
readwrite

Returns the recording quality.

Definition at line 39 of file qmediarecorder.h.

Referenced by setQuality().

◆ recorderState

QMediaRecorder::recorderState
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 31 of file qmediarecorder.h.

◆ videoBitRate

int QMediaRecorder::videoBitRate
readwrite

Definition at line 43 of file qmediarecorder.h.

◆ videoFrameRate

qreal QMediaRecorder::videoFrameRate
readwrite

Definition at line 42 of file qmediarecorder.h.

◆ videoResolution

QSize QMediaRecorder::videoResolution
readwrite

Definition at line 41 of file qmediarecorder.h.


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