diff options
author | Lev Zelenskiy <lev.zelenskiy@nokia.com> | 2012-06-26 14:03:54 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-26 09:13:30 +0200 |
commit | 4ebedcd1581129bfa69fc78e50d4d6ffdbb439cd (patch) | |
tree | 23a1f33bba4565df7eeb562e3af34824c5763d0f /src | |
parent | 1cf5f3e729603ade3f7758bdf03a0efeaedcc8e3 (diff) | |
download | qtmultimedia-4ebedcd1581129bfa69fc78e50d4d6ffdbb439cd.tar.gz |
Added support for big endian data to QAudioOutput win32 backend.
Convert data from big endian to little endian.
QTBUG-19881
Change-Id: If62a69b79c01d66536010b3326a86df8ca5f83b0
Reviewed-by: Ling Hu <ling.hu@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/multimedia/audio/qaudiooutput_win32_p.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 7592643f4..a189ddd0f 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -51,6 +51,7 @@ // #include "qaudiooutput_win32_p.h" +#include <QtEndian> #ifndef SPEAKER_FRONT_LEFT #define SPEAKER_FRONT_LEFT 0x00000001 @@ -466,6 +467,30 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) char* p = (char*)data; int l = (int)len; + QByteArray reverse; + if (settings.byteOrder() == QAudioFormat::BigEndian) { + + switch (settings.sampleSize()) { + case 8: + // No need to convert + break; + + case 16: + reverse.resize(l); + for (qint64 i = 0; i < (l >> 1); i++) + *((qint16*)reverse.data() + i) = qFromBigEndian(*((qint16*)data + i)); + p = reverse.data(); + break; + + case 32: + reverse.resize(l); + for (qint64 i = 0; i < (l >> 2); i++) + *((qint32*)reverse.data() + i) = qFromBigEndian(*((qint32*)data + i)); + p = reverse.data(); + break; + } + } + WAVEHDR* current; int remain; current = &waveBlocks[waveCurrentBlock]; |