The QMediaRecorder class is used for the recording of media content. More...
#include <QMediaRecorder>
Inherits: QObject and QMediaBindableInterface.
This class was introduced in Qt Mobility 1.0.
enum | Error { NoError, ResourceError, FormatError } |
enum | State { StoppedState, RecordingState, PausedState } |
|
|
QMediaRecorder ( QMediaObject * mediaObject, QObject * parent = 0 ) | |
~QMediaRecorder () | |
QString | audioCodecDescription ( const QString & codec ) const |
QAudioEncoderSettings | audioSettings () const |
QtMultimediaKit::AvailabilityError | availabilityError () const |
QStringList | availableExtendedMetaData () const |
QList<QtMultimediaKit::MetaData> | availableMetaData () const |
QString | containerDescription ( const QString & mimeType ) const |
QString | containerMimeType () const |
qint64 | duration () const |
Error | error () const |
QString | errorString () const |
QVariant | extendedMetaData ( const QString & key ) const |
bool | isAvailable () const |
bool | isMetaDataAvailable () const |
bool | isMetaDataWritable () const |
bool | isMuted () const |
QVariant | metaData ( QtMultimediaKit::MetaData key ) const |
QUrl | outputLocation () const |
void | setEncodingSettings ( const QAudioEncoderSettings & audio, const QVideoEncoderSettings & video = QVideoEncoderSettings(), const QString & container = QString() ) |
void | setExtendedMetaData ( const QString & key, const QVariant & value ) |
void | setMetaData ( QtMultimediaKit::MetaData key, const QVariant & value ) |
bool | setOutputLocation ( const QUrl & location ) |
State | state () const |
QStringList | supportedAudioCodecs () const |
QList<int> | supportedAudioSampleRates ( const QAudioEncoderSettings & settings = QAudioEncoderSettings(), bool * continuous = 0 ) const |
QStringList | supportedContainers () const |
QList<qreal> | supportedFrameRates ( const QVideoEncoderSettings & settings = QVideoEncoderSettings(), bool * continuous = 0 ) const |
QList<QSize> | supportedResolutions ( const QVideoEncoderSettings & settings = QVideoEncoderSettings(), bool * continuous = 0 ) const |
QStringList | supportedVideoCodecs () const |
QString | videoCodecDescription ( const QString & codec ) const |
QVideoEncoderSettings | videoSettings () const |
virtual QMediaObject * | mediaObject () const |
void | pause () |
void | record () |
void | setMuted ( bool muted ) |
void | stop () |
void | durationChanged ( qint64 duration ) |
void | error ( QMediaRecorder::Error error ) |
void | metaDataAvailableChanged ( bool available ) |
void | metaDataChanged () |
void | metaDataWritableChanged ( bool writable ) |
void | mutedChanged ( bool muted ) |
void | stateChanged ( QMediaRecorder::State state ) |
The 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 QAudioCaptureSource.
// Audio only recording audioSource = new QAudioCaptureSource; recorder = new QMediaRecorder(audioSource); QAudioEncoderSettings audioSettings; audioSettings.setCodec("audio/vorbis"); audioSettings.setQuality(QtMultimediaKit::HighQuality); recorder->setEncodingSettings(audioSettings); recorder->setOutputLocation(QUrl::fromLocalFile(fileName)); recorder->record();
See also QAudioCaptureSource.
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. |
Constant | Value | Description |
---|---|---|
QMediaRecorder::StoppedState | 0 | The recorder is not active. |
QMediaRecorder::RecordingState | 1 | The recorder is currently active and producing data. |
QMediaRecorder::PausedState | 2 | The recorder is paused. |
This property holds the recorded media duration in milliseconds.
This property was introduced in Qt Mobility 1.0.
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.
This property was introduced in Qt Mobility 1.0.
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.
This property was introduced in Qt Mobility 1.0.
Access functions:
bool | isMetaDataWritable () const |
Notifier signal:
void | metaDataWritableChanged ( bool writable ) |
This property holds whether a recording audio stream is muted.
This property was introduced in Qt Mobility 1.0.
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.
This property was introduced in Qt Mobility 1.0.
Access functions:
QUrl | outputLocation () const |
bool | setOutputLocation ( const QUrl & location ) |
Constructs a media recorder which records the media produced by mediaObject.
The parent is passed to QMediaObject.
This function was introduced in Qt Mobility 1.0.
Destroys a media recorder object.
Returns a description of an audio codec.
This function was introduced in Qt Mobility 1.0.
Returns the audio encoder settings being used.
This function was introduced in Qt Mobility 1.0.
See also setEncodingSettings().
Returns the availability error code.
This function was introduced in Qt Mobility 1.0.
Returns a list of keys there is extended meta-data available for.
This function was introduced in Qt Mobility 1.0.
Returns a list of keys there is meta-data available for.
This function was introduced in Qt Mobility 1.0.
Returns a description of a container format mimeType.
This function was introduced in Qt Mobility 1.0.
Returns the MIME type of the selected container format.
This function was introduced in Qt Mobility 1.0.
Signals that the duration of the recorded media has changed.
This function was introduced in Qt Mobility 1.0.
Returns the current error state.
This function was introduced in Qt Mobility 1.0.
See also errorString().
Signals that an error has occurred.
This function was introduced in Qt Mobility 1.0.
Returns a string describing the current error state.
This function was introduced in Qt Mobility 1.0.
See also error().
Returns the value associated with a meta-data key.
The naming and type of extended meta-data is not standardized, so the values and meaning of keys may vary between backends.
This function was introduced in Qt Mobility 1.0.
See also setExtendedMetaData().
Returns true if media recorder service ready to use.
This function was introduced in Qt Mobility 1.0.
Reimplemented from QMediaBindableInterface::mediaObject().
Returns the QMediaObject instance that this QMediaRecorder is bound too, or 0 otherwise.
This function was introduced in Qt Mobility 1.0.
Returns the value associated with a meta-data key.
This function was introduced in Qt Mobility 1.0.
See also setMetaData().
Signals that the available state of a media object's meta-data has changed.
This function was introduced in Qt Mobility 1.0.
Signals that a media object's meta-data has changed.
This function was introduced in Qt Mobility 1.0.
Signals that the writable state of a media object's meta-data has changed.
This function was introduced in Qt Mobility 1.0.
Signals that the muted state has changed. If true the recording is being muted.
This function was introduced in Qt Mobility 1.0.
Pause recording.
This function was introduced in Qt Mobility 1.0.
Start recording.
This is an asynchronous call, with signal stateCahnged(QMediaRecorder::RecordingState) being emitted when recording started, otherwise the error() signal is emitted.
This function was introduced in Qt Mobility 1.0.
Sets the audio and video encoder settings and container format MIME type.
If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties. While setEncodingSettings is optional, the backend can preload encoding pipeline to improve recording startup time.
It's only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
This function was introduced in Qt Mobility 1.0.
See also audioSettings(), videoSettings(), and containerMimeType().
Sets a value for a meta-data key.
The naming and type of extended meta-data is not standardized, so the values and meaning of keys may vary between backends.
This function was introduced in Qt Mobility 1.0.
See also extendedMetaData().
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.
This function was introduced in Qt Mobility 1.0.
See also metaData().
Returns the current media recorder state.
This function was introduced in Qt Mobility 1.0.
See also QMediaRecorder::State.
Signals that a media recorder's state has changed.
This function was introduced in Qt Mobility 1.0.
Stop recording.
This function was introduced in Qt Mobility 1.0.
Returns a list of supported audio codecs.
This function was introduced in Qt Mobility 1.0.
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.
This function was introduced in Qt Mobility 1.0.
Returns a list of MIME types of supported container formats.
This function was introduced in Qt Mobility 1.0.
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.
This function was introduced in Qt Mobility 1.0.
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.
This function was introduced in Qt Mobility 1.0.
See also QVideoEncoderSettings::resolution().
Returns a list of supported video codecs.
This function was introduced in Qt Mobility 1.0.
Returns a description of a video codec.
This function was introduced in Qt Mobility 1.0.
See also setEncodingSettings().
Returns the video encoder settings being used.
This function was introduced in Qt Mobility 1.0.
See also setEncodingSettings().
© 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners. Privacy Policy
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.
Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.