Delete obsolete class methods and update related code
Delete obsolete methods from QAudioFormat and QAudioDeviceInfo and update code that relied on the obsolete methods. Change-Id: I007e36375a45399b1d5a289341bc5d5a05dc68cc Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
952bd004be
commit
53fdcca366
@@ -56,8 +56,8 @@ AudioCaptureSession::AudioCaptureSession(QObject *parent):
|
||||
m_position = 0;
|
||||
m_state = QMediaRecorder::StoppedState;
|
||||
|
||||
m_format.setFrequency(8000);
|
||||
m_format.setChannels(1);
|
||||
m_format.setSampleRate(8000);
|
||||
m_format.setChannelCount(1);
|
||||
m_format.setSampleSize(8);
|
||||
m_format.setSampleType(QAudioFormat::UnSignedInt);
|
||||
m_format.setCodec("audio/pcm");
|
||||
@@ -264,10 +264,10 @@ void AudioCaptureSession::record()
|
||||
memcpy(header.wave.descriptor.id,"fmt ",4);
|
||||
header.wave.descriptor.size = 16;
|
||||
header.wave.audioFormat = 1; // for PCM data
|
||||
header.wave.numChannels = m_format.channels();
|
||||
header.wave.sampleRate = m_format.frequency();
|
||||
header.wave.byteRate = m_format.frequency()*m_format.channels()*m_format.sampleSize()/8;
|
||||
header.wave.blockAlign = m_format.channels()*m_format.sampleSize()/8;
|
||||
header.wave.numChannels = m_format.channelCount();
|
||||
header.wave.sampleRate = m_format.sampleRate();
|
||||
header.wave.byteRate = m_format.sampleRate()*m_format.channelCount()*m_format.sampleSize()/8;
|
||||
header.wave.blockAlign = m_format.channelCount()*m_format.sampleSize()/8;
|
||||
header.wave.bitsPerSample = m_format.sampleSize();
|
||||
memcpy(header.data.descriptor.id,"data",4);
|
||||
header.data.descriptor.size = 0xFFFFFFFF; // This should be updated on stop(),samples*channels*sampleSize/8
|
||||
|
||||
@@ -53,8 +53,8 @@ AudioEncoderControl::AudioEncoderControl(QObject *parent)
|
||||
|
||||
QT_PREPEND_NAMESPACE(QAudioFormat) fmt;
|
||||
fmt.setSampleSize(8);
|
||||
fmt.setChannels(1);
|
||||
fmt.setFrequency(8000);
|
||||
fmt.setChannelCount(1);
|
||||
fmt.setSampleRate(8000);
|
||||
fmt.setSampleType(QT_PREPEND_NAMESPACE(QAudioFormat)::SignedInt);
|
||||
fmt.setCodec("audio/pcm");
|
||||
fmt.setByteOrder(QAudioFormat::LittleEndian);
|
||||
@@ -94,7 +94,7 @@ QList<int> AudioEncoderControl::supportedSampleRates(const QAudioEncoderSettings
|
||||
if (continuous)
|
||||
*continuous = false;
|
||||
|
||||
return m_session->deviceInfo()->supportedFrequencies();
|
||||
return m_session->deviceInfo()->supportedSampleRates();
|
||||
}
|
||||
|
||||
QAudioEncoderSettings AudioEncoderControl::audioSettings() const
|
||||
@@ -109,26 +109,26 @@ void AudioEncoderControl::setAudioSettings(const QAudioEncoderSettings &settings
|
||||
if (settings.encodingMode() == QtMultimedia::ConstantQualityEncoding) {
|
||||
if (settings.quality() == QtMultimedia::LowQuality) {
|
||||
fmt.setSampleSize(8);
|
||||
fmt.setChannels(1);
|
||||
fmt.setFrequency(8000);
|
||||
fmt.setChannelCount(1);
|
||||
fmt.setSampleRate(8000);
|
||||
fmt.setSampleType(QAudioFormat::UnSignedInt);
|
||||
|
||||
} else if (settings.quality() == QtMultimedia::NormalQuality) {
|
||||
fmt.setSampleSize(16);
|
||||
fmt.setChannels(1);
|
||||
fmt.setFrequency(22050);
|
||||
fmt.setChannelCount(1);
|
||||
fmt.setSampleRate(22050);
|
||||
fmt.setSampleType(QAudioFormat::SignedInt);
|
||||
|
||||
} else {
|
||||
fmt.setSampleSize(16);
|
||||
fmt.setChannels(1);
|
||||
fmt.setFrequency(44100);
|
||||
fmt.setChannelCount(1);
|
||||
fmt.setSampleRate(44100);
|
||||
fmt.setSampleType(QAudioFormat::SignedInt);
|
||||
}
|
||||
|
||||
} else {
|
||||
fmt.setChannels(settings.channelCount());
|
||||
fmt.setFrequency(settings.sampleRate());
|
||||
fmt.setChannelCount(settings.channelCount());
|
||||
fmt.setSampleRate(settings.sampleRate());
|
||||
if (settings.sampleRate() == 8000 && settings.bitRate() == 8000) {
|
||||
fmt.setSampleType(QAudioFormat::UnSignedInt);
|
||||
fmt.setSampleSize(8);
|
||||
|
||||
Reference in New Issue
Block a user