[70281] trunk/dports/aqua/qt4-mac/files
michaelld at macports.org
michaelld at macports.org
Wed Aug 4 10:59:14 PDT 2010
Revision: 70281
http://trac.macports.org/changeset/70281
Author: michaelld at macports.org
Date: 2010-08-04 10:59:13 -0700 (Wed, 04 Aug 2010)
Log Message:
-----------
Patch files for QAudioInput and QAudioOutput, for ticket #25831.
Added Paths:
-----------
trunk/dports/aqua/qt4-mac/files/patch-qaudio-format-converters.diff
trunk/dports/aqua/qt4-mac/files/patch-qaudioinput-conversion.diff
trunk/dports/aqua/qt4-mac/files/patch-qaudioinput-readyread.diff
trunk/dports/aqua/qt4-mac/files/patch-qaudiooutput-period-size.diff
Added: trunk/dports/aqua/qt4-mac/files/patch-qaudio-format-converters.diff
===================================================================
--- trunk/dports/aqua/qt4-mac/files/patch-qaudio-format-converters.diff (rev 0)
+++ trunk/dports/aqua/qt4-mac/files/patch-qaudio-format-converters.diff 2010-08-04 17:59:13 UTC (rev 70281)
@@ -0,0 +1,39 @@
+From b82ed43086aebb4698a8a52965eeb17349ef1d04 Mon Sep 17 00:00:00 2001
+From: Justin McPherson <justin.mcpherson at 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
+--- src/multimedia/audio/qaudio_mac.cpp
++++ 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;
+ }
+
Added: trunk/dports/aqua/qt4-mac/files/patch-qaudioinput-conversion.diff
===================================================================
--- trunk/dports/aqua/qt4-mac/files/patch-qaudioinput-conversion.diff (rev 0)
+++ trunk/dports/aqua/qt4-mac/files/patch-qaudioinput-conversion.diff 2010-08-04 17:59:13 UTC (rev 70281)
@@ -0,0 +1,86 @@
+From 66d02e4bde0a628978436217032abe555ed77fad Mon Sep 17 00:00:00 2001
+From: Justin McPherson <justin.mcpherson at nokia.com>
+Date: Mon, 21 Jun 2010 15:18:32 +1000
+Subject: [PATCH] Audio(osx); refactor input period conversion
+
+Reviewed-by:Dmytro Poplavskiy
+---
+ src/multimedia/audio/qaudioinput_mac_p.cpp | 51 ++++++++++++++-------------
+ 1 files changed, 26 insertions(+), 25 deletions(-)
+
+diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp
+index b99fe11..5897e75 100644
+--- src/multimedia/audio/qaudioinput_mac_p.cpp
++++ 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;
+--
+1.6.1
+
Added: trunk/dports/aqua/qt4-mac/files/patch-qaudioinput-readyread.diff
===================================================================
--- trunk/dports/aqua/qt4-mac/files/patch-qaudioinput-readyread.diff (rev 0)
+++ trunk/dports/aqua/qt4-mac/files/patch-qaudioinput-readyread.diff 2010-08-04 17:59:13 UTC (rev 70281)
@@ -0,0 +1,33 @@
+From 4f79cbb2b7923ff7f7cbc77dc6820d12f594311d Mon Sep 17 00:00:00 2001
+From: Justin McPherson <justin.mcpherson at nokia.com>
+Date: Wed, 16 Jun 2010 16:44:18 +1000
+Subject: [PATCH] Audio (osx); In pull mode emit readyRead() for each period received.
+
+Task-number: QTBUG-10009
+Reviewed-by:Dmytro Poplavskiy
+---
+ src/multimedia/audio/qaudioinput_mac_p.cpp | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp
+index cb65f6e..b99fe11 100644
+--- src/multimedia/audio/qaudioinput_mac_p.cpp
++++ src/multimedia/audio/qaudioinput_mac_p.cpp
+@@ -259,7 +259,7 @@ public:
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames)
+ {
+- const bool wasEmpty = m_buffer->used() == 0;
++ const bool pullMode = m_device == 0;
+
+ OSStatus err;
+ qint64 framesRendered = 0;
+@@ -330,7 +330,7 @@ public:
+ framesRendered = copied / m_outputFormat.mBytesPerFrame;
+ }
+
+- if (wasEmpty && framesRendered > 0)
++ if (pullMode && framesRendered > 0)
+ emit readyRead();
+
+ return framesRendered;
Added: trunk/dports/aqua/qt4-mac/files/patch-qaudiooutput-period-size.diff
===================================================================
--- trunk/dports/aqua/qt4-mac/files/patch-qaudiooutput-period-size.diff (rev 0)
+++ trunk/dports/aqua/qt4-mac/files/patch-qaudiooutput-period-size.diff 2010-08-04 17:59:13 UTC (rev 70281)
@@ -0,0 +1,44 @@
+From 76c256bdabcc207a6ed70d5b5b62698495548a25 Mon Sep 17 00:00:00 2001
+From: Justin McPherson <justin.mcpherson at nokia.com>
+Date: Tue, 22 Jun 2010 12:01:51 +1000
+Subject: [PATCH] Audio(osx); Fix period size calculation.
+
+Task-number: QTBUG-8878
+Reviewed-by:Dmytro Poplavskiy
+---
+ src/multimedia/audio/qaudiooutput_mac_p.cpp | 15 ++-------------
+ 1 files changed, 2 insertions(+), 13 deletions(-)
+
+diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp
+index 9689101..cc52d90 100644
+--- src/multimedia/audio/qaudiooutput_mac_p.cpp
++++ 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100804/2aa4271d/attachment.html>
More information about the macports-changes
mailing list