From de99ec9d7acfb431d816a8489be9ee27dca9698e Mon Sep 17 00:00:00 2001 From: Sergio Padrino Date: Wed, 14 Jan 2015 16:55:25 +0100 Subject: [PATCH 01/19] Make sure the audio player changes to stopped state when it's stopped from paused state --- StreamingKit/StreamingKit/STKAudioPlayer.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index c5fa73b..a2e54e8 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -2412,6 +2412,9 @@ static BOOL GetHardwareCodecClassDesc(UInt32 formatId, AudioClassDescription* cl } else if (!isRunning) { + stopReason = stopReasonIn; + self.internalState = STKAudioPlayerInternalStateStopped; + return; } From 15b0242305984ae1c80bea75eab6bb0d258e60e9 Mon Sep 17 00:00:00 2001 From: Corprew Reed Date: Thu, 18 Jun 2015 14:14:47 -0700 Subject: [PATCH 02/19] spelling fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c68a827..c40e84a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The primary motivation of this project was to decouple the input data sources fr * Easy to read source. * Carefully multi-threaded to provide a responsive API that won't block your UI thread nor starve the audio buffers. * Buffered and gapless playback between all format types. -* Easy to implement audio data sources (Local, HTTP, AutoRecoveryingHTTP DataSources are provided). +* Easy to implement audio data sources (Local, HTTP, AutoRecoveringHTTP DataSources are provided). * Easy to extend DataSource to support adaptive buffering, encryption, etc. * Optimised for low CPU/battery usage (0% - 1% CPU usage when streaming). * Optimised for linear data sources. Random access sources are required only for seeking. From 726ec86d774bcf97fd8c164b894c2a070e3ccd5c Mon Sep 17 00:00:00 2001 From: Richard Groves Date: Fri, 26 Jun 2015 11:45:29 +0100 Subject: [PATCH 03/19] Update STKAudioPlayer.m The original line throws this warning in XCode - ...../External Libraries/StreamingKit/StreamingKit/StreamingKit/STKAudioPlayer.m:880:61: Comparison of constant 'kAudioFormatLinearPCM' (1819304813) with boolean expression is always false I'm guessing the precedence of ! vs == causes it to be 'mis-interpreted'. Not quite sure of the logic where audio format != linear PCM implies a discontinuous stream, but... --- StreamingKit/StreamingKit/STKAudioPlayer.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index c5fa73b..9ed4566 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -877,7 +877,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn } case kAudioFileStreamProperty_ReadyToProducePackets: { - if (!audioConverterAudioStreamBasicDescription.mFormatID == kAudioFormatLinearPCM) + if (audioConverterAudioStreamBasicDescription.mFormatID != kAudioFormatLinearPCM) { discontinuous = YES; } From 4f72249c94bff547c02ea6a0bd129cc45c030315 Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Thu, 29 Oct 2015 18:16:01 +0000 Subject: [PATCH 04/19] Fixed License --- LICENSE | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LICENSE b/LICENSE index 220f79b..06a551b 100644 --- a/LICENSE +++ b/LICENSE @@ -4,7 +4,7 @@ Inspired by Matt Gallagher's AudioStreamer: https://github.com/mattgallagher/AudioStreamer - Copyright (c) 2012 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. + Copyright (c) 2015 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -15,12 +15,12 @@ documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: - This product includes software developed by the . + This product includes software developed by Thong Nguyen. 4. Neither the name of the nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY ''AS IS'' AND ANY + THIS SOFTWARE IS PROVIDED BY THONG NGUYEN ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY From 520f98a6b36de49c70026f14dbb8ad068b087088 Mon Sep 17 00:00:00 2001 From: kampfgnu Date: Tue, 10 Nov 2015 11:02:57 +0100 Subject: [PATCH 05/19] fix reconnect to live streams seeking to a non-zero offset works only if seek is supported (accept-ranges header) --- StreamingKit/StreamingKit/STKHTTPDataSource.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit/StreamingKit/STKHTTPDataSource.m b/StreamingKit/StreamingKit/STKHTTPDataSource.m index bd66ab5..77e6f3e 100755 --- a/StreamingKit/StreamingKit/STKHTTPDataSource.m +++ b/StreamingKit/StreamingKit/STKHTTPDataSource.m @@ -411,7 +411,7 @@ eventsRunLoop = savedEventsRunLoop; - [self seekToOffset:self.position]; + [self seekToOffset:self->supportsSeek ? self.position : 0]; } -(void) seekToOffset:(SInt64)offset From 3bc3a85df38b3ec0aff8aabf516b469b0e26e8c2 Mon Sep 17 00:00:00 2001 From: kampfgnu Date: Thu, 26 Nov 2015 11:41:07 +0100 Subject: [PATCH 06/19] fix mono streams by removing a line that is already removed in v 0.1.25, but not in master... --- StreamingKit/StreamingKit/STKAudioPlayer.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index c5fa73b..42ec4b5 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -1947,7 +1947,7 @@ static BOOL GetHardwareCodecClassDesc(UInt32 formatId, AudioClassDescription* cl [self destroyAudioConverter]; - canonicalAudioStreamBasicDescription.mChannelsPerFrame = asbd->mChannelsPerFrame; + //canonicalAudioStreamBasicDescription.mChannelsPerFrame = asbd->mChannelsPerFrame; BOOL isRecording = currentlyReadingEntry.dataSource.recordToFileUrl != nil; if (isRecording) From f84f1ef0bd7d584b741b4cb336aef2958af2e5c5 Mon Sep 17 00:00:00 2001 From: kampfgnu Date: Thu, 26 Nov 2015 11:43:41 +0100 Subject: [PATCH 07/19] use brackets to test for formatID --- StreamingKit/StreamingKit/STKAudioPlayer.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index 42ec4b5..9d69262 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -877,7 +877,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn } case kAudioFileStreamProperty_ReadyToProducePackets: { - if (!audioConverterAudioStreamBasicDescription.mFormatID == kAudioFormatLinearPCM) + if (!(audioConverterAudioStreamBasicDescription.mFormatID == kAudioFormatLinearPCM)) { discontinuous = YES; } From f872de223d180e87a89f4840ef4ecd0897f3c7b4 Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Thu, 3 Dec 2015 16:18:06 +0000 Subject: [PATCH 08/19] Added support for disabling buffers in options using STK_DISABLE_BUFFER. Changed bufferSizeInSeconds from a UInt32 to Float32 --- .../ExampleApp.xcodeproj/project.pbxproj | 7 +++- ExampleApp/ExampleApp/AppDelegate.m | 6 ++-- ExampleApp/ExampleApp/AudioPlayerView.m | 16 ++++----- ExampleApp/ExampleApp/ExampleApp-Info.plist | 2 +- .../AppIcon.appiconset/Contents.json | 15 +++++++++ .../ExampleApp/Images.xcassets/Contents.json | 6 ++++ .../LaunchImage.launchimage/Contents.json | 28 +++++++++++++++- .../LaunchImage.launchimage/TX6sV.png | Bin 0 -> 16733 bytes .../LaunchImage.launchimage/dBEHd.png | Bin 0 -> 8522 bytes .../ExampleAppTests-Info.plist | 2 +- .../StreamingKit.xcodeproj/project.pbxproj | 7 +++- .../contents.xcworkspacedata | 7 ++++ StreamingKit/StreamingKit/STKAudioPlayer.h | 9 ++++- StreamingKit/StreamingKit/STKAudioPlayer.m | 31 +++++++++++++++++- .../STKAutoRecoveringHTTPDataSource.m | 2 ++ .../StreamingKitMacTests-Info.plist | 2 +- .../StreamingKitTests-Info.plist | 2 +- 17 files changed, 122 insertions(+), 20 deletions(-) create mode 100644 ExampleApp/ExampleApp/Images.xcassets/Contents.json create mode 100644 ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV.png create mode 100644 ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/dBEHd.png create mode 100644 StreamingKit/StreamingKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/ExampleApp/ExampleApp.xcodeproj/project.pbxproj b/ExampleApp/ExampleApp.xcodeproj/project.pbxproj index 046b397..53b60b7 100644 --- a/ExampleApp/ExampleApp.xcodeproj/project.pbxproj +++ b/ExampleApp/ExampleApp.xcodeproj/project.pbxproj @@ -230,7 +230,7 @@ A1115929188D686000641365 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0710; ORGANIZATIONNAME = "Thong Nguyen"; TargetAttributes = { A111594B188D686000641365 = { @@ -346,6 +346,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -422,6 +423,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 6.0; LLVM_LTO = YES; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "abstractpath.com.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -438,6 +440,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 6.0; LLVM_LTO = YES; OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "abstractpath.com.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -459,6 +462,7 @@ "$(inherited)", ); INFOPLIST_FILE = "ExampleAppTests/ExampleAppTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "abstractpath.com.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; @@ -477,6 +481,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ExampleApp/ExampleApp-Prefix.pch"; INFOPLIST_FILE = "ExampleAppTests/ExampleAppTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "abstractpath.com.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; diff --git a/ExampleApp/ExampleApp/AppDelegate.m b/ExampleApp/ExampleApp/AppDelegate.m index d0680af..bb3d37c 100644 --- a/ExampleApp/ExampleApp/AppDelegate.m +++ b/ExampleApp/ExampleApp/AppDelegate.m @@ -32,6 +32,7 @@ AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration, sizeof(bufferLength), &bufferLength); self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + self.window.rootViewController = [[UIViewController alloc] init]; self.window.backgroundColor = [UIColor whiteColor]; @@ -39,7 +40,6 @@ audioPlayer.meteringEnabled = YES; audioPlayer.volume = 1; - AudioPlayerView* audioPlayerView = [[AudioPlayerView alloc] initWithFrame:self.window.bounds andAudioPlayer:audioPlayer]; audioPlayerView.delegate = self; @@ -47,9 +47,9 @@ [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; - [self.window addSubview:audioPlayerView]; - [self.window makeKeyAndVisible]; + + [self.window.rootViewController.view addSubview:audioPlayerView]; return YES; } diff --git a/ExampleApp/ExampleApp/AudioPlayerView.m b/ExampleApp/ExampleApp/AudioPlayerView.m index a93ea0b..5be5e70 100644 --- a/ExampleApp/ExampleApp/AudioPlayerView.m +++ b/ExampleApp/ExampleApp/AudioPlayerView.m @@ -58,27 +58,27 @@ CGSize size = CGSizeMake(220, 50); playFromHTTPButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - playFromHTTPButton.frame = CGRectMake((320 - size.width) / 2, frame.size.height * 0.10, size.width, size.height); + playFromHTTPButton.frame = CGRectMake((frame.size.width - size.width) / 2, frame.size.height * 0.10, size.width, size.height); [playFromHTTPButton addTarget:self action:@selector(playFromHTTPButtonTouched) forControlEvents:UIControlEventTouchUpInside]; [playFromHTTPButton setTitle:@"Play from HTTP" forState:UIControlStateNormal]; playFromIcecastButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - playFromIcecastButton.frame = CGRectMake((320 - size.width) / 2, frame.size.height * 0.10 + 35, size.width, size.height); + playFromIcecastButton.frame = CGRectMake((frame.size.width - size.width) / 2, frame.size.height * 0.10 + 35, size.width, size.height); [playFromIcecastButton addTarget:self action:@selector(playFromIcecasButtonTouched) forControlEvents:UIControlEventTouchUpInside]; [playFromIcecastButton setTitle:@"Play from Icecast" forState:UIControlStateNormal]; playFromLocalFileButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - playFromLocalFileButton.frame = CGRectMake((320 - size.width) / 2, frame.size.height * 0.10 + 70, size.width, size.height); + playFromLocalFileButton.frame = CGRectMake((frame.size.width - size.width) / 2, frame.size.height * 0.10 + 70, size.width, size.height); [playFromLocalFileButton addTarget:self action:@selector(playFromLocalFileButtonTouched) forControlEvents:UIControlEventTouchUpInside]; [playFromLocalFileButton setTitle:@"Play from Local File" forState:UIControlStateNormal]; queueShortFileButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - queueShortFileButton.frame = CGRectMake((320 - size.width) / 2, frame.size.height * 0.10 + 105, size.width, size.height); + queueShortFileButton.frame = CGRectMake((frame.size.width - size.width) / 2, frame.size.height * 0.10 + 105, size.width, size.height); [queueShortFileButton addTarget:self action:@selector(queueShortFileButtonTouched) forControlEvents:UIControlEventTouchUpInside]; [queueShortFileButton setTitle:@"Queue short file" forState:UIControlStateNormal]; queuePcmWaveFileFromHTTPButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - queuePcmWaveFileFromHTTPButton.frame = CGRectMake((320 - size.width) / 2, frame.size.height * 0.10 + 140, size.width, size.height); + queuePcmWaveFileFromHTTPButton.frame = CGRectMake((frame.size.width - size.width) / 2, frame.size.height * 0.10 + 140, size.width, size.height); [queuePcmWaveFileFromHTTPButton addTarget:self action:@selector(queuePcmWaveFileButtonTouched) forControlEvents:UIControlEventTouchUpInside]; [queuePcmWaveFileFromHTTPButton setTitle:@"Queue PCM/WAVE from HTTP" forState:UIControlStateNormal]; @@ -89,12 +89,12 @@ [playButton addTarget:self action:@selector(playButtonPressed) forControlEvents:UIControlEventTouchUpInside]; stopButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - stopButton.frame = CGRectMake((320 - size.width) - 30, 400, size.width, size.height); + stopButton.frame = CGRectMake((frame.size.width - size.width) - 30, 400, size.width, size.height); [stopButton addTarget:self action:@selector(stopButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [stopButton setTitle:@"Stop" forState:UIControlStateNormal]; muteButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - muteButton.frame = CGRectMake((320 - size.width) - 30, 430, size.width, size.height); + muteButton.frame = CGRectMake((frame.size.width - size.width) - 30, 430, size.width, size.height); [muteButton addTarget:self action:@selector(muteButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [muteButton setTitle:@"Mute" forState:UIControlStateNormal]; @@ -106,7 +106,7 @@ repeatSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(30, frame.size.height * 0.15 + 180, size.width, size.height)]; - enableEqSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(320 - size.width - 30, frame.size.height * 0.15 + 180, size.width, size.height)]; + enableEqSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(frame.size.width - size.width - 30, frame.size.height * 0.15 + 180, size.width, size.height)]; enableEqSwitch.on = audioPlayer.equalizerEnabled; [enableEqSwitch addTarget:self action:@selector(onEnableEqSwitch) forControlEvents:UIControlEventAllTouchEvents]; diff --git a/ExampleApp/ExampleApp/ExampleApp-Info.plist b/ExampleApp/ExampleApp/ExampleApp-Info.plist index f2f0135..ef8abcd 100644 --- a/ExampleApp/ExampleApp/ExampleApp-Info.plist +++ b/ExampleApp/ExampleApp/ExampleApp-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - abstractpath.com.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/ExampleApp/ExampleApp/Images.xcassets/AppIcon.appiconset/Contents.json b/ExampleApp/ExampleApp/Images.xcassets/AppIcon.appiconset/Contents.json index 91bf9c1..36d2c80 100644 --- a/ExampleApp/ExampleApp/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/ExampleApp/ExampleApp/Images.xcassets/AppIcon.appiconset/Contents.json @@ -5,16 +5,31 @@ "size" : "29x29", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, { "idiom" : "ipad", "size" : "29x29", diff --git a/ExampleApp/ExampleApp/Images.xcassets/Contents.json b/ExampleApp/ExampleApp/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/ExampleApp/ExampleApp/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/Contents.json b/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/Contents.json index 6f870a4..83b8ad2 100644 --- a/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -1,5 +1,31 @@ { "images" : [ + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "TX6sV.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "orientation" : "landscape", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "8.0", + "subtype" : "736h", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "667h", + "filename" : "dBEHd.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x" + }, { "orientation" : "portrait", "idiom" : "iphone", @@ -10,9 +36,9 @@ { "orientation" : "portrait", "idiom" : "iphone", - "subtype" : "retina4", "extent" : "full-screen", "minimum-system-version" : "7.0", + "subtype" : "retina4", "scale" : "2x" }, { diff --git a/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV.png b/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV.png new file mode 100644 index 0000000000000000000000000000000000000000..2f5242baa308ee53c65d5849b003dd29365c06b7 GIT binary patch literal 16733 zcmeHOO>7%Q6rMDpF%^-_4O%3o8<0TM-XGg*dx@L+ml$vw97{E-kl5@_;#IOg>~63V z4vk7VK;Z(Xa)EN;h7?jEqzDmC{79voAd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ExampleApp/Images.xcassets/LaunchImage.launchimage/dBEHd.png b/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/dBEHd.png new file mode 100644 index 0000000000000000000000000000000000000000..8f82b77b1e19a4cd017499276539a958f1850f73 GIT binary patch literal 8522 zcmeHLXHZnx5E!0=cG=0zokIr- z<#4~`=IDIE0RZm-lqmvcI>V^6I=l?g3lF@b=Vrn{%3%VD45W|c733tN)eYy&=w~pl zKBS>R#MYP|P8b~>7{y>LM0u0Ek7R=Lesu7I@S9ERqka!udMa0^TDP9|Do+s$Af{vPs11tC z02W6}Q36OQftYc4hyWn+1J;dPT;AYDGN9L7G*|p^yoh#Ma0jX65=9KRoCea8RM>;W z++5@+KTe0~IK7O`0h<(6ks6<5773&j&6}kb0McU_cCuaC^u|#a;czn1XzFvqvoDCZ zkJ;LeZ%wx4yQ=~)>KV|nB_vwP8mK@V=(=^EXMxD+EJga2)kwz@8r7#DeP+OX$$b|a zjf`8E{{G2{i9X#rh^0-Fx&IcT<{Z|1^TMY9#f{aKH_ykokrHQ+T10DaYFd`{Gmo_0 zCc9xfI2EI{QAV-7!QOSOPRAAl7o;CIrt^qaPl;NR$UGJSxh?RLr*qqWY(!|CPf@MxRY_Is60t#lp`=%{ns1Aw#Y z+#;~1Qk4c$0Myfwg2ifV%hk+6SmGnq2M4PuHmqfCK)CB_AhZy2`@kcYtOW{!ApD`N z#q5ICqOVoirLe|Mp>giiA~j~usFmDlKHHF{Rr6OO$%xb%Ne|m_4ulif-h^{SlQJcT ztZ`Or6VXL-bG!;nbm@Rxn3ZOEtU@D@2-*m()DpjgEHPGk zP5Bgx$&qEfp?RO8-QH6?C5ACQwf)i)R;4JJjOq4#Cz^p6WoUyK_AN7sWZeZZk@{N5 z;}b$;adyp*j}=hn*RvL%Dj=+gSg~t+>_tR})WDL-5P3m3Y>ujF!}Z~YecCx3N4TX9 z4Uox_5#BJa;X4+WqxXcj{LrU5W?KpIFu1l5R}WpxVNqJYaA=(@H(dl&f)8`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lF~T=&4Qb+Qp6qHowY`Qt!I)mX)iU%CDZ|%?Qj4x*fY6)^*lPS5=B4@@Cc&)?LpO z8oGMSHxPCbZjx|OqkA#0yV*OHU?wp=$LF-D8-9Dfg?jHLOeI5Q_WRxXF)nv?pNW}O zvXRxJRPqB?qx=d+NxFW!%8ps zM|TPK%6VWWs4EV!*cOF~NBIYcd>XXI-$(mR+u=se)407ar}Z4|)Yy)kR;X0KSuH;E zTr9y)9yWhwp7Kckoa?OTtm0N&mr+B--HMbVjFk&!!MEzEpX2HbTbe9xXt~Pg1LJm2 zcbc5iP}P#J+v>~Jl@Z3FfJ=OvxaNv}FTRDsN~6ki%c}Eg{m`MXZWYU|!M^u{*Uw|U z(w900wN{Bkg4?!YS7K&0~>bz~$iCdR#Ry_UH-i=AV6gs-ouKl=QYx1{*lM?C&3p&=^fz zVq%eL*Z*tgan-~D#yQ4P)g8}%oz4M*{;EEUk zv(^B}Cjr3ZcKh5*%^f{@MMqr?<~{JPN1Olv(%NF=^)_o{99L|6e!Tqw04jUvcAPy( z0EkimfY}QG>@z|D>e>G=SP$-ajZ^<&5Ze*HUk$sT?i&8L@7G}8_uY;DW!v#Q$R{?la2YK#PB_<8S{^zgUa= zjI!U{zR}(P5zTF%QT7?-zp~A^J zdj7)Qb)QkbOak_(#r;zJ30mCODEk^^U!&}qXY84U>@&)rXPQ4&nqmw8P)5NHQ3HZh W3YTerF;8 literal 0 HcmV?d00001 diff --git a/ExampleApp/ExampleAppTests/ExampleAppTests-Info.plist b/ExampleApp/ExampleAppTests/ExampleAppTests-Info.plist index 12b70c6..169b6f7 100644 --- a/ExampleApp/ExampleAppTests/ExampleAppTests-Info.plist +++ b/ExampleApp/ExampleAppTests/ExampleAppTests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - abstractpath.com.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/StreamingKit/StreamingKit.xcodeproj/project.pbxproj b/StreamingKit/StreamingKit.xcodeproj/project.pbxproj index 5f8109d..e013273 100644 --- a/StreamingKit/StreamingKit.xcodeproj/project.pbxproj +++ b/StreamingKit/StreamingKit.xcodeproj/project.pbxproj @@ -425,7 +425,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = STK; - LastUpgradeCheck = 0610; + LastUpgradeCheck = 0710; ORGANIZATIONNAME = "Thong Nguyen"; }; buildConfigurationList = A1E7C4C3188D57F50010896F /* Build configuration list for PBXProject "StreamingKit" */; @@ -633,6 +633,7 @@ ); INFOPLIST_FILE = "StreamingKitMacTests/StreamingKitMacTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.8; + PRODUCT_BUNDLE_IDENTIFIER = "com.abstractpath.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; WRAPPER_EXTENSION = xctest; @@ -653,6 +654,7 @@ GCC_PREFIX_HEADER = "StreamingKitMac/StreamingKitMac-Prefix.pch"; INFOPLIST_FILE = "StreamingKitMacTests/StreamingKitMacTests-Info.plist"; MACOSX_DEPLOYMENT_TARGET = 10.8; + PRODUCT_BUNDLE_IDENTIFIER = "com.abstractpath.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; WRAPPER_EXTENSION = xctest; @@ -676,6 +678,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -776,6 +779,7 @@ "$(inherited)", ); INFOPLIST_FILE = "StreamingKitTests/StreamingKitTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "abstractpath.com.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = xctest; }; @@ -792,6 +796,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "StreamingKit/StreamingKit-Prefix.pch"; INFOPLIST_FILE = "StreamingKitTests/StreamingKitTests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "abstractpath.com.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = xctest; }; diff --git a/StreamingKit/StreamingKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/StreamingKit/StreamingKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/StreamingKit/StreamingKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.h b/StreamingKit/StreamingKit/STKAudioPlayer.h index 0ce6d53..e4dd707 100644 --- a/StreamingKit/StreamingKit/STKAudioPlayer.h +++ b/StreamingKit/StreamingKit/STKAudioPlayer.h @@ -80,6 +80,11 @@ typedef enum } STKAudioPlayerErrorCode; +/// +/// Options to initiailise the Audioplayer with. +/// By default if you set buffer size or seconds to 0, the non-zero default will be used +/// If you would like to disable the buffer option completely set to STK_DISABLE_BUFFER +/// typedef struct { /// If YES then seeking a track will cause all pending items to be flushed from the queue @@ -91,7 +96,7 @@ typedef struct /// The size of the internal I/O read buffer. This data in this buffer is transient and does not need to be larger. UInt32 readBufferSize; /// The size of the decompressed buffer (Default is 10 seconds which uses about 1.7MB of RAM) - UInt32 bufferSizeInSeconds; + Float32 bufferSizeInSeconds; /// Number of seconds of decompressed audio is required before playback first starts for each item (Default is 0.5 seconds. Must be larger than bufferSizeInSeconds) Float32 secondsRequiredToStartPlaying; /// Seconds after a seek is performed before data needs to come in (after which the state will change to playing/buffering) @@ -101,6 +106,8 @@ typedef struct } STKAudioPlayerOptions; +#define STK_DISABLE_BUFFER (0xffffffff) + typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UInt32 frameCount, void* frames); @interface STKFrameFilterEntry : NSObject diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index c5fa73b..cb15d47 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -96,6 +96,34 @@ static void PopulateOptionsWithDefault(STKAudioPlayerOptions* options) } } +static void NormalizeDisabledBuffers(STKAudioPlayerOptions* options) +{ + if (options->bufferSizeInSeconds == STK_DISABLE_BUFFER) + { + options->bufferSizeInSeconds = 0; + } + + if (options->readBufferSize == STK_DISABLE_BUFFER) + { + options->readBufferSize = 0; + } + + if (options->secondsRequiredToStartPlaying == STK_DISABLE_BUFFER) + { + options->secondsRequiredToStartPlaying = 0; + } + + if (options->secondsRequiredToStartPlayingAfterBufferUnderun == STK_DISABLE_BUFFER) + { + options->secondsRequiredToStartPlayingAfterBufferUnderun = 0; + } + + if (options->gracePeriodAfterSeekInSeconds == STK_DISABLE_BUFFER) + { + options->gracePeriodAfterSeekInSeconds = 0; + } +} + #define CHECK_STATUS_AND_REPORT(call) \ if ((status = (call))) \ { \ @@ -491,6 +519,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn self->equalizerEnabled = optionsIn.equalizerBandFrequencies[0] != 0; PopulateOptionsWithDefault(&options); + NormalizeDisabledBuffers(&options); framesRequiredToStartPlaying = canonicalAudioStreamBasicDescription.mSampleRate * options.secondsRequiredToStartPlaying; framesRequiredToPlayAfterRebuffering = canonicalAudioStreamBasicDescription.mSampleRate * options.secondsRequiredToStartPlayingAfterBufferUnderun; @@ -877,7 +906,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn } case kAudioFileStreamProperty_ReadyToProducePackets: { - if (!audioConverterAudioStreamBasicDescription.mFormatID == kAudioFormatLinearPCM) + if (audioConverterAudioStreamBasicDescription.mFormatID != kAudioFormatLinearPCM) { discontinuous = YES; } diff --git a/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.m b/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.m index 37fa5e5..445d44d 100644 --- a/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.m +++ b/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.m @@ -101,6 +101,8 @@ static void PopulateOptionsWithDefault(STKAutoRecoveringHTTPDataSourceOptions* o @implementation STKAutoRecoveringHTTPDataSource +@dynamic innerDataSource; + -(STKHTTPDataSource*) innerHTTPDataSource { return (STKHTTPDataSource*)self.innerDataSource; diff --git a/StreamingKit/StreamingKitMacTests/StreamingKitMacTests-Info.plist b/StreamingKit/StreamingKitMacTests/StreamingKitMacTests-Info.plist index 552d5b1..169b6f7 100644 --- a/StreamingKit/StreamingKitMacTests/StreamingKitMacTests-Info.plist +++ b/StreamingKit/StreamingKitMacTests/StreamingKitMacTests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.abstractpath.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/StreamingKit/StreamingKitTests/StreamingKitTests-Info.plist b/StreamingKit/StreamingKitTests/StreamingKitTests-Info.plist index 12b70c6..169b6f7 100644 --- a/StreamingKit/StreamingKitTests/StreamingKitTests-Info.plist +++ b/StreamingKit/StreamingKitTests/StreamingKitTests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - abstractpath.com.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType From dec8b874984385e4cf749306deeab81d09936995 Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Thu, 3 Dec 2015 16:18:50 +0000 Subject: [PATCH 09/19] Updated podspec version --- StreamingKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit.podspec b/StreamingKit.podspec index 2e7e9c1..b59dc7d 100644 --- a/StreamingKit.podspec +++ b/StreamingKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "StreamingKit" - s.version = "0.1.25" + s.version = "0.1.26" s.summary = "A fast and extensible audio streamer for iOS and OSX with support for gapless playback and custom (non-HTTP) sources." s.homepage = "https://github.com/tumtumtum/StreamingKit/" s.license = 'MIT' From 50bec46acc4091c0dc4d1c155b7750c777484b64 Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Thu, 3 Dec 2015 17:25:30 +0000 Subject: [PATCH 10/19] Fixed build issue with OSSTATUS_PRINTF_VALUE on 64bit --- StreamingKit/StreamingKit/STKAudioPlayer.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index cb15d47..6723ba8 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -64,7 +64,7 @@ #define STK_DEFAULT_GRACE_PERIOD_AFTER_SEEK_SECONDS (0.5) #define OSSTATUS_PRINTF_PLACEHOLDER @"%c%c%c%c" -#define OSSTATUS_PRINTF_VALUE(status) ((status) >> 24) & 0xFF, ((status) >> 16) & 0xFF, ((status) >> 8) & 0xFF, (status) & 0xFF +#define OSSTATUS_PRINTF_VALUE(status) (char)(((status) >> 24) & 0xFF), (char)(((status) >> 16) & 0xFF), (char)(((status) >> 8) & 0xFF), (char)((status) & 0xFF) #define LOGINFO(x) [self logInfo:[NSString stringWithFormat:@"%s %@", sel_getName(_cmd), x]]; From 590965736889bb9881c35bd8a54ac230fbf6db1b Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Fri, 4 Dec 2015 22:47:14 +0000 Subject: [PATCH 11/19] Changed enums to NS_ENUM to better support Swift. Added launch images to remove warnings --- .../LaunchImage.launchimage/Contents.json | 79 +++++++++++------- .../LaunchImage.launchimage/TX6sV-1.png | Bin 0 -> 17533 bytes .../LaunchImage.launchimage/TX6sV-2.png | Bin 0 -> 17533 bytes StreamingKit/StreamingKit/STKAudioPlayer.h | 15 ++-- 4 files changed, 56 insertions(+), 38 deletions(-) create mode 100644 ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV-1.png create mode 100644 ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV-2.png diff --git a/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/Contents.json b/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/Contents.json index 83b8ad2..fb0c438 100644 --- a/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -33,41 +33,62 @@ "minimum-system-version" : "7.0", "scale" : "2x" }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "retina4", + "filename" : "TX6sV-2.png", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, { "orientation" : "portrait", "idiom" : "iphone", "extent" : "full-screen", - "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "TX6sV-1.png", + "extent" : "full-screen", "subtype" : "retina4", "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" } ], "info" : { diff --git a/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV-1.png b/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV-1.png new file mode 100644 index 0000000000000000000000000000000000000000..20c76521156658b3955e79aa43bb6581f88f31aa GIT binary patch literal 17533 zcmeHP4^R}>8Gn1Odg8woDm78-=0p^u+#P?9lRpar!r*}-O-VF`6HdJdw>NjEoCIYr z)igGyRviNY6eq3H#1cqt3yp?5W2>QhN=-n6q-A)Z+G82$w0Mr+KhkJ z864j3`@Z+yx8L{szTNkGY+jVPV65M>egJ^6>1oN?0LVB1NV9wdyi&ULGW;J9*6amI z;Df(R>4c3@=Cl{B0E`ace+W=jGYNJtHRj~na&-%}1#EGszK~sR2(=fRd07x^*TP?m z4K_V(FD^1!we~oL&_fG<=PxT2w9v)2I!=+RTSU)iEe1L=G$K@`i1(vuI@VISLYtkO zio{_nPO-{nGi#N~l9H0plJHR0vQnvziHT9F!jxfQb77CU)^#SE-agl4oh~ZDdXf#+ z0*ldXGqNU{*Q;O7uCc`_6#PKGe`ub?W}VJAl*x+L1y`uF>&;4as7hH}tQ<}#!P2iGaVQ-yIn{2Qc z*BS~_Eo`x17_;7DHSm*+Q{Y(+l;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FOv`U^R?Y{tIHn6A3Yk7r^urt1-zQA$8OxmM!s z^60%>A|lHvsVe>7RHg8JfSrQs2|~77;C1%BG_O^KxbZ;XUoU@7EEHgtl*?VNZMq=T zJ};AXo#|SQIx`FdM*Or$0iBfR(|14ycGK&5h^kG>px>Gc12D6@i35is-KZX+DT?A8 z)2q`E6RmkT*-?M76&E@jtYoJAEg22tno9$AtP{~h~^G8q^lLYf!T>hXJ8+zj_gmGLsVF+u zR=O)$YzvoQKnoxU&ElJ5G2BUaC2Ks%zQL!-9p#6kQM!X+Ci3rFe~{T-jq4q% zQlROZZz}(Z6Cu;_8BFyR(@wFqxCVihfjj5;9h^9o-=(;`4UBU=PVaTFR9K>J$N9Wv z83Q)-6Q0{Rl51g2ll8|kbXJz?v%sq5^2l4~aA8sgtA~V%J#n}&c>*TD19t`6?OP&c z4-{bQYX7U=jmWONrTH^VeV41jdncmk} zoYTmbY?%8SK$$1<;+^shmlaMUavb3B&W4BFe^~DAzs4V)ztZ4!d&b|r>byP;zum~o lcDWi72=}p*?d5k9!avfTn-zJeng5$0=_#4XA0*|!_Af@{M;!nF literal 0 HcmV?d00001 diff --git a/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV-2.png b/ExampleApp/ExampleApp/Images.xcassets/LaunchImage.launchimage/TX6sV-2.png new file mode 100644 index 0000000000000000000000000000000000000000..20c76521156658b3955e79aa43bb6581f88f31aa GIT binary patch literal 17533 zcmeHP4^R}>8Gn1Odg8woDm78-=0p^u+#P?9lRpar!r*}-O-VF`6HdJdw>NjEoCIYr z)igGyRviNY6eq3H#1cqt3yp?5W2>QhN=-n6q-A)Z+G82$w0Mr+KhkJ z864j3`@Z+yx8L{szTNkGY+jVPV65M>egJ^6>1oN?0LVB1NV9wdyi&ULGW;J9*6amI z;Df(R>4c3@=Cl{B0E`ace+W=jGYNJtHRj~na&-%}1#EGszK~sR2(=fRd07x^*TP?m z4K_V(FD^1!we~oL&_fG<=PxT2w9v)2I!=+RTS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~kaFpJ#}og( zLrUpVN|#c)l+tNNdP|o+^GiD)_y4B-knhdku9%e4rIaqE^rs=EKNg=7q)9SQ+D;?f zy}1$W@a^Vo6bTobJ5w=xrApY%Da!V33P~Im$oP4xNI6d&%jhv(ka=Xsyx+C?c2Ltr z8pd|6{@z|JPnR076Q}Os?|La#vTkZl=hz zki?)xC6hp$le~l{*8Kkirv$WAlbFOv`U^R?Y{tIHn6A3Yk7r^urt1-zQA$8OxmM!s z^60%>A|lHvsVe>7RHg8JfSrQs2|~77;C1%BG_O^KxbZ;XUoU@7EEHgtl*?VNZMq=T zJ};AXo#|SQIx`FdM*Or$0iBfR(|14ycGK&5h^kG>px>Gc12D6@i35is-KZX+DT?A8 z)2q`E6RmkT*-?M76&E@jtYoJAEg22tno9$AtP{~h~^G8q^lLYf!T>hXJ8+zj_gmGLsVF+u zR=O)$YzvoQKnoxU&ElJ5G2BUaC2Ks%zQL!-9p#6kQM!X+Ci3rFe~{T-jq4q% zQlROZZz}(Z6Cu;_8BFyR(@wFqxCVihfjj5;9h^9o-=(;`4UBU=PVaTFR9K>J$N9Wv z83Q)-6Q0{Rl51g2ll8|kbXJz?v%sq5^2l4~aA8sgtA~V%J#n}&c>*TD19t`6?OP&c z4-{bQYX7U=jmWONrTH^VeV41jdncmk} zoYTmbY?%8SK$$1<;+^shmlaMUavb3B&W4BFe^~DAzs4V)ztZ4!d&b|r>byP;zum~o lcDWi72=}p*?d5k9!avfTn-zJeng5$0=_#4XA0*|!_Af@{M;!nF literal 0 HcmV?d00001 diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.h b/StreamingKit/StreamingKit/STKAudioPlayer.h index e4dd707..5c268ef 100644 --- a/StreamingKit/StreamingKit/STKAudioPlayer.h +++ b/StreamingKit/StreamingKit/STKAudioPlayer.h @@ -44,7 +44,7 @@ #include "UIKit/UIApplication.h" #endif -typedef enum +typedef NS_OPTIONS(NSInteger, STKAudioPlayerState) { STKAudioPlayerStateReady, STKAudioPlayerStateRunning = 1, @@ -54,10 +54,9 @@ typedef enum STKAudioPlayerStateStopped = (1 << 4), STKAudioPlayerStateError = (1 << 5), STKAudioPlayerStateDisposed = (1 << 6) -} -STKAudioPlayerState; +}; -typedef enum +typedef NS_ENUM(NSInteger, STKAudioPlayerStopReason) { STKAudioPlayerStopReasonNone = 0, STKAudioPlayerStopReasonEof, @@ -65,10 +64,9 @@ typedef enum STKAudioPlayerStopReasonPendingNext, STKAudioPlayerStopReasonDisposed, STKAudioPlayerStopReasonError = 0xffff -} -STKAudioPlayerStopReason; +}; -typedef enum +typedef NS_ENUM(NSInteger, STKAudioPlayerErrorCode) { STKAudioPlayerErrorNone = 0, STKAudioPlayerErrorDataSource, @@ -77,8 +75,7 @@ typedef enum STKAudioPlayerErrorCodecError, STKAudioPlayerErrorDataNotFound, STKAudioPlayerErrorOther = 0xffff -} -STKAudioPlayerErrorCode; +}; /// /// Options to initiailise the Audioplayer with. From 4d0fccdd703e0e4e5643be0328df926daf55c393 Mon Sep 17 00:00:00 2001 From: Reinder Nijhoff Date: Sun, 6 Dec 2015 14:06:15 +0100 Subject: [PATCH 12/19] Fixed memory leak --- StreamingKit/StreamingKit/STKAudioPlayer.m | 1 + 1 file changed, 1 insertion(+) diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index 6723ba8..2e39f6f 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -628,6 +628,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn pthread_cond_destroy(&mainThreadSyncCallReadyCondition); free(readBuffer); + free(pcmAudioBufferList.mBuffers[0].mData); } -(void) startSystemBackgroundTask From 8fa821a944b7873ec8d665f247d81050f1f5e54a Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Mon, 7 Dec 2015 12:59:32 +0000 Subject: [PATCH 13/19] Fixed int->double truncation in duration calculation --- StreamingKit/StreamingKit/STKQueueEntry.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit/StreamingKit/STKQueueEntry.m b/StreamingKit/StreamingKit/STKQueueEntry.m index 250b0c1..7ac18e9 100755 --- a/StreamingKit/StreamingKit/STKQueueEntry.m +++ b/StreamingKit/StreamingKit/STKQueueEntry.m @@ -46,7 +46,7 @@ { if (processedPacketsCount > STK_BIT_RATE_ESTIMATION_MIN_PACKETS_PREFERRED || (audioStreamBasicDescription.mBytesPerFrame == 0 && processedPacketsCount > STK_BIT_RATE_ESTIMATION_MIN_PACKETS_MIN)) { - double averagePacketByteSize = processedPacketsSizeTotal / processedPacketsCount; + double averagePacketByteSize = (double)processedPacketsSizeTotal / (double)processedPacketsCount; retval = averagePacketByteSize / packetDuration * 8; From da71b04aaffd5b7b13fc3a8d60235a5430cde62f Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Mon, 7 Dec 2015 13:02:44 +0000 Subject: [PATCH 14/19] Updated version number in podspec --- StreamingKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit.podspec b/StreamingKit.podspec index b59dc7d..44e7836 100644 --- a/StreamingKit.podspec +++ b/StreamingKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "StreamingKit" - s.version = "0.1.26" + s.version = "0.1.27" s.summary = "A fast and extensible audio streamer for iOS and OSX with support for gapless playback and custom (non-HTTP) sources." s.homepage = "https://github.com/tumtumtum/StreamingKit/" s.license = 'MIT' From d8b77ae214e5c1312e69a86bce8efca19aed3f60 Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Fri, 11 Dec 2015 01:06:53 +0000 Subject: [PATCH 15/19] Fixed bug in progressInFrames --- StreamingKit.podspec | 2 +- StreamingKit/StreamingKit/STKQueueEntry.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/StreamingKit.podspec b/StreamingKit.podspec index 44e7836..77f441d 100644 --- a/StreamingKit.podspec +++ b/StreamingKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "StreamingKit" - s.version = "0.1.27" + s.version = "0.1.28" s.summary = "A fast and extensible audio streamer for iOS and OSX with support for gapless playback and custom (non-HTTP) sources." s.homepage = "https://github.com/tumtumtum/StreamingKit/" s.license = 'MIT' diff --git a/StreamingKit/StreamingKit/STKQueueEntry.m b/StreamingKit/StreamingKit/STKQueueEntry.m index 7ac18e9..b5c351b 100755 --- a/StreamingKit/StreamingKit/STKQueueEntry.m +++ b/StreamingKit/StreamingKit/STKQueueEntry.m @@ -110,7 +110,7 @@ -(Float64) progressInFrames { OSSpinLockLock(&self->spinLock); - Float64 retval = self->seekTime + self->framesPlayed; + Float64 retval = (self->seekTime + self->audioStreamBasicDescription.mSampleRate) + self->framesPlayed; OSSpinLockUnlock(&self->spinLock); return retval; From 6ef69bacf0a5b1f6e5b27c71c535911f7e4e92c2 Mon Sep 17 00:00:00 2001 From: Kipp Hickman Date: Fri, 18 Dec 2015 13:54:51 -0800 Subject: [PATCH 16/19] Changed init methods to return instancetype instead of id. Using instancetype allows the compiler to perform more error checking. This article provides an in-depth explanation: http://nshipster.com/instancetype/. --- StreamingKit/StreamingKit/STKAudioPlayer.h | 4 ++-- StreamingKit/StreamingKit/STKAudioPlayer.m | 6 +++--- .../StreamingKit/STKAutoRecoveringHTTPDataSource.h | 2 +- .../StreamingKit/STKAutoRecoveringHTTPDataSource.m | 6 +++--- StreamingKit/StreamingKit/STKDataSourceWrapper.h | 2 +- StreamingKit/StreamingKit/STKDataSourceWrapper.m | 2 +- StreamingKit/StreamingKit/STKHTTPDataSource.h | 10 +++++----- StreamingKit/StreamingKit/STKHTTPDataSource.m | 8 ++++---- StreamingKit/StreamingKit/STKLocalFileDataSource.h | 2 +- StreamingKit/StreamingKit/STKLocalFileDataSource.m | 2 +- StreamingKit/StreamingKit/STKQueueEntry.h | 2 +- StreamingKit/StreamingKit/STKQueueEntry.m | 4 ++-- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.h b/StreamingKit/StreamingKit/STKAudioPlayer.h index 5c268ef..c6d429c 100644 --- a/StreamingKit/StreamingKit/STKAudioPlayer.h +++ b/StreamingKit/StreamingKit/STKAudioPlayer.h @@ -174,10 +174,10 @@ typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UIn +(STKDataSource*) dataSourceFromURL:(NSURL*)url; /// Initializes a new STKAudioPlayer with the default options --(id) init; +-(instancetype) init; /// Initializes a new STKAudioPlayer with the given options --(id) initWithOptions:(STKAudioPlayerOptions)optionsIn; +-(instancetype) initWithOptions:(STKAudioPlayerOptions)optionsIn; /// Plays an item from the given URL string (all pending queued items are removed). /// The NSString is used as the queue item ID diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index 0dac272..2ed83c8 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -173,7 +173,7 @@ STKAudioPlayerInternalState; @end @implementation STKFrameFilterEntry --(id) initWithFilter:(STKFrameFilter)filterIn andName:(NSString*)nameIn +-(instancetype) initWithFilter:(STKFrameFilter)filterIn andName:(NSString*)nameIn { if (self = [super init]) { @@ -504,12 +504,12 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn } } --(id) init +-(instancetype) init { return [self initWithOptions:(STKAudioPlayerOptions){}]; } --(id) initWithOptions:(STKAudioPlayerOptions)optionsIn +-(instancetype) initWithOptions:(STKAudioPlayerOptions)optionsIn { if (self = [super init]) { diff --git a/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.h b/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.h index c55895f..f9813ba 100644 --- a/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.h +++ b/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.h @@ -45,7 +45,7 @@ STKAutoRecoveringHTTPDataSourceOptions; @interface STKAutoRecoveringHTTPDataSource : STKDataSourceWrapper --(id) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSource; +-(instancetype) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSource; @property (readonly) STKHTTPDataSource* innerDataSource; diff --git a/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.m b/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.m index 445d44d..8dfe3a8 100644 --- a/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.m +++ b/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.m @@ -108,17 +108,17 @@ static void PopulateOptionsWithDefault(STKAutoRecoveringHTTPDataSourceOptions* o return (STKHTTPDataSource*)self.innerDataSource; } --(id) initWithDataSource:(STKDataSource *)innerDataSource +-(instancetype) initWithDataSource:(STKDataSource *)innerDataSource { return [self initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSource]; } --(id) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSourceIn +-(instancetype) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSourceIn { return [self initWithHTTPDataSource:innerDataSourceIn andOptions:(STKAutoRecoveringHTTPDataSourceOptions){}]; } --(id) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSourceIn andOptions:(STKAutoRecoveringHTTPDataSourceOptions)optionsIn +-(instancetype) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSourceIn andOptions:(STKAutoRecoveringHTTPDataSourceOptions)optionsIn { if (self = [super initWithDataSource:innerDataSourceIn]) { diff --git a/StreamingKit/StreamingKit/STKDataSourceWrapper.h b/StreamingKit/StreamingKit/STKDataSourceWrapper.h index 4d3e035..d91e9e5 100644 --- a/StreamingKit/StreamingKit/STKDataSourceWrapper.h +++ b/StreamingKit/StreamingKit/STKDataSourceWrapper.h @@ -36,7 +36,7 @@ @interface STKDataSourceWrapper : STKDataSource --(id) initWithDataSource:(STKDataSource*)innerDataSource; +-(instancetype) initWithDataSource:(STKDataSource*)innerDataSource; @property (readonly) STKDataSource* innerDataSource; diff --git a/StreamingKit/StreamingKit/STKDataSourceWrapper.m b/StreamingKit/StreamingKit/STKDataSourceWrapper.m index 76e1634..c75a499 100644 --- a/StreamingKit/StreamingKit/STKDataSourceWrapper.m +++ b/StreamingKit/StreamingKit/STKDataSourceWrapper.m @@ -40,7 +40,7 @@ @implementation STKDataSourceWrapper --(id) initWithDataSource:(STKDataSource*)innerDataSourceIn +-(instancetype) initWithDataSource:(STKDataSource*)innerDataSourceIn { if (self = [super init]) { diff --git a/StreamingKit/StreamingKit/STKHTTPDataSource.h b/StreamingKit/StreamingKit/STKHTTPDataSource.h index 9bf7002..d1cc366 100644 --- a/StreamingKit/StreamingKit/STKHTTPDataSource.h +++ b/StreamingKit/StreamingKit/STKHTTPDataSource.h @@ -46,11 +46,11 @@ typedef void(^STKAsyncURLProvider)(STKHTTPDataSource* dataSource, BOOL forSeek, @property (readonly) UInt32 httpStatusCode; +(AudioFileTypeID) audioFileTypeHintFromMimeType:(NSString*)fileExtension; --(id) initWithURL:(NSURL*)url; --(id) initWithURL:(NSURL *)url httpRequestHeaders:(NSDictionary *)httpRequestHeaders; --(id) initWithURLProvider:(STKURLProvider)urlProvider; --(id) initWithAsyncURLProvider:(STKAsyncURLProvider)asyncUrlProvider; --(NSRunLoop*) eventsRunLoop; +-(instancetype) initWithURL:(NSURL*)url; +-(instancetype) initWithURL:(NSURL*)url httpRequestHeaders:(NSDictionary*)httpRequestHeaders; +-(instancetype) initWithURLProvider:(STKURLProvider)urlProvider; +-(instancetype) initWithAsyncURLProvider:(STKAsyncURLProvider)asyncUrlProvider; +-(nullable NSRunLoop*) eventsRunLoop; -(void) reconnect; @end diff --git a/StreamingKit/StreamingKit/STKHTTPDataSource.m b/StreamingKit/StreamingKit/STKHTTPDataSource.m index bd66ab5..47d4a48 100755 --- a/StreamingKit/StreamingKit/STKHTTPDataSource.m +++ b/StreamingKit/StreamingKit/STKHTTPDataSource.m @@ -64,19 +64,19 @@ @implementation STKHTTPDataSource --(id) initWithURL:(NSURL*)urlIn +-(instancetype) initWithURL:(NSURL*)urlIn { return [self initWithURLProvider:^NSURL* { return urlIn; }]; } --(id) initWithURL:(NSURL *)urlIn httpRequestHeaders:(NSDictionary *)httpRequestHeaders +-(instancetype) initWithURL:(NSURL *)urlIn httpRequestHeaders:(NSDictionary *)httpRequestHeaders { self = [self initWithURLProvider:^NSURL* { return urlIn; }]; self->requestHeaders = httpRequestHeaders; return self; } --(id) initWithURLProvider:(STKURLProvider)urlProviderIn +-(instancetype) initWithURLProvider:(STKURLProvider)urlProviderIn { urlProviderIn = [urlProviderIn copy]; @@ -86,7 +86,7 @@ }]; } --(id) initWithAsyncURLProvider:(STKAsyncURLProvider)asyncUrlProviderIn +-(instancetype) initWithAsyncURLProvider:(STKAsyncURLProvider)asyncUrlProviderIn { if (self = [super init]) { diff --git a/StreamingKit/StreamingKit/STKLocalFileDataSource.h b/StreamingKit/StreamingKit/STKLocalFileDataSource.h index 2a5f571..ee918c7 100644 --- a/StreamingKit/StreamingKit/STKLocalFileDataSource.h +++ b/StreamingKit/StreamingKit/STKLocalFileDataSource.h @@ -38,6 +38,6 @@ +(AudioFileTypeID) audioFileTypeHintFromFileExtension:(NSString*)fileExtension; @property (readonly, copy) NSString* filePath; --(id) initWithFilePath:(NSString*)filePath; +-(instancetype) initWithFilePath:(NSString*)filePath; @end diff --git a/StreamingKit/StreamingKit/STKLocalFileDataSource.m b/StreamingKit/StreamingKit/STKLocalFileDataSource.m index 2aded28..afdd2fd 100644 --- a/StreamingKit/StreamingKit/STKLocalFileDataSource.m +++ b/StreamingKit/StreamingKit/STKLocalFileDataSource.m @@ -47,7 +47,7 @@ @implementation STKLocalFileDataSource @synthesize filePath; --(id) initWithFilePath:(NSString*)filePathIn +-(instancetype) initWithFilePath:(NSString*)filePathIn { if (self = [super init]) { diff --git a/StreamingKit/StreamingKit/STKQueueEntry.h b/StreamingKit/StreamingKit/STKQueueEntry.h index 3ae6f6a..a5fa781 100755 --- a/StreamingKit/StreamingKit/STKQueueEntry.h +++ b/StreamingKit/StreamingKit/STKQueueEntry.h @@ -35,7 +35,7 @@ @property (readwrite, retain) NSObject* queueItemId; @property (readwrite, retain) STKDataSource* dataSource; --(id) initWithDataSource:(STKDataSource*)dataSource andQueueItemId:(NSObject*)queueItemId; +-(instancetype) initWithDataSource:(STKDataSource*)dataSource andQueueItemId:(NSObject*)queueItemId; -(void) reset; -(double) duration; diff --git a/StreamingKit/StreamingKit/STKQueueEntry.m b/StreamingKit/StreamingKit/STKQueueEntry.m index b5c351b..0c1d1e3 100755 --- a/StreamingKit/StreamingKit/STKQueueEntry.m +++ b/StreamingKit/StreamingKit/STKQueueEntry.m @@ -14,7 +14,7 @@ @implementation STKQueueEntry --(id) initWithDataSource:(STKDataSource*)dataSourceIn andQueueItemId:(NSObject*)queueItemIdIn +-(instancetype) initWithDataSource:(STKDataSource*)dataSourceIn andQueueItemId:(NSObject*)queueItemIdIn { if (self = [super init]) { @@ -121,4 +121,4 @@ return [[self queueItemId] description]; } -@end \ No newline at end of file +@end From 830ed0f3dbe0789ae8b146b6f8f4f0fcdb035416 Mon Sep 17 00:00:00 2001 From: Kipp Hickman Date: Fri, 18 Dec 2015 14:03:33 -0800 Subject: [PATCH 17/19] Added nullablity tags for better Swift compatibility. --- .../StreamingKit/NSMutableArray+STKAudioPlayer.h | 8 ++++++-- StreamingKit/StreamingKit/STKAudioPlayer.h | 10 +++++++--- .../StreamingKit/STKAutoRecoveringHTTPDataSource.h | 4 ++++ .../StreamingKit/STKCoreFoundationDataSource.h | 4 ++++ StreamingKit/StreamingKit/STKDataSource.h | 8 ++++++-- StreamingKit/StreamingKit/STKDataSourceWrapper.h | 4 ++++ StreamingKit/StreamingKit/STKHTTPDataSource.h | 6 +++++- StreamingKit/StreamingKit/STKLocalFileDataSource.h | 4 ++++ StreamingKit/StreamingKit/STKQueueEntry.h | 6 +++++- 9 files changed, 45 insertions(+), 9 deletions(-) diff --git a/StreamingKit/StreamingKit/NSMutableArray+STKAudioPlayer.h b/StreamingKit/StreamingKit/NSMutableArray+STKAudioPlayer.h index 12ca839..1e4de5f 100644 --- a/StreamingKit/StreamingKit/NSMutableArray+STKAudioPlayer.h +++ b/StreamingKit/StreamingKit/NSMutableArray+STKAudioPlayer.h @@ -8,10 +8,14 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface NSMutableArray (STKAudioPlayer) -(void) enqueue:(id)obj; -(void) skipQueue:(id)obj; -(void) skipQueueWithQueue:(NSMutableArray*)queue; --(id) dequeue; --(id) peek; +-(nullable id) dequeue; +-(nullable id) peek; @end + +NS_ASSUME_NONNULL_END diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.h b/StreamingKit/StreamingKit/STKAudioPlayer.h index c6d429c..a1ff3b5 100644 --- a/StreamingKit/StreamingKit/STKAudioPlayer.h +++ b/StreamingKit/StreamingKit/STKAudioPlayer.h @@ -44,6 +44,8 @@ #include "UIKit/UIApplication.h" #endif +NS_ASSUME_NONNULL_BEGIN + typedef NS_OPTIONS(NSInteger, STKAudioPlayerState) { STKAudioPlayerStateReady, @@ -151,13 +153,13 @@ typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UIn /// Enables or disables the EQ @property (readwrite) BOOL equalizerEnabled; /// Returns an array of STKFrameFilterEntry objects representing the filters currently in use -@property (readonly) NSArray* frameFilters; +@property (readonly, nullable) NSArray* frameFilters; /// Returns the items pending to be played (includes buffering and upcoming items but does not include the current item) @property (readonly) NSArray* pendingQueue; /// The number of items pending to be played (includes buffering and upcoming items but does not include the current item) @property (readonly) NSUInteger pendingQueueCount; /// Gets the most recently queued item that is still pending to play -@property (readonly) NSObject* mostRecentlyQueuedStillPendingItem; +@property (readonly, nullable) NSObject* mostRecentlyQueuedStillPendingItem; /// Gets the current state of the player @property (readwrite) STKAudioPlayerState state; /// Gets the options provided to the player on startup @@ -254,7 +256,7 @@ typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UIn /// Appends a frame filter with the given name and filter block just after the filter with the given name. /// If the given name is nil, the filter will be inserted at the beginning of the filter change --(void) addFrameFilterWithName:(NSString*)name afterFilterWithName:(NSString*)afterFilterWithName block:(STKFrameFilter)block; +-(void) addFrameFilterWithName:(NSString*)name afterFilterWithName:(nullable NSString*)afterFilterWithName block:(STKFrameFilter)block; /// Reads the peak power in decibals for the given channel (0 or 1). /// Return values are between -60 (low) and 0 (high). @@ -268,3 +270,5 @@ typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UIn -(void) setGain:(float)gain forEqualizerBand:(int)bandIndex; @end + +NS_ASSUME_NONNULL_END diff --git a/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.h b/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.h index f9813ba..bab707b 100644 --- a/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.h +++ b/StreamingKit/StreamingKit/STKAutoRecoveringHTTPDataSource.h @@ -36,6 +36,8 @@ #import "STKHTTPDataSource.h" #import "STKDataSourceWrapper.h" +NS_ASSUME_NONNULL_BEGIN + typedef struct { int watchdogPeriodSeconds; @@ -50,3 +52,5 @@ STKAutoRecoveringHTTPDataSourceOptions; @property (readonly) STKHTTPDataSource* innerDataSource; @end + +NS_ASSUME_NONNULL_END diff --git a/StreamingKit/StreamingKit/STKCoreFoundationDataSource.h b/StreamingKit/StreamingKit/STKCoreFoundationDataSource.h index b25a72e..b1dd325 100644 --- a/StreamingKit/StreamingKit/STKCoreFoundationDataSource.h +++ b/StreamingKit/StreamingKit/STKCoreFoundationDataSource.h @@ -34,6 +34,8 @@ #import "STKDataSource.h" +NS_ASSUME_NONNULL_BEGIN + @class STKCoreFoundationDataSource; @interface CoreFoundationDataSourceClientInfo : NSObject @@ -62,3 +64,5 @@ -(CFStreamStatus) status; @end + +NS_ASSUME_NONNULL_END diff --git a/StreamingKit/StreamingKit/STKDataSource.h b/StreamingKit/StreamingKit/STKDataSource.h index 8ca4150..0a1e716 100755 --- a/StreamingKit/StreamingKit/STKDataSource.h +++ b/StreamingKit/StreamingKit/STKDataSource.h @@ -35,6 +35,8 @@ #import #include +NS_ASSUME_NONNULL_BEGIN + @class STKDataSource; @protocol STKDataSourceDelegate @@ -50,8 +52,8 @@ @property (readonly) SInt64 length; @property (readonly) BOOL hasBytesAvailable; @property (nonatomic, readwrite, assign) double durationHint; -@property (readwrite, unsafe_unretained) id delegate; -@property (nonatomic, strong) NSURL *recordToFileUrl; +@property (readwrite, unsafe_unretained, nullable) id delegate; +@property (nonatomic, strong, nullable) NSURL *recordToFileUrl; -(BOOL) registerForEvents:(NSRunLoop*)runLoop; -(void) unregisterForEvents; @@ -62,3 +64,5 @@ -(AudioFileTypeID) audioFileTypeHint; @end + +NS_ASSUME_NONNULL_END diff --git a/StreamingKit/StreamingKit/STKDataSourceWrapper.h b/StreamingKit/StreamingKit/STKDataSourceWrapper.h index d91e9e5..cde9b73 100644 --- a/StreamingKit/StreamingKit/STKDataSourceWrapper.h +++ b/StreamingKit/StreamingKit/STKDataSourceWrapper.h @@ -34,6 +34,8 @@ #import "STKDataSource.h" +NS_ASSUME_NONNULL_BEGIN + @interface STKDataSourceWrapper : STKDataSource -(instancetype) initWithDataSource:(STKDataSource*)innerDataSource; @@ -41,3 +43,5 @@ @property (readonly) STKDataSource* innerDataSource; @end + +NS_ASSUME_NONNULL_END diff --git a/StreamingKit/StreamingKit/STKHTTPDataSource.h b/StreamingKit/StreamingKit/STKHTTPDataSource.h index d1cc366..691bbff 100644 --- a/StreamingKit/StreamingKit/STKHTTPDataSource.h +++ b/StreamingKit/StreamingKit/STKHTTPDataSource.h @@ -34,10 +34,12 @@ #import "STKCoreFoundationDataSource.h" +NS_ASSUME_NONNULL_BEGIN + @class STKHTTPDataSource; typedef void(^STKURLBlock)(NSURL* url); -typedef NSURL*(^STKURLProvider)(); +typedef NSURL* _Nonnull (^STKURLProvider)(); typedef void(^STKAsyncURLProvider)(STKHTTPDataSource* dataSource, BOOL forSeek, STKURLBlock callback); @interface STKHTTPDataSource : STKCoreFoundationDataSource @@ -54,3 +56,5 @@ typedef void(^STKAsyncURLProvider)(STKHTTPDataSource* dataSource, BOOL forSeek, -(void) reconnect; @end + +NS_ASSUME_NONNULL_END diff --git a/StreamingKit/StreamingKit/STKLocalFileDataSource.h b/StreamingKit/StreamingKit/STKLocalFileDataSource.h index ee918c7..581f42d 100644 --- a/StreamingKit/StreamingKit/STKLocalFileDataSource.h +++ b/StreamingKit/StreamingKit/STKLocalFileDataSource.h @@ -34,6 +34,8 @@ #import "STKCoreFoundationDataSource.h" +NS_ASSUME_NONNULL_BEGIN + @interface STKLocalFileDataSource : STKCoreFoundationDataSource +(AudioFileTypeID) audioFileTypeHintFromFileExtension:(NSString*)fileExtension; @@ -41,3 +43,5 @@ -(instancetype) initWithFilePath:(NSString*)filePath; @end + +NS_ASSUME_NONNULL_END diff --git a/StreamingKit/StreamingKit/STKQueueEntry.h b/StreamingKit/StreamingKit/STKQueueEntry.h index a5fa781..f13d277 100755 --- a/StreamingKit/StreamingKit/STKQueueEntry.h +++ b/StreamingKit/StreamingKit/STKQueueEntry.h @@ -10,6 +10,8 @@ #import "libkern/OSAtomic.h" #import "AudioToolbox/AudioToolbox.h" +NS_ASSUME_NONNULL_BEGIN + @interface STKQueueEntry : NSObject { @public @@ -43,4 +45,6 @@ -(double) calculatedBitRate; -(BOOL) isDefinitelyCompatible:(AudioStreamBasicDescription*)basicDescription; -@end \ No newline at end of file +@end + +NS_ASSUME_NONNULL_END From 204333028775d9f033fb3043b09074d2e839b969 Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Mon, 4 Jan 2016 11:05:20 +0000 Subject: [PATCH 18/19] Removed commented out bad code --- StreamingKit/StreamingKit/STKAudioPlayer.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m index d4278b7..46affb4 100755 --- a/StreamingKit/StreamingKit/STKAudioPlayer.m +++ b/StreamingKit/StreamingKit/STKAudioPlayer.m @@ -1977,9 +1977,8 @@ static BOOL GetHardwareCodecClassDesc(UInt32 formatId, AudioClassDescription* cl [self destroyAudioConverter]; - //canonicalAudioStreamBasicDescription.mChannelsPerFrame = asbd->mChannelsPerFrame; - BOOL isRecording = currentlyReadingEntry.dataSource.recordToFileUrl != nil; + if (isRecording) { recordAudioStreamBasicDescription = (AudioStreamBasicDescription) From 2d251d51504248eecdbbddb1f3210ff5b0faebb6 Mon Sep 17 00:00:00 2001 From: Thong Nguyen Date: Mon, 4 Jan 2016 11:06:47 +0000 Subject: [PATCH 19/19] Updated podspec --- StreamingKit.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StreamingKit.podspec b/StreamingKit.podspec index 77f441d..289f402 100644 --- a/StreamingKit.podspec +++ b/StreamingKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "StreamingKit" - s.version = "0.1.28" + s.version = "0.1.29" s.summary = "A fast and extensible audio streamer for iOS and OSX with support for gapless playback and custom (non-HTTP) sources." s.homepage = "https://github.com/tumtumtum/StreamingKit/" s.license = 'MIT'