Expose the audio and video encoding modes through QML as well.
They were missing. Change-Id: I0bb08c5e4721c27d2dcec818c0ee33f42c8df959 Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
c9b3f247c7
commit
b33b0d9d1d
@@ -60,6 +60,15 @@ QT_BEGIN_NAMESPACE
|
||||
\l {Camera::videoRecorder}{videoRecorder} property) and cannot be created
|
||||
directly.
|
||||
|
||||
\qml
|
||||
Camera {
|
||||
videoRecorder.audioEncodingMode: CameraRecorder.ConstantBitrateEncoding;
|
||||
videoRecorder.audioBitRate: 128000
|
||||
videoRecorder.mediaContainer: "mp4"
|
||||
// ...
|
||||
}
|
||||
\endqml
|
||||
|
||||
There are many different settings for each part of the recording process (audio,
|
||||
video, and output formats), as well as control over muting and where to store
|
||||
the output file.
|
||||
@@ -224,6 +233,53 @@ int QDeclarativeCameraRecorder::audioSampleRate() const
|
||||
return m_audioSettings.sampleRate();
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlproperty enumeration QtMultimedia5::CameraRecorder::videoEncodingMode
|
||||
|
||||
The type of encoding method to use when recording audio.
|
||||
|
||||
\table
|
||||
\header \o Value \o Description
|
||||
\row \o ConstantQualityEncoding
|
||||
\o Encoding will aim to have a constant quality, adjusting bitrate to fit.
|
||||
This is the default. The bitrate setting will be ignored.
|
||||
\row \o ConstantBitRateEncoding
|
||||
\o Encoding will use a constant bit rate, adjust quality to fit. This is
|
||||
appropriate if you are trying to optimize for space.
|
||||
\row \o AverageBitRateEncoding
|
||||
\o Encoding will try to keep an average bitrate setting, but will use
|
||||
more or less as needed.
|
||||
\endtable
|
||||
|
||||
*/
|
||||
QDeclarativeCameraRecorder::EncodingMode QDeclarativeCameraRecorder::videoEncodingMode() const
|
||||
{
|
||||
return EncodingMode(m_videoSettings.encodingMode());
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlproperty enumeration QtMultimedia5::CameraRecorder::audioEncodingMode
|
||||
|
||||
The type of encoding method to use when recording audio.
|
||||
|
||||
\table
|
||||
\header \o Value \o Description
|
||||
\row \o ConstantQualityEncoding
|
||||
\o Encoding will aim to have a constant quality, adjusting bitrate to fit.
|
||||
This is the default. The bitrate setting will be ignored.
|
||||
\row \o ConstantBitRateEncoding
|
||||
\o Encoding will use a constant bit rate, adjust quality to fit. This is
|
||||
appropriate if you are trying to optimize for space.
|
||||
\row \o AverageBitRateEncoding
|
||||
\o Encoding will try to keep an average bitrate setting, but will use
|
||||
more or less as needed.
|
||||
\endtable
|
||||
*/
|
||||
QDeclarativeCameraRecorder::EncodingMode QDeclarativeCameraRecorder::audioEncodingMode() const
|
||||
{
|
||||
return EncodingMode(m_audioSettings.encodingMode());
|
||||
}
|
||||
|
||||
void QDeclarativeCameraRecorder::setFrameRate(qreal frameRate)
|
||||
{
|
||||
if (!qFuzzyCompare(m_videoSettings.frameRate(),frameRate)) {
|
||||
@@ -269,6 +325,24 @@ void QDeclarativeCameraRecorder::setAudioSampleRate(int rate)
|
||||
}
|
||||
}
|
||||
|
||||
void QDeclarativeCameraRecorder::setAudioEncodingMode(QDeclarativeCameraRecorder::EncodingMode encodingMode)
|
||||
{
|
||||
if (m_audioSettings.encodingMode() != QtMultimedia::EncodingMode(encodingMode)) {
|
||||
m_audioSettings.setEncodingMode(QtMultimedia::EncodingMode(encodingMode));
|
||||
m_recorder->setAudioSettings(m_audioSettings);
|
||||
emit audioEncodingModeChanged(encodingMode);
|
||||
}
|
||||
}
|
||||
|
||||
void QDeclarativeCameraRecorder::setVideoEncodingMode(QDeclarativeCameraRecorder::EncodingMode encodingMode)
|
||||
{
|
||||
if (m_videoSettings.encodingMode() != QtMultimedia::EncodingMode(encodingMode)) {
|
||||
m_videoSettings.setEncodingMode(QtMultimedia::EncodingMode(encodingMode));
|
||||
m_recorder->setVideoSettings(m_videoSettings);
|
||||
emit videoEncodingModeChanged(encodingMode);
|
||||
}
|
||||
}
|
||||
|
||||
// XXX todo
|
||||
QMediaRecorder::Error QDeclarativeCameraRecorder::error() const
|
||||
{
|
||||
|
||||
@@ -67,6 +67,7 @@ class QDeclarativeCameraRecorder : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(RecorderState)
|
||||
Q_ENUMS(EncodingMode)
|
||||
|
||||
Q_PROPERTY(RecorderState recorderState READ recorderState WRITE setRecorderState NOTIFY recorderStateChanged)
|
||||
|
||||
@@ -74,11 +75,13 @@ class QDeclarativeCameraRecorder : public QObject
|
||||
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(EncodingMode videoEncodingMode READ videoEncodingMode WRITE setVideoEncodingMode NOTIFY videoEncodingModeChanged)
|
||||
|
||||
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(EncodingMode audioEncodingMode READ audioEncodingMode WRITE setAudioEncodingMode NOTIFY audioEncodingModeChanged)
|
||||
|
||||
Q_PROPERTY(QString mediaContainer READ mediaContainer WRITE setMediaContainer NOTIFY mediaContainerChanged)
|
||||
|
||||
@@ -95,6 +98,13 @@ public:
|
||||
RecordingState = QMediaRecorder::RecordingState
|
||||
};
|
||||
|
||||
enum EncodingMode
|
||||
{
|
||||
ConstantQualityEncoding = QtMultimedia::ConstantQualityEncoding,
|
||||
ConstantBitRateEncoding = QtMultimedia::ConstantBitRateEncoding,
|
||||
AverageBitRateEncoding = QtMultimedia::AverageBitRateEncoding
|
||||
};
|
||||
|
||||
~QDeclarativeCameraRecorder();
|
||||
|
||||
RecorderState recorderState() const;
|
||||
@@ -120,6 +130,9 @@ public:
|
||||
int audioChannels() const;
|
||||
int audioSampleRate() const;
|
||||
|
||||
EncodingMode videoEncodingMode() const;
|
||||
EncodingMode audioEncodingMode() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setOutputLocation(const QString &location);
|
||||
|
||||
@@ -141,6 +154,9 @@ public Q_SLOTS:
|
||||
void setAudioChannels(int channels);
|
||||
void setAudioSampleRate(int rate);
|
||||
|
||||
void setVideoEncodingMode(EncodingMode encodingMode);
|
||||
void setAudioEncodingMode(EncodingMode encodingMode);
|
||||
|
||||
Q_SIGNALS:
|
||||
void recorderStateChanged(QDeclarativeCameraRecorder::RecorderState state);
|
||||
void durationChanged(qint64 duration);
|
||||
@@ -163,6 +179,9 @@ Q_SIGNALS:
|
||||
void audioChannelsChanged(int arg);
|
||||
void audioSampleRateChanged(int arg);
|
||||
|
||||
void audioEncodingModeChanged(EncodingMode encodingMode);
|
||||
void videoEncodingModeChanged(EncodingMode encodingMode);
|
||||
|
||||
private slots:
|
||||
void updateRecorderState(QMediaRecorder::State);
|
||||
void updateRecorderError(QMediaRecorder::Error);
|
||||
|
||||
Reference in New Issue
Block a user