Added more encoding settings to declarative camera recorder.

Change-Id: If2ec0297a2db5fedaf27c009fb8d55ccf4254c21
Reviewed-by: Ling Hu <ling.hu@nokia.com>
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Dmytro Poplavskiy
2012-01-31 13:36:36 +10:00
committed by Qt by Nokia
parent a22a0195f1
commit a26bf6c8b6
2 changed files with 96 additions and 1 deletions

View File

@@ -126,6 +126,76 @@ void QDeclarativeCameraRecorder::setMediaContainer(const QString &container)
}
}
qreal QDeclarativeCameraRecorder::frameRate() const
{
return m_videoSettings.frameRate();
}
int QDeclarativeCameraRecorder::videoBitRate() const
{
return m_videoSettings.bitRate();
}
int QDeclarativeCameraRecorder::audioBitRate() const
{
return m_audioSettings.bitRate();
}
int QDeclarativeCameraRecorder::audioChannels() const
{
return m_audioSettings.channelCount();
}
int QDeclarativeCameraRecorder::audioSampleRate() const
{
return m_audioSettings.sampleRate();
}
void QDeclarativeCameraRecorder::setFrameRate(qreal frameRate)
{
if (!qFuzzyCompare(m_videoSettings.frameRate(),frameRate)) {
m_videoSettings.setFrameRate(frameRate);
m_recorder->setVideoSettings(m_videoSettings);
emit frameRateChanged(frameRate);
}
}
void QDeclarativeCameraRecorder::setVideoBitRate(int rate)
{
if (m_videoSettings.bitRate() != rate) {
m_videoSettings.setBitRate(rate);
m_recorder->setVideoSettings(m_videoSettings);
emit videoBitRateChanged(rate);
}
}
void QDeclarativeCameraRecorder::setAudioBitRate(int rate)
{
if (m_audioSettings.bitRate() != rate) {
m_audioSettings.setBitRate(rate);
m_recorder->setAudioSettings(m_audioSettings);
emit audioBitRateChanged(rate);
}
}
void QDeclarativeCameraRecorder::setAudioChannels(int channels)
{
if (m_audioSettings.channelCount() != channels) {
m_audioSettings.setChannelCount(channels);
m_recorder->setAudioSettings(m_audioSettings);
emit audioChannelsChanged(channels);
}
}
void QDeclarativeCameraRecorder::setAudioSampleRate(int rate)
{
if (m_audioSettings.sampleRate() != rate) {
m_audioSettings.setSampleRate(rate);
m_recorder->setAudioSettings(m_audioSettings);
emit audioSampleRateChanged(rate);
}
}
QMediaRecorder::Error QDeclarativeCameraRecorder::error() const
{
return m_recorder->error();

View File

@@ -69,10 +69,17 @@ class QDeclarativeCameraRecorder : public QObject
Q_ENUMS(RecorderState)
Q_PROPERTY(RecorderState recorderState READ recorderState WRITE setRecorderState NOTIFY recorderStateChanged)
Q_PROPERTY(QSize resolution READ captureResolution WRITE setCaptureResolution NOTIFY captureResolutionChanged)
Q_PROPERTY(QString videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged)
Q_PROPERTY(QSize resolution READ captureResolution WRITE setCaptureResolution NOTIFY captureResolutionChanged)
Q_PROPERTY(qreal frameRate READ frameRate WRITE setFrameRate NOTIFY frameRateChanged)
Q_PROPERTY(int videoBitRate READ videoBitRate WRITE setVideoBitRate NOTIFY videoBitRateChanged)
Q_PROPERTY(QString audioCodec READ audioCodec WRITE setAudioCodec NOTIFY audioCodecChanged)
Q_PROPERTY(int audioBitRate READ audioBitRate WRITE setAudioBitRate NOTIFY audioBitRateChanged)
Q_PROPERTY(int audioChannels READ audioChannels WRITE setAudioChannels NOTIFY audioChannelsChanged)
Q_PROPERTY(int audioSampleRate READ audioSampleRate WRITE setAudioSampleRate NOTIFY audioSampleRateChanged)
Q_PROPERTY(QString mediaContainer READ mediaContainer WRITE setMediaContainer NOTIFY mediaContainerChanged)
Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
@@ -104,6 +111,12 @@ public:
QMediaRecorder::Error error() const;
QString errorString() const;
qreal frameRate() const;
int videoBitRate() const;
int audioBitRate() const;
int audioChannels() const;
int audioSampleRate() const;
public Q_SLOTS:
void setOutputLocation(const QUrl &location);
@@ -119,6 +132,12 @@ public Q_SLOTS:
void setVideoCodec(const QString &codec);
void setMediaContainer(const QString &container);
void setFrameRate(qreal frameRate);
void setVideoBitRate(int rate);
void setAudioBitRate(int rate);
void setAudioChannels(int channels);
void setAudioSampleRate(int rate);
Q_SIGNALS:
void recorderStateChanged(QDeclarativeCameraRecorder::RecorderState state);
void durationChanged(qint64 duration);
@@ -136,6 +155,12 @@ Q_SIGNALS:
void videoCodecChanged(const QString &codec);
void mediaContainerChanged(const QString &container);
void frameRateChanged(qreal arg);
void videoBitRateChanged(int arg);
void audioBitRateChanged(int arg);
void audioChannelsChanged(int arg);
void audioSampleRateChanged(int arg);
private slots:
void updateRecorderState(QMediaRecorder::State);
void updateRecorderError(QMediaRecorder::Error);