CopperSpice API
1.9.2
|
The QMediaRecorder class is used for the recording of media content. More...
Public Types | |
enum | Error |
enum | State |
enum | Status |
Public Signals | |
void | actualLocationChanged (const QUrl &location) |
void | availabilityChanged (bool available) |
void | availabilityChanged (QMultimedia::AvailabilityStatus availability) |
void | durationChanged (qint64 duration) |
void | error (QMediaRecorder::Error error) |
void | metaDataAvailableChanged (bool available) |
void | metaDataChanged () |
void | metaDataChanged (const QString &key, const QVariant &value) |
void | metaDataWritableChanged (bool writable) |
void | mutedChanged (bool muted) |
void | stateChanged (QMediaRecorder::State state) |
void | statusChanged (QMediaRecorder::Status status) |
void | volumeChanged (qreal volume) |
Public Signals inherited from QObject | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Public Slots | |
void | pause () |
void | record () |
void | setMuted (bool muted) |
void | setVolume (qreal volume) |
void | stop () |
Public Slots inherited from QObject | |
void | deleteLater () |
Public Methods | |
QMediaRecorder (QMediaObject *mediaObject, QObject *parent=nullptr) | |
~QMediaRecorder () | |
QUrl | actualLocation () const |
QString | audioCodecDescription (const QString &codecName) const |
QAudioEncoderSettings | audioSettings () const |
QMultimedia::AvailabilityStatus | availability () const |
QStringList | availableMetaData () const |
QString | containerDescription (const QString &format) const |
QString | containerFormat () const |
qint64 | duration () const |
Error | error () const |
QString | errorString () const |
bool | isAvailable () const |
bool | isMetaDataAvailable () const |
bool | isMetaDataWritable () const |
bool | isMuted () const |
QMediaObject * | mediaObject () const override |
QVariant | metaData (const QString &key) const |
QUrl | outputLocation () const |
void | setAudioSettings (const QAudioEncoderSettings &audioSettings) |
void | setContainerFormat (const QString &format) |
void | setEncodingSettings (const QAudioEncoderSettings &audioSettings, const QVideoEncoderSettings &videoSettings=QVideoEncoderSettings (), const QString &mimeType=QString ()) |
void | setMetaData (const QString &key, const QVariant &value) |
bool | setOutputLocation (const QUrl &location) |
void | setVideoSettings (const QVideoEncoderSettings &videoSettings) |
State | state () const |
Status | status () const |
QStringList | supportedAudioCodecs () const |
QList< int > | supportedAudioSampleRates (const QAudioEncoderSettings &settings=QAudioEncoderSettings (), bool *continuous=nullptr) const |
QStringList | supportedContainers () const |
QList< qreal > | supportedFrameRates (const QVideoEncoderSettings &settings=QVideoEncoderSettings (), bool *continuous=nullptr) const |
QList< QSize > | supportedResolutions (const QVideoEncoderSettings &settings=QVideoEncoderSettings (), bool *continuous=nullptr) const |
QStringList | supportedVideoCodecs () const |
QString | videoCodecDescription (const QString &codecName) const |
QVideoEncoderSettings | videoSettings () const |
qreal | volume () const |
Public Methods inherited from QObject | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
Public Methods inherited from QMediaBindableInterface | |
virtual | ~QMediaBindableInterface () |
Protected Methods | |
bool | setMediaObject (QMediaObject *object) override |
Protected Methods inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Properties | |
actualLocation | |
Actual location of the last media content. More... | |
duration | |
Recorded media duration in milliseconds. More... | |
metaDataAvailable | |
Whether access to a media object's metadata is available. More... | |
metaDataWritable | |
Whether a media object's metadata is writable. More... | |
muted | |
Whether a recording audio stream is muted. More... | |
outputLocation | |
the destination location of media content. More... | |
state | |
Current state of the media recorder. More... | |
status | |
Current status of the media recorder. More... | |
volume | |
Linear audio gain of media recorder. More... | |
Properties inherited from QObject | |
objectName | |
Additional Inherited Members | |
Static Public Methods inherited from QObject | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
The QMediaRecorder class is a high level media recording class. It is not intended to be used alone but for accessing the media recording functions of other media objects, like QRadioTuner, or QCamera.
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 | Recorder is not active. |
QMediaRecorder::RecordingState | 1 | Recording is requested. |
QMediaRecorder::PausedState | 2 | 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 available 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. |
|
explicit |
Constructs a media recorder which records the media produced by mediaObject. The parent is passed to QMediaObject.
QMediaRecorder::~QMediaRecorder | ( | ) |
Destroys a media recorder object.
QUrl QMediaRecorder::actualLocation | ( | ) | const |
Returns the current value of the actualLocation property.
|
signal |
Signals the actual location of the recorded media has changed. This signal is usually emitted when recording starts.
Returns a description of an audio codecName.
QAudioEncoderSettings QMediaRecorder::audioSettings | ( | ) | const |
Returns the audio encoder settings being used.
QMultimedia::AvailabilityStatus QMediaRecorder::availability | ( | ) | const |
Returns the availability of this functionality.
|
signal |
Signals that the media recorder is now available (if available is true), or not.
|
signal |
Signals that the service availability has changed to availability.
QStringList QMediaRecorder::availableMetaData | ( | ) | const |
Returns a list of keys there is metadata available for.
Returns a description of a container format.
QString QMediaRecorder::containerFormat | ( | ) | const |
Returns the selected container format.
|
signal |
Signals that the duration of the recorded media has changed.
QMediaRecorder::Error QMediaRecorder::error | ( | ) | const |
Returns the current error state.
|
signal |
Signals that an error has occurred.
QString QMediaRecorder::errorString | ( | ) | const |
Returns a string describing the current error state.
bool QMediaRecorder::isAvailable | ( | ) | const |
Returns true if media recorder service ready to use.
bool QMediaRecorder::isMetaDataAvailable | ( | ) | const |
Returns true if the media object's metadata is available. The property is called metaDataAvailable.
bool QMediaRecorder::isMetaDataWritable | ( | ) | const |
Returns true if the media object metadata is writeable. The property is called metaDataWritable.
bool QMediaRecorder::isMuted | ( | ) | const |
Returns true if the recording audio stream is muted. The property is called muted.
|
overridevirtual |
Returns the QMediaObject instance this QMediaRecorder is bound too, otherwise nullptr.
Implements QMediaBindableInterface::mediaObject()
Returns the value associated with a metadata key.
|
signal |
Signals that the available state of a media object's metadata has changed.
|
signal |
Signals that a media object's metadata has changed.
If multiple metadata 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 metadata element value with the given key.
|
signal |
Signals that the writable state of a media object's metadata has changed.
|
signal |
Signals that the muted state has changed. If true the recording is being muted.
QUrl QMediaRecorder::outputLocation | ( | ) | const |
Returns the current value of the outputLocation property.
|
slot |
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.
|
slot |
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.
void QMediaRecorder::setAudioSettings | ( | const QAudioEncoderSettings & | audioSettings | ) |
Sets the audio encoder to the given audioSettings.
If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties. It is only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
void QMediaRecorder::setContainerFormat | ( | const QString & | format | ) |
Sets the media container to the given format.
If the container format is not specified, the encoder will choose format, depending on media source properties and encoding settings selected. It is only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
void QMediaRecorder::setEncodingSettings | ( | const QAudioEncoderSettings & | audioSettings, |
const QVideoEncoderSettings & | videoSettings = QVideoEncoderSettings() , |
||
const QString & | mimeType = QString() |
||
) |
Sets the audioSettings, videoSettings, and mimeType 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 is only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
|
overrideprotectedvirtual |
Attaches to the media object. Returns true if attached successfully, otherwise returns false.
Implements QMediaBindableInterface::setMediaObject()
Sets a value for a metadata key.
To ensure that metadata is set correctly, it should be set before starting the recording. Once the recording is stopped, any metadata set will be attached to the next recording.
|
slot |
Sets the current value of the muted property to muted.
bool QMediaRecorder::setOutputLocation | ( | const QUrl & | location | ) |
Sets the current value of the outputLocation property to location.
void QMediaRecorder::setVideoSettings | ( | const QVideoEncoderSettings & | videoSettings | ) |
Sets the video encoder videoSettings.
If some parameters are not specified, or null settings are passed, the encoder will choose default encoding parameters, depending on media source properties. It is only possible to change settings when the encoder is in the QMediaEncoder::StoppedState state.
|
slot |
Sets the current value of the volume property to volume.
QMediaRecorder::State QMediaRecorder::state | ( | ) | const |
Returns the current media recorder state.
|
signal |
Signals the media recorder state has changed.
QMediaRecorder::Status QMediaRecorder::status | ( | ) | const |
Returns the current media recorder status.
|
signal |
Signals that the media recorder's status has changed.
|
slot |
Stop recording. The recorder state property is changed to the enum value of QMediaRecorder::StoppedState.
QStringList QMediaRecorder::supportedAudioCodecs | ( | ) | const |
Returns a list of supported audio codecs.
QList< int > QMediaRecorder::supportedAudioSampleRates | ( | const QAudioEncoderSettings & | settings = QAudioEncoderSettings() , |
bool * | continuous = nullptr |
||
) | const |
Returns a list of supported audio sample rates.
If the settings parameter is not null, 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 it is set to false.
QStringList QMediaRecorder::supportedContainers | ( | ) | const |
Returns a list of supported container formats.
QList< qreal > QMediaRecorder::supportedFrameRates | ( | const QVideoEncoderSettings & | settings = QVideoEncoderSettings() , |
bool * | continuous = nullptr |
||
) | const |
Returns a list of frame rates video can be encoded at.
If the settings parameter is not null, 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 it is set to false.
QList< QSize > QMediaRecorder::supportedResolutions | ( | const QVideoEncoderSettings & | settings = QVideoEncoderSettings() , |
bool * | continuous = nullptr |
||
) | const |
Returns a list of resolutions video can be encoded at.
If the settings parameter is not null, 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 it is set to false.
QStringList QMediaRecorder::supportedVideoCodecs | ( | ) | const |
Returns a list of supported video codecs.
Returns a description of a video codecName.
QVideoEncoderSettings QMediaRecorder::videoSettings | ( | ) | const |
Returns the video encoder settings being used.
|
signal |
Signals that the media recorder volume has changed.
|
The actual location is usually available after recording starts, and reset when new location is set or new recording starts.
Properties | Class Methods |
---|---|
read | actualLocation |
notify | actualLocationChanged |
|
The property stores the recorded media duration in milliseconds.
Properties | Class Methods |
---|---|
read | duration |
notify | durationChanged |
|
If this is true there is metadata available, otherwise there is no metadata available.
Properties | Class Methods |
---|---|
read | isMetaDataAvailable |
notify | metaDataAvailableChanged |
|
If this is true the metadata is writable, otherwise the metadata is read only.
Properties | Class Methods |
---|---|
read | isMetaDataWritable |
notify | metaDataWritableChanged |
|
Stores whether a recording audio stream is muted.
Properties | Class Methods |
---|---|
read | isMuted |
write | setMuted |
notify | mutedChanged |
|
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.
Properties | Class Methods |
---|---|
read | outputLocation |
write | setOutputLocation |
|
|
The status is changed asynchronously and represents the actual status of media recorder.
Properties | Class Methods |
---|---|
read | status |
notify | statusChanged |
|
This property stores the linear audio gain of the media recorder.
Properties | Class Methods |
---|---|
read | volume |
write | setVolume |
notify | volumeChanged |