Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 08287bc6a7 | |||
| dd3bd913b5 | |||
| f8887b7ff1 | |||
| 6d2b656a58 | |||
| 02e87c1221 | |||
| d52c012514 | |||
| ea64e5cd71 | |||
| 7a7ba985b8 | |||
| 91640f6207 | |||
| 4a60b768be | |||
| 6d5fdd2450 | |||
| 4e019bfcf2 | |||
| bed5fe1f04 |
+2
-2
@@ -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}'
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user