Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	tests/auto/unit/qaudioformat/tst_qaudioformat.cpp

Change-Id: I8499473569df9eac8c7069160e42ed477dacad4d
This commit is contained in:
Frederik Gladhorn
2014-04-11 14:21:32 +02:00
48 changed files with 690 additions and 405 deletions

View File

@@ -166,6 +166,8 @@ void QWaveDecoder::handleData()
// Swizzle this
if (bigEndian) {
wave.audioFormat = qFromBigEndian<quint16>(wave.audioFormat);
} else {
wave.audioFormat = qFromLittleEndian<quint16>(wave.audioFormat);
}
if (wave.audioFormat != 0 && wave.audioFormat != 1) {
@@ -207,6 +209,8 @@ void QWaveDecoder::handleData()
source->read(reinterpret_cast<char *>(&descriptor), sizeof(chunk));
if (bigEndian)
descriptor.size = qFromBigEndian<quint32>(descriptor.size);
else
descriptor.size = qFromLittleEndian<quint32>(descriptor.size);
dataSize = descriptor.size;
@@ -227,13 +231,15 @@ void QWaveDecoder::handleData()
bool QWaveDecoder::enoughDataAvailable()
{
chunk descriptor;
if (!peekChunk(&descriptor))
if (!peekChunk(&descriptor, false))
return false;
// This is only called for the RIFF/RIFX header, before bigEndian is set,
// so we have to manually swizzle
if (qstrncmp(descriptor.id, "RIFX", 4) == 0)
descriptor.size = qFromBigEndian<quint32>(descriptor.size);
if (qstrncmp(descriptor.id, "RIFF", 4) == 0)
descriptor.size = qFromLittleEndian<quint32>(descriptor.size);
if (source->bytesAvailable() < qint64(sizeof(chunk) + descriptor.size))
return false;
@@ -270,16 +276,18 @@ bool QWaveDecoder::findChunk(const char *chunkId)
return false;
}
// Handles endianness
bool QWaveDecoder::peekChunk(chunk *pChunk)
bool QWaveDecoder::peekChunk(chunk *pChunk, bool handleEndianness)
{
if (source->bytesAvailable() < qint64(sizeof(chunk)))
return false;
source->peek(reinterpret_cast<char *>(pChunk), sizeof(chunk));
if (bigEndian)
pChunk->size = qFromBigEndian<quint32>(pChunk->size);
if (handleEndianness) {
if (bigEndian)
pChunk->size = qFromBigEndian<quint32>(pChunk->size);
else
pChunk->size = qFromLittleEndian<quint32>(pChunk->size);
}
return true;
}

View File

@@ -103,7 +103,7 @@ private:
char id[4];
quint32 size;
};
bool peekChunk(chunk* pChunk);
bool peekChunk(chunk* pChunk, bool handleEndianness = true);
struct RIFFHeader
{

View File

@@ -43,7 +43,7 @@ sourcedirs += ../..
excludedirs += ../../multimediawidgets
depends += qtcore qtdoc qtquick qtqml qtmultimediawidgets
depends += qtcore qtdoc qtgui qtquick qtqml qtmultimediawidgets qtwidgets
navigation.landingpage = "Qt Multimedia"
navigation.cppclassespage = "Qt Multimedia C++ Classes"

View File

@@ -1,6 +1,12 @@
TARGET = QtMultimedia
QT = core-private network gui-private
MODULE_PLUGIN_TYPES = \
mediaservice \
audio \
video/videonode \
playlistformats
QMAKE_DOCS = $$PWD/doc/qtmultimedia.qdocconf
load(qt_module)
@@ -67,11 +73,6 @@ ANDROID_FEATURES += \
android.hardware.camera \
android.hardware.camera.autofocus \
android.hardware.microphone
MODULE_PLUGIN_TYPES = \
mediaservice \
audio \
video/videonode \
playlistformats
win32: LIBS_PRIVATE += -luuid