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>
This commit is contained in:
committed by
Qt by Nokia
parent
1cf5f3e729
commit
4ebedcd158
@@ -51,6 +51,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "qaudiooutput_win32_p.h"
|
#include "qaudiooutput_win32_p.h"
|
||||||
|
#include <QtEndian>
|
||||||
|
|
||||||
#ifndef SPEAKER_FRONT_LEFT
|
#ifndef SPEAKER_FRONT_LEFT
|
||||||
#define SPEAKER_FRONT_LEFT 0x00000001
|
#define SPEAKER_FRONT_LEFT 0x00000001
|
||||||
@@ -466,6 +467,30 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
|
|||||||
char* p = (char*)data;
|
char* p = (char*)data;
|
||||||
int l = (int)len;
|
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;
|
WAVEHDR* current;
|
||||||
int remain;
|
int remain;
|
||||||
current = &waveBlocks[waveCurrentBlock];
|
current = &waveBlocks[waveCurrentBlock];
|
||||||
|
|||||||
Reference in New Issue
Block a user