summaryrefslogtreecommitdiffstats
path: root/src/multimedia/recording/qmediarecorder.cpp
diff options
context:
space:
mode:
authorDmytro Poplavskiy <dmytro.poplavskiy@nokia.com>2012-05-01 13:10:33 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-02 03:15:01 +0200
commitb7935a84d71b479f5320e5b062274d344835ba26 (patch)
treee72ac1774590d91f621ed9b21cf0c0ab2c87903b /src/multimedia/recording/qmediarecorder.cpp
parentaf932e8653b024c93ed49ba30d6f06839ecfced6 (diff)
Added QMediaRecorder::status property
QMediaRecorder::state property represents the user request and changed synchronously during record(), pause() or stop() calls. Recorder status is changed asynchronously and represents the actual status of media recorder. This also makes API more consistent with QMediaPlayer and QCamera. Change-Id: I80b4aaa70bb88e555c492908da8c29d0fc5ed5ea Reviewed-by: Ling Hu <ling.hu@nokia.com>
Diffstat (limited to 'src/multimedia/recording/qmediarecorder.cpp')
-rw-r--r--src/multimedia/recording/qmediarecorder.cpp74
1 files changed, 70 insertions, 4 deletions
diff --git a/src/multimedia/recording/qmediarecorder.cpp b/src/multimedia/recording/qmediarecorder.cpp
index 78d518b7b..82f5133a0 100644
--- a/src/multimedia/recording/qmediarecorder.cpp
+++ b/src/multimedia/recording/qmediarecorder.cpp
@@ -88,6 +88,7 @@ public:
MediaRecorderRegisterMetaTypes()
{
qRegisterMetaType<QMediaRecorder::State>("QMediaRecorder::State");
+ qRegisterMetaType<QMediaRecorder::State>("QMediaRecorder::Status");
qRegisterMetaType<QMediaRecorder::Error>("QMediaRecorder::Error");
}
} _registerRecorderMetaTypes;
@@ -278,6 +279,9 @@ bool QMediaRecorder::setMediaObject(QMediaObject *object)
disconnect(d->control, SIGNAL(stateChanged(QMediaRecorder::State)),
this, SLOT(_q_stateChanged(QMediaRecorder::State)));
+ disconnect(d->control, SIGNAL(statusChanged(QMediaRecorder::Status)),
+ this, SIGNAL(statusChanged(QMediaRecorder::Status)));
+
disconnect(d->control, SIGNAL(mutedChanged(bool)),
this, SIGNAL(mutedChanged(bool)));
@@ -378,6 +382,9 @@ bool QMediaRecorder::setMediaObject(QMediaObject *object)
connect(d->control, SIGNAL(stateChanged(QMediaRecorder::State)),
this, SLOT(_q_stateChanged(QMediaRecorder::State)));
+ connect(d->control, SIGNAL(statusChanged(QMediaRecorder::Status)),
+ this, SIGNAL(statusChanged(QMediaRecorder::Status)));
+
connect(d->control, SIGNAL(mutedChanged(bool)),
this, SIGNAL(mutedChanged(bool)));
@@ -483,6 +490,17 @@ QMediaRecorder::State QMediaRecorder::state() const
}
/*!
+ Returns the current media recorder status.
+
+ \sa QMediaRecorder::Status
+*/
+
+QMediaRecorder::Status QMediaRecorder::status() const
+{
+ return d_func()->control ? QMediaRecorder::Status(d_func()->control->status()) : UnavailableStatus;
+}
+
+/*!
Returns the current error state.
\sa errorString()
@@ -801,9 +819,12 @@ void QMediaRecorder::setEncodingSettings(const QAudioEncoderSettings &audio,
/*!
Start recording.
- This is an asynchronous call, with signal
- stateChanged(QMediaRecorder::RecordingState) being emitted when recording
- started, otherwise the error() signal is emitted.
+ 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::record()
@@ -825,6 +846,11 @@ void QMediaRecorder::record()
/*!
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.
*/
void QMediaRecorder::pause()
@@ -836,6 +862,8 @@ void QMediaRecorder::pause()
/*!
Stop recording.
+
+ The recorder state is changed to QMediaRecorder::StoppedState.
*/
void QMediaRecorder::stop()
@@ -849,11 +877,32 @@ void QMediaRecorder::stop()
\enum QMediaRecorder::State
\value StoppedState The recorder is not active.
- \value RecordingState The recorder is currently active and producing data.
+ \value RecordingState The recording is requested.
\value PausedState The recorder is paused.
*/
/*!
+ \enum QMediaRecorder::Status
+
+ \value UnavailableStatus
+ The recorder is not available or not supported by connected media object.
+ \value UnloadedStatus
+ The recorder is avilable but not loaded.
+ \value LoadingStatus
+ The recorder is initializing.
+ \value LoadedStatus
+ The recorder is initialized and ready to record media.
+ \value StartingStatus
+ Recording is requested but not active yet.
+ \value RecordingStatus
+ Recording is active.
+ \value PausedStatus
+ Recording is paused.
+ \value FinalizingStatus
+ Recording is stopped with media being finalized.
+*/
+
+/*!
\enum QMediaRecorder::Error
\value NoError No Errors.
@@ -862,6 +911,23 @@ void QMediaRecorder::stop()
*/
/*!
+ \property QMediaRecorder::state
+ \brief 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.
+*/
+
+/*!
+ \property QMediaRecorder::status
+ \brief The current status of the media recorder.
+
+ The status is changed asynchronously and represents the actual status
+ of media recorder.
+*/
+
+/*!
\fn QMediaRecorder::stateChanged(State state)
Signals that a media recorder's \a state has changed.