diff options
author | Lev Zelenskiy <lev.zelenskiy@nokia.com> | 2012-06-29 05:52:39 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-03 06:05:39 (GMT) |
commit | a333545518832c606110025ac6e06f6366807db2 (patch) | |
tree | 252da43f86b2d77e551801042d378859eddfe368 /src/multimedia | |
parent | 1c9e5df36946fb0a7554b7f1d55ddfd10778d677 (diff) | |
download | Qt-a333545518832c606110025ac6e06f6366807db2.zip Qt-a333545518832c606110025ac6e06f6366807db2.tar.gz Qt-a333545518832c606110025ac6e06f6366807db2.tar.bz2 |
Added support for big endian data to QAudioOutput win32 backend.
Convert data from big endian to little endian.
QTBUG-19881
Change-Id: Id98c2158ed056dd89fe2656e8f262d4b37f94eb7
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'src/multimedia')
-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 35851a9..e3d1f2f 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 @@ -455,6 +456,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]; |