From b82ed43086aebb4698a8a52965eeb17349ef1d04 Mon Sep 17 00:00:00 2001
From: Justin McPherson <justin.mcpherson@nokia.com>
Date: Mon, 21 Jun 2010 15:11:59 +1000
Subject: [PATCH] Audio(osx); Fix audio format converters.
Reviewed-by:Dmytro Poplavskiy
---
src/multimedia/audio/qaudio_mac.cpp | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp
index 14fee8b..4e17b52 100644
|
|
QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf) |
68 | 68 | audioFormat.setChannels(sf.mChannelsPerFrame); |
69 | 69 | audioFormat.setSampleSize(sf.mBitsPerChannel); |
70 | 70 | audioFormat.setCodec(QString::fromLatin1("audio/pcm")); |
71 | | audioFormat.setByteOrder(sf.mFormatFlags & kLinearPCMFormatFlagIsBigEndian != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian); |
| 71 | audioFormat.setByteOrder((sf.mFormatFlags & kAudioFormatFlagIsBigEndian) != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian); |
72 | 72 | QAudioFormat::SampleType type = QAudioFormat::UnSignedInt; |
73 | | if ((sf.mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) != 0) |
| 73 | if ((sf.mFormatFlags & kAudioFormatFlagIsSignedInteger) != 0) |
74 | 74 | type = QAudioFormat::SignedInt; |
75 | | else if ((sf.mFormatFlags & kLinearPCMFormatFlagIsFloat) != 0) |
| 75 | else if ((sf.mFormatFlags & kAudioFormatFlagIsFloat) != 0) |
76 | 76 | type = QAudioFormat::Float; |
77 | 77 | audioFormat.setSampleType(type); |
78 | 78 | |
… |
… |
AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& au |
99 | 99 | case QAudioFormat::Unknown: default: break; |
100 | 100 | } |
101 | 101 | |
| 102 | if (audioFormat.byteOrder() == QAudioFormat::BigEndian) |
| 103 | sf.mFormatFlags |= kAudioFormatFlagIsBigEndian; |
| 104 | |
102 | 105 | return sf; |
103 | 106 | } |
104 | 107 | |