Added volume property to QMediaRecorder

Change-Id: I19f727107651c9f640ca1c010a3764f05aef8820
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Dmytro Poplavskiy
2012-05-21 12:09:50 +10:00
committed by Qt by Nokia
parent 0d0e89b1e8
commit 36ff2fe85e
14 changed files with 147 additions and 4 deletions

View File

@@ -285,6 +285,9 @@ bool QMediaRecorder::setMediaObject(QMediaObject *object)
disconnect(d->control, SIGNAL(mutedChanged(bool)),
this, SIGNAL(mutedChanged(bool)));
disconnect(d->control, SIGNAL(volumeChanged(qreal)),
this, SIGNAL(volumeChanged(qreal)));
disconnect(d->control, SIGNAL(durationChanged(qint64)),
this, SIGNAL(durationChanged(qint64)));
@@ -388,6 +391,9 @@ bool QMediaRecorder::setMediaObject(QMediaObject *object)
connect(d->control, SIGNAL(mutedChanged(bool)),
this, SIGNAL(mutedChanged(bool)));
connect(d->control, SIGNAL(volumeChanged(qreal)),
this, SIGNAL(volumeChanged(qreal)));
connect(d->control, SIGNAL(durationChanged(qint64)),
this, SIGNAL(durationChanged(qint64)));
@@ -552,6 +558,26 @@ void QMediaRecorder::setMuted(bool muted)
d->control->setMuted(muted);
}
/*!
\property QMediaRecorder::volume
\brief the linear audio gain of media recorder.
*/
qreal QMediaRecorder::volume() const
{
return d_func()->control ? d_func()->control->volume() : 1.0;
}
void QMediaRecorder::setVolume(qreal volume)
{
Q_D(QMediaRecorder);
if (d->control)
d->control->setVolume(volume);
}
/*!
Returns a list of supported container formats.
*/

View File

@@ -81,6 +81,7 @@ class Q_MULTIMEDIA_EXPORT QMediaRecorder : public QObject, public QMediaBindable
Q_PROPERTY(QUrl outputLocation READ outputLocation WRITE setOutputLocation)
Q_PROPERTY(QUrl actualLocation READ actualLocation NOTIFY actualLocationChanged)
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
Q_PROPERTY(bool metaDataAvailable READ isMetaDataAvailable NOTIFY metaDataAvailableChanged)
Q_PROPERTY(bool metaDataWritable READ isMetaDataWritable NOTIFY metaDataWritableChanged)
public:
@@ -133,6 +134,7 @@ public:
qint64 duration() const;
bool isMuted() const;
qreal volume() const;
QStringList supportedContainers() const;
QString containerDescription(const QString &format) const;
@@ -176,12 +178,14 @@ public Q_SLOTS:
void pause();
void stop();
void setMuted(bool muted);
void setVolume(qreal volume);
Q_SIGNALS:
void stateChanged(QMediaRecorder::State state);
void statusChanged(QMediaRecorder::Status status);
void durationChanged(qint64 duration);
void mutedChanged(bool muted);
void volumeChanged(qreal volume);
void actualLocationChanged(const QUrl &location);
void error(QMediaRecorder::Error error);