QMediaRecorder ClassThe QMediaRecorder class is used for the recording of media content. More... #include <QMediaRecorder> Inherits: QObject and QMediaBindableInterface. Inherited by: QAudioRecorder. Public Types
Properties
Public Functions
Reimplemented Public Functions
Public Slots
Signals
Protected Functions
Additional Inherited Members
Detailed DescriptionThe QMediaRecorder class is used for the recording of media content. The QMediaRecorder class is a high level media recording class. It's not intended to be used alone but for accessing the media recording functions of other media objects, like QRadioTuner, or QCamera. recorder = new QMediaRecorder(camera); QAudioEncoderSettings audioSettings; audioSettings.setCodec("audio/amr"); audioSettings.setQuality(QtMultimedia::HighQuality); recorder->setAudioSettings(audioSettings); recorder->setOutputLocation(QUrl::fromLocalFile(fileName)); recorder->record(); See also QAudioRecorder. Member Type Documentation
|
Constant | Value | Description |
---|---|---|
QMediaRecorder::NoError | 0 | No Errors. |
QMediaRecorder::ResourceError | 1 | Device is not ready or not available. |
QMediaRecorder::FormatError | 2 | Current format is not supported. |
QMediaRecorder::OutOfSpaceError | 3 | No space left on device. |
Constant | Value | Description |
---|---|---|
QMediaRecorder::StoppedState | 0 | The recorder is not active. |
QMediaRecorder::RecordingState | 1 | The recording is requested. |
QMediaRecorder::PausedState | 2 | The recorder is paused. |
Constant | Value | Description |
---|---|---|
QMediaRecorder::UnavailableStatus | 0 | The recorder is not available or not supported by connected media object. |
QMediaRecorder::UnloadedStatus | 1 | The recorder is avilable but not loaded. |
QMediaRecorder::LoadingStatus | 2 | The recorder is initializing. |
QMediaRecorder::LoadedStatus | 3 | The recorder is initialized and ready to record media. |
QMediaRecorder::StartingStatus | 4 | Recording is requested but not active yet. |
QMediaRecorder::RecordingStatus | 5 | Recording is active. |
QMediaRecorder::PausedStatus | 6 | Recording is paused. |
QMediaRecorder::FinalizingStatus | 7 | Recording is stopped with media being finalized. |
This property holds 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.
Access functions:
QUrl | actualLocation() const |
Notifier signal:
void | actualLocationChanged(const QUrl & location) |
This property holds the recorded media duration in milliseconds.
Access functions:
qint64 | duration() const |
Notifier signal:
void | durationChanged(qint64 duration) |
This property holds whether access to a media object's meta-data is available.
If this is true there is meta-data available, otherwise there is no meta-data available.
Access functions:
bool | isMetaDataAvailable() const |
Notifier signal:
void | metaDataAvailableChanged(bool available) |
This property holds whether a media object's meta-data is writable.
If this is true the meta-data is writable, otherwise the meta-data is read-only.
Access functions:
bool | isMetaDataWritable() const |
Notifier signal:
void | metaDataWritableChanged(bool writable) |
This property holds whether a recording audio stream is muted.
Access functions:
bool | isMuted() const |
void | setMuted(bool muted) |
Notifier signal:
void | mutedChanged(bool muted) |
This property holds 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 service does not support media recording this setting the output location will always fail.
The location can be relative or empty; in this case the recorder uses the system specific place and file naming scheme. After recording has stated, QMediaRecorder::outputLocation() returns the actual output location.
Access functions:
QUrl | outputLocation() const |
bool | setOutputLocation(const QUrl & location) |
This property holds 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.
Access functions:
State | state() const |
Notifier signal:
void | stateChanged(QMediaRecorder::State state) |
This property holds the current status of the media recorder.
The status is changed asynchronously and represents the actual status of media recorder.
Access functions:
Status | status() const |
Notifier signal:
void | statusChanged(QMediaRecorder::Status status) |
Constructs a media recorder which records the media produced by mediaObject.
The parent is passed to QMediaObject.
Destroys a media recorder object.
Returns a description of an audio codec.
Returns the audio encoder settings being used.
See also setAudioSettings() and setEncodingSettings().
Signals that the media recorder is now available (if available is true), or not.
Returns the availability error code.
See also availabilityErrorChanged().
Signals that the service availability has changed to availability.
Returns a list of keys there is meta-data available for.
Returns a description of a container format.
Returns the selected container format.
See also setContainerFormat().
Returns the current error state.
See also errorString().
Signals that an error has occurred.
Returns a string describing the current error state.
See also error().
Returns true if media recorder service ready to use.
See also availabilityChanged().
Reimplemented from QMediaBindableInterface::mediaObject().
Returns the QMediaObject instance that this QMediaRecorder is bound too, or 0 otherwise.
Returns the value associated with a meta-data key.
See also setMetaData().
Signals that a media object's meta-data has changed.
If multiple meta-data elements are changed, metaDataChanged(const QString &key, const QVariant &value) signal is emitted for each of them with metaDataChanged() changed emitted once.
Signal the changes of one meta-data element value with the given key.
Pause recording.
The recorder state is changed to QMediaRecorder::PausedState.
Depending on platform recording pause may be not supported, in this case the recorder state stays unchanged.
Start recording.
While the recorder state is changed immediately to QMediaRecorder::RecordingState, recording may start asynchronously, with statusChanged(QMediaRecorder::RecordingStatus) signal emitted when recording starts.
If recording fails error() signal is emitted with recorder state being reset back to QMediaRecorder::StoppedState.
Sets the audio encoder settings.
If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.
It's only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
See also audioSettings(), videoSettings(), and containerFormat().
Sets the media container format.
If the container format is not specified, the encoder will choose format, depending on media source properties and encoding settings selected.
It's only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
See also audioSettings(), videoSettings(), and containerFormat().
Sets the audio and video encoder settings and container format.
If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.
It's only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
See also audioSettings(), videoSettings(), and containerFormat().
Sets a value for a meta-data key.
Note: To ensure that meta data is set corretly, it should be set before starting the recording. Once the recording is stopped, any meta data set will be attached to the next recording.
See also metaData().
Sets the video encoder settings.
If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties.
It's only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
See also audioSettings(), videoSettings(), and containerFormat().
Stop recording.
The recorder state is changed to QMediaRecorder::StoppedState.
Returns a list of supported audio codecs.
Returns a list of supported audio sample rates.
If non null audio settings parameter is passed, the returned list is reduced to sample rates supported with partial settings applied.
This can be used to query the list of sample rates, supported by specific audio codec.
If the encoder supports arbitrary sample rates within the supported rates range, *continuous is set to true, otherwise *continuous is set to false.
Returns a list of supported container formats.
Returns a list of frame rates video can be encoded at.
If non null video settings parameter is passed, the returned list is reduced to frame rates supported with partial settings like video codec or resolution applied.
If the encoder supports arbitrary frame rates within the supported range, *continuous is set to true, otherwise *continuous is set to false.
See also QVideoEncoderSettings::frameRate().
Returns a list of resolutions video can be encoded at.
If non null video settings parameter is passed, the returned list is reduced to resolution supported with partial settings like video codec or framerate applied.
If the encoder supports arbitrary resolutions within the supported range, *continuous is set to true, otherwise *continuous is set to false.
See also QVideoEncoderSettings::resolution().
Returns a list of supported video codecs.
Returns a description of a video codec.
See also setEncodingSettings().
Returns the video encoder settings being used.
See also setVideoSettings() and setEncodingSettings().