QPlatformMediaEncoder Class

The QPlatformMediaEncoder class provides access to the recording functionality. More...

Header: #include <QPlatformMediaEncoder>
CMake: find_package(Qt6 COMPONENTS Multimedia REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia

This class is deprecated. We strongly advise against using it in new code.

Public Functions

virtual void applySettings(const QMediaEncoderSettings &)
virtual qint64 duration() const = 0
QUrl outputLocation() const
virtual void pause()
virtual void record(const QMediaEncoderSettings &settings) = 0
virtual void resume()
virtual void setOutputLocation(const QUrl &location)
virtual QMediaRecorder::RecorderState state() const
virtual void stop() = 0

Protected Functions

QPlatformMediaEncoder(QMediaRecorder *parent)
void actualLocationChanged(const QUrl &location)
void durationChanged(qint64 duration)
void error(QMediaRecorder::Error error, const QString &errorString)
void stateChanged(QMediaRecorder::RecorderState state)

Detailed Description

This control provides a means to set the output location, and record, pause and stop recording via the setState() method. It also provides feedback on the duration of the recording.

See also QMediaRecorder.

Member Function Documentation

[protected] QPlatformMediaEncoder::QPlatformMediaEncoder(QMediaRecorder *parent)

Constructs a media recorder control with the given parent.

[protected] void QPlatformMediaEncoder::actualLocationChanged(const QUrl &location)

Signals that the actual media location has changed. This signal should be emitted at start of recording.

[virtual] void QPlatformMediaEncoder::applySettings(const QMediaEncoderSettings &)

Commits the encoder settings and performs pre-initialization to reduce delays when recording is started.

[pure virtual] qint64 QPlatformMediaEncoder::duration() const

Return the current duration in milliseconds.

[protected] void QPlatformMediaEncoder::durationChanged(qint64 duration)

Signals that the duration of the recorded media has changed.

This only emitted when there is a discontinuous change in the duration such as being reset to 0.

[protected] void QPlatformMediaEncoder::error(QMediaRecorder::Error error, const QString &errorString)

Signals that an error has occurred. The errorString describes the error.

QUrl QPlatformMediaEncoder::outputLocation() const

Returns the current output location being used.

See also setOutputLocation().

[virtual] void QPlatformMediaEncoder::pause()

Pause media recording. Not all platforms supports this operation

[pure virtual] void QPlatformMediaEncoder::record(const QMediaEncoderSettings &settings)

Start media recording.

[virtual] void QPlatformMediaEncoder::resume()

Resume media recording. Not all platforms supports this operation

[virtual] void QPlatformMediaEncoder::setOutputLocation(const QUrl &location)

Sets the output location and returns if this operation is successful. If file at the output location already exists, it should be overwritten.

The location can be relative or empty; in this case the service should use the system specific place and file naming scheme.

After recording has started, the backend should report the actual file location with actualLocationChanged() signal.

See also outputLocation().

[virtual] QMediaRecorder::RecorderState QPlatformMediaEncoder::state() const

Return the current recording state.

[protected] void QPlatformMediaEncoder::stateChanged(QMediaRecorder::RecorderState state)

Signals that the state of a media recorder has changed.

[pure virtual] void QPlatformMediaEncoder::stop()

Stop media recording