summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-06-24 11:14:21 (GMT)
committeraxis <qt-info@nokia.com>2010-06-24 11:14:21 (GMT)
commit447f2b410335730cd172a76abce184bacae186d2 (patch)
tree73d93ef871e99f03eedd69eeb0fa74228c1e33d3 /src/multimedia
parent5ce3b09f9b3c574fc4ab2ecc42f879e64df0e6a1 (diff)
parent7ae5285132db6c435e91ab097f41097217d68a2c (diff)
downloadQt-447f2b410335730cd172a76abce184bacae186d2.zip
Qt-447f2b410335730cd172a76abce184bacae186d2.tar.gz
Qt-447f2b410335730cd172a76abce184bacae186d2.tar.bz2
Merge branch '4.6-s60' into 4.7-s60
Conflicts: src/3rdparty/phonon/qt7/mediaobject.mm src/3rdparty/webkit/VERSION src/3rdparty/webkit/WebCore/ChangeLog src/plugins/phonon/mmf/mmf.pro
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qaudio_mac.cpp9
-rw-r--r--src/multimedia/audio/qaudioinput_mac_p.cpp49
-rw-r--r--src/multimedia/audio/qaudiooutput_mac_p.cpp15
3 files changed, 33 insertions, 40 deletions
diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp
index 14fee8b..4e17b52 100644
--- a/src/multimedia/audio/qaudio_mac.cpp
+++ b/src/multimedia/audio/qaudio_mac.cpp
@@ -68,11 +68,11 @@ QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf)
audioFormat.setChannels(sf.mChannelsPerFrame);
audioFormat.setSampleSize(sf.mBitsPerChannel);
audioFormat.setCodec(QString::fromLatin1("audio/pcm"));
- audioFormat.setByteOrder(sf.mFormatFlags & kLinearPCMFormatFlagIsBigEndian != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian);
+ audioFormat.setByteOrder((sf.mFormatFlags & kAudioFormatFlagIsBigEndian) != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian);
QAudioFormat::SampleType type = QAudioFormat::UnSignedInt;
- if ((sf.mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) != 0)
+ if ((sf.mFormatFlags & kAudioFormatFlagIsSignedInteger) != 0)
type = QAudioFormat::SignedInt;
- else if ((sf.mFormatFlags & kLinearPCMFormatFlagIsFloat) != 0)
+ else if ((sf.mFormatFlags & kAudioFormatFlagIsFloat) != 0)
type = QAudioFormat::Float;
audioFormat.setSampleType(type);
@@ -99,6 +99,9 @@ AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& au
case QAudioFormat::Unknown: default: break;
}
+ if (audioFormat.byteOrder() == QAudioFormat::BigEndian)
+ sf.mFormatFlags |= kAudioFormatFlagIsBigEndian;
+
return sf;
}
diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp
index b99fe11..5897e75 100644
--- a/src/multimedia/audio/qaudioinput_mac_p.cpp
+++ b/src/multimedia/audio/qaudioinput_mac_p.cpp
@@ -210,6 +210,11 @@ public:
return true;
}
+ bool empty() const
+ {
+ return position == totalPackets;
+ }
+
private:
UInt32 totalPackets;
UInt32 position;
@@ -275,36 +280,32 @@ public:
if (m_audioConverter != 0) {
QAudioPacketFeeder feeder(m_inputBufferList);
- bool wecan = true;
int copied = 0;
-
const int available = m_buffer->free();
- while (err == noErr && wecan) {
+ while (err == noErr && !feeder.empty()) {
QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(available);
- if (region.second > 0) {
- AudioBufferList output;
- output.mNumberBuffers = 1;
- output.mBuffers[0].mNumberChannels = 1;
- output.mBuffers[0].mDataByteSize = region.second;
- output.mBuffers[0].mData = region.first;
-
- UInt32 packetSize = region.second / m_outputFormat.mBytesPerPacket;
- err = AudioConverterFillComplexBuffer(m_audioConverter,
- converterCallback,
- &feeder,
- &packetSize,
- &output,
- 0);
-
- region.second = output.mBuffers[0].mDataByteSize;
- copied += region.second;
+ if (region.second == 0)
+ break;
+
+ AudioBufferList output;
+ output.mNumberBuffers = 1;
+ output.mBuffers[0].mNumberChannels = 1;
+ output.mBuffers[0].mDataByteSize = region.second;
+ output.mBuffers[0].mData = region.first;
+
+ UInt32 packetSize = region.second / m_outputFormat.mBytesPerPacket;
+ err = AudioConverterFillComplexBuffer(m_audioConverter,
+ converterCallback,
+ &feeder,
+ &packetSize,
+ &output,
+ 0);
+ region.second = output.mBuffers[0].mDataByteSize;
+ copied += region.second;
- m_buffer->releaseWriteRegion(region);
- }
- else
- wecan = false;
+ m_buffer->releaseWriteRegion(region);
}
framesRendered += copied / m_outputFormat.mBytesPerFrame;
diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp
index 9689101..cc52d90 100644
--- a/src/multimedia/audio/qaudiooutput_mac_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp
@@ -358,17 +358,7 @@ bool QAudioOutputPrivate::open()
// Set stream format
streamFormat = toAudioStreamBasicDescription(audioFormat);
- UInt32 size = sizeof(deviceFormat);
- if (AudioUnitGetProperty(audioUnit,
- kAudioUnitProperty_StreamFormat,
- kAudioUnitScope_Input,
- 0,
- &deviceFormat,
- &size) != noErr) {
- qWarning() << "QAudioOutput: Unable to retrieve device format";
- return false;
- }
-
+ UInt32 size = sizeof(streamFormat);
if (AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input,
@@ -392,8 +382,7 @@ bool QAudioOutputPrivate::open()
return false;
}
- periodSizeBytes = (numberOfFrames * streamFormat.mSampleRate / deviceFormat.mSampleRate) *
- streamFormat.mBytesPerFrame;
+ periodSizeBytes = numberOfFrames * streamFormat.mBytesPerFrame;
if (internalBufferSize < periodSizeBytes * 2)
internalBufferSize = periodSizeBytes * 2;
else