diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-04-14 13:42:46 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-04-14 14:30:16 +0000 |
commit | b109f093d9bad84d54d5114735f311762f0eb42a (patch) | |
tree | 8d73fc6b4168116d97c13790febf8da7a58ab230 /src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp | |
parent | f3a07360dd5a7b8e8b13217b08a952a1584e8101 (diff) |
WMF: fix reported sample type of 8-bit audio formats.
Always report 8-bit PCM data as unsigned integer. Even though there's
no API to actually know that, it's standard on Windows. 8-bit is
unsigned and 16-bit is signed.
Task-number: QTBUG-45540
Change-Id: I4a3c09084de688ea7afc3bc147508184fb582224
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
Diffstat (limited to 'src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp')
-rw-r--r-- | src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp b/src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp index da69f926f..ff093e95a 100644 --- a/src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp +++ b/src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp @@ -193,17 +193,6 @@ void MFAudioDecoderControl::handleMediaSourceReady() if (mediaType) { m_sourceOutputFormat = m_audioFormat; QAudioFormat af = m_audioFormat; - GUID subType; - if (SUCCEEDED(mediaType->GetGUID(MF_MT_SUBTYPE, &subType))) { - if (subType == MFAudioFormat_Float) { - m_sourceOutputFormat.setSampleType(QAudioFormat::Float); - } else { - m_sourceOutputFormat.setSampleType(QAudioFormat::SignedInt); - } - } - if (m_sourceOutputFormat.sampleType() != QAudioFormat::Float) { - m_sourceOutputFormat.setByteOrder(QAudioFormat::LittleEndian); - } UINT32 val = 0; if (SUCCEEDED(mediaType->GetUINT32(MF_MT_AUDIO_NUM_CHANNELS, &val))) { @@ -216,6 +205,20 @@ void MFAudioDecoderControl::handleMediaSourceReady() m_sourceOutputFormat.setSampleSize(int(val)); } + GUID subType; + if (SUCCEEDED(mediaType->GetGUID(MF_MT_SUBTYPE, &subType))) { + if (subType == MFAudioFormat_Float) { + m_sourceOutputFormat.setSampleType(QAudioFormat::Float); + } else if (m_sourceOutputFormat.sampleSize() == 8) { + m_sourceOutputFormat.setSampleType(QAudioFormat::UnSignedInt); + } else { + m_sourceOutputFormat.setSampleType(QAudioFormat::SignedInt); + } + } + if (m_sourceOutputFormat.sampleType() != QAudioFormat::Float) { + m_sourceOutputFormat.setByteOrder(QAudioFormat::LittleEndian); + } + if (m_audioFormat.sampleType() != QAudioFormat::Float && m_audioFormat.sampleType() != QAudioFormat::SignedInt) { af.setSampleType(m_sourceOutputFormat.sampleType()); |