QOpenSLESEngine::QOpenSLESEngine()
: m_engineObject(0)
, m_engine(0)
+ , m_checkedInputFormats(false)
{
SLresult result;
result = (*m_engineObject)->GetInterface(m_engineObject, SL_IID_ENGINE, &m_engine);
CheckError("Failed to get engine interface");
-
- checkSupportedInputFormats();
}
QOpenSLESEngine::~QOpenSLESEngine()
QList<int> QOpenSLESEngine::supportedChannelCounts(QAudio::Mode mode) const
{
- if (mode == QAudio::AudioInput)
+ if (mode == QAudio::AudioInput) {
+ if (!m_checkedInputFormats)
+ const_cast<QOpenSLESEngine *>(this)->checkSupportedInputFormats();
return m_supportedInputChannelCounts;
- else
+ } else {
return QList<int>() << 1 << 2;
+ }
}
QList<int> QOpenSLESEngine::supportedSampleRates(QAudio::Mode mode) const
{
if (mode == QAudio::AudioInput) {
+ if (!m_checkedInputFormats)
+ const_cast<QOpenSLESEngine *>(this)->checkSupportedInputFormats();
return m_supportedInputSampleRates;
} else {
return QList<int>() << 8000 << 11025 << 12000 << 16000 << 22050
if (inputFormatIsSupported(format))
m_supportedInputChannelCounts.append(2);
}
+
+ m_checkedInputFormats = true;
}
bool QOpenSLESEngine::inputFormatIsSupported(SLDataFormat_PCM format)