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

@@ -159,6 +159,17 @@ QMediaRecorderControl::~QMediaRecorderControl()
Sets the \a muted state of a media recorder.
*/
/*!
\fn qreal QMediaRecorderControl::volume() const
Returns the linear audio gain of media recorder.
*/
/*!
\fn void QMediaRecorderControl::setVolume(qreal gain)
Sets the linear audio \a gain of a media recorder.
*/
/*!
\fn void QMediaRecorderControl::stateChanged(QMediaRecorder::State state)
@@ -187,6 +198,12 @@ QMediaRecorderControl::~QMediaRecorderControl()
Signals that the \a muted state of a media recorder has changed.
*/
/*!
\fn void QMediaRecorderControl::volume(qreal gain)
Signals that the audio \a gain value has changed.
*/
/*!
\fn void QMediaRecorderControl::actualLocationChanged(const QUrl &location)

View File

@@ -75,6 +75,7 @@ public:
virtual qint64 duration() const = 0;
virtual bool isMuted() const = 0;
virtual qreal volume() const = 0;
virtual void applySettings() = 0;
@@ -83,12 +84,14 @@ Q_SIGNALS:
void statusChanged(QMediaRecorder::Status status);
void durationChanged(qint64 position);
void mutedChanged(bool muted);
void volumeChanged(qreal volume);
void actualLocationChanged(const QUrl &location);
void error(int error, const QString &errorString);
public Q_SLOTS:
virtual void setState(QMediaRecorder::State state) = 0;
virtual void setMuted(bool muted) = 0;
virtual void setVolume(qreal volume) = 0;
protected:
QMediaRecorderControl(QObject* parent = 0);

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);