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 | |
parent | f3a07360dd5a7b8e8b13217b08a952a1584e8101 (diff) | |
download | qtmultimedia-b109f093d9bad84d54d5114735f311762f0eb42a.tar.gz |
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')
-rw-r--r-- | src/plugins/wmf/decoder/mfaudiodecodercontrol.cpp | 25 | ||||
-rw-r--r-- | src/plugins/wmf/player/mfplayersession.cpp | 5 |
2 files changed, 18 insertions, 12 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()); diff --git a/src/plugins/wmf/player/mfplayersession.cpp b/src/plugins/wmf/player/mfplayersession.cpp index 599fa90c7..d6cf07ef4 100644 --- a/src/plugins/wmf/player/mfplayersession.cpp +++ b/src/plugins/wmf/player/mfplayersession.cpp @@ -556,7 +556,10 @@ QAudioFormat MFPlayerSession::audioFormatForMFMediaType(IMFMediaType *mediaType) format.setSampleSize(wfx->wBitsPerSample); format.setCodec("audio/pcm"); format.setByteOrder(QAudioFormat::LittleEndian); - format.setSampleType(QAudioFormat::SignedInt); + if (format.sampleSize() == 8) + format.setSampleType(QAudioFormat::UnSignedInt); + else + format.setSampleType(QAudioFormat::SignedInt); CoTaskMemFree(wfx); return format; |