Compare commits

..

13 Commits

Author SHA1 Message Date
Thong Nguyen 08287bc6a7 Merge pull request #24 from gangverk/master
Add support for HE-AAC
2013-05-17 11:26:45 -07:00
Piers dd3bd913b5 Update podspec to version 0.0.5 2013-05-17 17:22:32 +00:00
Piers f8887b7ff1 Add support for HE-AAC
The code for handling HE-AAC has been copied from Matt Gallagher's
AudioStreamer library.

https://github.com/mattgallagher/AudioStreamer/blob/master/Classes/AudioStreamer.m#L1605
2013-05-15 16:29:24 +00:00
Thong Nguyen 6d2b656a58 Updated README 2013-05-03 18:46:34 +01:00
Thong Nguyen 02e87c1221 Merge branch 'master' of https://github.com/tumtumtum/audjustable 2013-04-17 13:07:51 +01:00
Thong Nguyen d52c012514 Some format fixes 2013-04-17 13:07:48 +01:00
Thong Nguyen ea64e5cd71 Merge pull request #20 from gangverk/master
Continual allocation of NSDate objects in [AudioPlayer startInterval]
2013-04-17 05:06:26 -07:00
Piers 7a7ba985b8 Merge pull request #2 from gangverk/bugfix/continuous-date-allocation
Bugfix/continuous date allocation
2013-04-17 03:14:06 -07:00
Piers 91640f6207 Update podspec version 2013-04-17 10:12:07 +00:00
Piers 4a60b768be Merge branch 'master' into bugfix/continuous-date-allocation 2013-04-17 10:11:18 +00:00
Piers 6d5fdd2450 Merge pull request #1 from gangverk/bugfix/continuous-date-allocation
Fix continual allocation of auto-releaseable NSDate objects
2013-04-17 02:53:33 -07:00
Piers 4e019bfcf2 Fix continual allocation of auto-releaseable NSDate objects
The startInterval method of the AudioPlayer module causes a
continually increasing number of NSDate objects to be
allocated. The auto-release pool which wraps this code doesn't
drain frequently enough causing an application's memory
footprint to grow by roughly a megabyte every 5 minutes.
2013-04-17 09:37:57 +00:00
Thong Nguyen bed5fe1f04 Updated podspec for version 0.0.3 2013-04-10 12:28:38 +01:00
3 changed files with 54 additions and 12 deletions
+2 -2
View File
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "Audjustable"
s.version = "0.0.2"
s.version = "0.0.5"
s.summary = "A fast and extensible audio streamer for iOS and OSX with support for gapless playback and custom (non-HTTP) sources."
s.homepage = "http://tumtumtum.github.com/audjustable/"
s.license = 'MIT'
s.author = { "Thong Nguyen" => "tumtumtum@gmail.com" }
s.source = { :git => "https://github.com/gangverk/audjustable.git", :tag => s.version.to_s}
s.source = { :git => "https://github.com/tumtumtum/audjustable.git", :tag => s.version.to_s}
s.platform = :ios
s.requires_arc = true
s.source_files = 'Audjustable/Classes/AudioPlayer/*.{h,m}'
+50 -10
View File
@@ -605,12 +605,13 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
break;
case kAudioFileStreamProperty_DataFormat:
{
AudioStreamBasicDescription newBasicDescription;
UInt32 size = sizeof(newBasicDescription);
AudioFileStreamGetProperty(inAudioFileStream, kAudioFileStreamProperty_DataFormat, &size, &newBasicDescription);
currentlyReadingEntry->audioStreamBasicDescription = newBasicDescription;
if (currentlyReadingEntry->audioStreamBasicDescription.mSampleRate == 0) {
AudioStreamBasicDescription newBasicDescription;
UInt32 size = sizeof(newBasicDescription);
AudioFileStreamGetProperty(inAudioFileStream, kAudioFileStreamProperty_DataFormat, &size, &newBasicDescription);
currentlyReadingEntry->audioStreamBasicDescription = newBasicDescription;
}
currentlyReadingEntry->sampleRate = currentlyReadingEntry->audioStreamBasicDescription.mSampleRate;
currentlyReadingEntry->packetDuration = currentlyReadingEntry->audioStreamBasicDescription.mFramesPerPacket / currentlyReadingEntry->sampleRate;
@@ -652,6 +653,44 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
discontinuous = YES;
}
break;
case kAudioFileStreamProperty_FormatList:
{
Boolean outWriteable;
UInt32 formatListSize;
OSStatus err = AudioFileStreamGetPropertyInfo(inAudioFileStream, kAudioFileStreamProperty_FormatList, &formatListSize, &outWriteable);
if (err)
{
break;
}
AudioFormatListItem *formatList = malloc(formatListSize);
err = AudioFileStreamGetProperty(inAudioFileStream, kAudioFileStreamProperty_FormatList, &formatListSize, formatList);
if (err)
{
free(formatList);
break;
}
for (int i = 0; i * sizeof(AudioFormatListItem) < formatListSize; i += sizeof(AudioFormatListItem))
{
AudioStreamBasicDescription pasbd = formatList[i].mASBD;
if (pasbd.mFormatID == kAudioFormatMPEG4AAC_HE ||
pasbd.mFormatID == kAudioFormatMPEG4AAC_HE_V2)
{
//
// We've found HE-AAC, remember this to tell the audio queue
// when we construct it.
//
#if !TARGET_IPHONE_SIMULATOR
currentlyReadingEntry->audioStreamBasicDescription = pasbd;
#endif
break;
}
}
free(formatList);
}
break;
}
}
@@ -1024,10 +1063,10 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
}
}
if (self.internalState == AudioPlayerInternalStateRebuffering && numberOfBuffersUsed >= AudioPlayerBuffersNeededToStart) {
self.internalState =AudioPlayerInternalStatePlaying;
if (self.internalState == AudioPlayerInternalStateRebuffering && numberOfBuffersUsed >= AudioPlayerBuffersNeededToStart)
{
self.internalState = AudioPlayerInternalStatePlaying;
}
if (++fillBufferIndex >= audioQueueBufferCount)
{
@@ -1636,7 +1675,8 @@ static void AudioQueueIsRunningCallbackProc(void* userData, AudioQueueRef audioQ
break;
}
[playbackThreadRunLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:10]];
NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:10];
[playbackThreadRunLoop runMode:NSDefaultRunLoopMode beforeDate:date];
}
disposeWasRequested = NO;
+2
View File
@@ -23,6 +23,8 @@ Download the [source](https://github.com/tumtumtum/audjustable/zipball/master) w
If you would like to integrate the AudioPlayer directly into your project you only need to copy the files inside the `/Audjustable/Classes/AudioPlayer` [directory](https://github.com/tumtumtum/audjustable/tree/master/Audjustable/Classes/AudioPlayer) into your project.
Audjustable is also available as a [Cooapod](http://cocoapods.org/?q=audjustable).
## Code
There are two main classes. The `DataSource` class which is the abstract base class for the various compressed audio data sources (HTTP, local file are provided). The `AudioPlayer` class manages and renders audio from a queue DataSources.