diff --git a/ExampleApp/ExampleApp.xcodeproj/project.pbxproj b/ExampleApp/ExampleApp.xcodeproj/project.pbxproj
index c3c7a22..df75a2a 100644
--- a/ExampleApp/ExampleApp.xcodeproj/project.pbxproj
+++ b/ExampleApp/ExampleApp.xcodeproj/project.pbxproj
@@ -279,7 +279,7 @@
A1115929188D686000641365 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0710;
+ LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Thong Nguyen";
TargetAttributes = {
A111594B188D686000641365 = {
@@ -427,19 +427,32 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@@ -457,7 +470,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../StreamingKit/StreamingKit",
);
- IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -472,18 +485,31 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -495,7 +521,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../StreamingKit/StreamingKit",
);
- IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
@@ -511,7 +537,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ExampleApp/ExampleApp-Prefix.pch";
INFOPLIST_FILE = "ExampleApp/ExampleApp-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LLVM_LTO = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "abstractpath.com.${PRODUCT_NAME:rfc1034identifier}";
@@ -528,7 +554,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ExampleApp/ExampleApp-Prefix.pch";
INFOPLIST_FILE = "ExampleApp/ExampleApp-Info.plist";
- IPHONEOS_DEPLOYMENT_TARGET = 6.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LLVM_LTO = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = "abstractpath.com.${PRODUCT_NAME:rfc1034identifier}";
diff --git a/ExampleApp/ExampleApp/AppDelegate.m b/ExampleApp/ExampleApp/AppDelegate.m
index 4bab79f..4164cc9 100644
--- a/ExampleApp/ExampleApp/AppDelegate.m
+++ b/ExampleApp/ExampleApp/AppDelegate.m
@@ -24,13 +24,12 @@
-(BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
NSError* error;
+ Float32 bufferLength = 0.1;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&error];
+ [[AVAudioSession sharedInstance] setPreferredIOBufferDuration:bufferLength error:&error];
[[AVAudioSession sharedInstance] setActive:YES error:&error];
- Float32 bufferLength = 0.1;
- AudioSessionSetProperty(kAudioSessionProperty_PreferredHardwareIOBufferDuration, sizeof(bufferLength), &bufferLength);
-
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [[UIViewController alloc] init];
diff --git a/ExampleApp/ExampleApp/AudioPlayerView.m b/ExampleApp/ExampleApp/AudioPlayerView.m
index 1ff064b..5b17e6f 100644
--- a/ExampleApp/ExampleApp/AudioPlayerView.m
+++ b/ExampleApp/ExampleApp/AudioPlayerView.m
@@ -388,7 +388,9 @@
- (void)audioPlayer:(STKAudioPlayer *)audioPlayer didReadStreamMetadata:(NSDictionary *)dictionary
{
- metadataLabel.text = dictionary[@"StreamTitle"];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ self->metadataLabel.text = dictionary[@"StreamTitle"];
+ });
}
@end
diff --git a/ExampleAppMac/ExampleAppMac.xcodeproj/project.pbxproj b/ExampleAppMac/ExampleAppMac.xcodeproj/project.pbxproj
index 727c796..d1a48f7 100644
--- a/ExampleAppMac/ExampleAppMac.xcodeproj/project.pbxproj
+++ b/ExampleAppMac/ExampleAppMac.xcodeproj/project.pbxproj
@@ -238,7 +238,7 @@
A1A49999189E765800E2A2E2 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0500;
+ LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Thong Nguyen";
TargetAttributes = {
A1A499C1189E765800E2A2E2 = {
@@ -358,18 +358,32 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@@ -382,7 +396,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.9;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
@@ -395,26 +409,39 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.9;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
SDKROOT = macosx;
};
name = Release;
@@ -432,8 +459,8 @@
"$(SRCROOT)/../StreamingKit/StreamingKit",
);
INFOPLIST_FILE = "ExampleAppMac/ExampleAppMac-Info.plist";
- MACOSX_DEPLOYMENT_TARGET = "";
OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.abstractpath.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -452,8 +479,8 @@
"$(SRCROOT)/../StreamingKit/StreamingKit",
);
INFOPLIST_FILE = "ExampleAppMac/ExampleAppMac-Info.plist";
- MACOSX_DEPLOYMENT_TARGET = "";
OTHER_LDFLAGS = "-ObjC";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.abstractpath.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -476,6 +503,7 @@
);
INFOPLIST_FILE = "ExampleAppMacTests/ExampleAppMacTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = "com.abstractpath.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
@@ -495,6 +523,7 @@
GCC_PREFIX_HEADER = "ExampleAppMac/ExampleAppMac-Prefix.pch";
INFOPLIST_FILE = "ExampleAppMacTests/ExampleAppMacTests-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = "com.abstractpath.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
diff --git a/ExampleAppMac/ExampleAppMac/ExampleAppMac-Info.plist b/ExampleAppMac/ExampleAppMac/ExampleAppMac-Info.plist
index 9248f20..322bcf5 100644
--- a/ExampleAppMac/ExampleAppMac/ExampleAppMac-Info.plist
+++ b/ExampleAppMac/ExampleAppMac/ExampleAppMac-Info.plist
@@ -9,7 +9,7 @@
CFBundleIconFile
CFBundleIdentifier
- com.abstractpath.${PRODUCT_NAME:rfc1034identifier}
+ $(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
diff --git a/ExampleAppMac/ExampleAppMacTests/ExampleAppMacTests-Info.plist b/ExampleAppMac/ExampleAppMacTests/ExampleAppMacTests-Info.plist
index 552d5b1..169b6f7 100644
--- a/ExampleAppMac/ExampleAppMacTests/ExampleAppMacTests-Info.plist
+++ b/ExampleAppMac/ExampleAppMacTests/ExampleAppMacTests-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/StreamingKit.xcodeproj/project.pbxproj b/StreamingKit/StreamingKit.xcodeproj/project.pbxproj
index 84d70e1..dea8ebc 100644
--- a/StreamingKit/StreamingKit.xcodeproj/project.pbxproj
+++ b/StreamingKit/StreamingKit.xcodeproj/project.pbxproj
@@ -437,7 +437,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = STK;
- LastUpgradeCheck = 0710;
+ LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Thong Nguyen";
};
buildConfigurationList = A1E7C4C3188D57F50010896F /* Build configuration list for PBXProject "StreamingKit" */;
@@ -681,18 +681,31 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@@ -705,7 +718,8 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
@@ -719,24 +733,38 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MACOSX_DEPLOYMENT_TARGET = 10.9;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.h b/StreamingKit/StreamingKit/STKAudioPlayer.h
index 698b590..81a0bf9 100644
--- a/StreamingKit/StreamingKit/STKAudioPlayer.h
+++ b/StreamingKit/StreamingKit/STKAudioPlayer.h
@@ -135,7 +135,7 @@ typedef void(^STKFrameFilter)(UInt32 channelsPerFrame, UInt32 bytesPerFrame, UIn
/// Raised when items queued items are cleared (usually because of a call to play, setDataSource or stop)
-(void) audioPlayer:(STKAudioPlayer*)audioPlayer didCancelQueuedItems:(NSArray*)queuedItems;
-/// Raised when datasource read stream metadata
+/// Raised when datasource read stream metadata. Called from the non-main thread.
-(void) audioPlayer:(STKAudioPlayer*)audioPlayer didReadStreamMetadata:(NSDictionary*)dictionary;
@end
diff --git a/StreamingKit/StreamingKit/STKAudioPlayer.m b/StreamingKit/StreamingKit/STKAudioPlayer.m
index e0b5ca0..c151ba0 100755
--- a/StreamingKit/StreamingKit/STKAudioPlayer.m
+++ b/StreamingKit/StreamingKit/STKAudioPlayer.m
@@ -255,8 +255,8 @@ static AudioStreamBasicDescription recordAudioStreamBasicDescription;
NSMutableArray* upcomingQueue;
NSMutableArray* bufferingQueue;
- os_unfair_lock *pcmBufferSpinLock;
- os_unfair_lock *internalStateLock;
+ os_unfair_lock pcmBufferSpinLock;
+ os_unfair_lock internalStateLock;
volatile UInt32 pcmBufferTotalFrameCount;
volatile UInt32 pcmBufferFrameStartIndex;
volatile UInt32 pcmBufferUsedFrameCount;
@@ -286,11 +286,11 @@ static AudioStreamBasicDescription recordAudioStreamBasicDescription;
UInt32 recordPacketSize;
AudioStreamPacketDescription *recordPacketDescriptions;
- void(^stopBackBackgroundTaskBlock)();
+ void(^stopBackBackgroundTaskBlock)(void);
int32_t seekVersion;
- os_unfair_lock *seekLock;
- os_unfair_lock *currentEntryReferencesLock;
+ os_unfair_lock seekLock;
+ os_unfair_lock currentEntryReferencesLock;
pthread_mutex_t playerMutex;
pthread_cond_t playerThreadReadyCondition;
@@ -451,13 +451,13 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
break;
}
- setLock(internalStateLock);
+ setLock(&internalStateLock);
waitingForDataAfterSeekFrameCount = 0;
if (value == internalState)
{
- lockUnlock(internalStateLock);
+ lockUnlock(&internalStateLock);
return;
}
@@ -466,7 +466,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
{
if (!ifInState(self->internalState))
{
- lockUnlock(internalStateLock);
+ lockUnlock(&internalStateLock);
return;
}
@@ -480,7 +480,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
{
self.state = newState;
- lockUnlock(internalStateLock);
+ lockUnlock(&internalStateLock);
dispatch_async(dispatch_get_main_queue(), ^
{
@@ -489,7 +489,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
}
else
{
- lockUnlock(internalStateLock);
+ lockUnlock(&internalStateLock);
}
}
@@ -525,10 +525,10 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
{
if (self = [super init])
{
- pcmBufferSpinLock = &(OS_UNFAIR_LOCK_INIT);
- internalStateLock = &(OS_UNFAIR_LOCK_INIT);
- seekLock = &(OS_UNFAIR_LOCK_INIT);
- currentEntryReferencesLock = &(OS_UNFAIR_LOCK_INIT);
+ pcmBufferSpinLock = OS_UNFAIR_LOCK_INIT;
+ internalStateLock = OS_UNFAIR_LOCK_INIT;
+ seekLock = OS_UNFAIR_LOCK_INIT;
+ currentEntryReferencesLock = OS_UNFAIR_LOCK_INIT;
options = optionsIn;
@@ -596,9 +596,9 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
currentlyPlayingEntry.dataSource.delegate = nil;
[currentlyReadingEntry.dataSource unregisterForEvents];
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
currentlyPlayingEntry = nil;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
}
[self closeRecordAudioFile];
@@ -1002,9 +1002,9 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
return 0;
}
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
STKQueueEntry* entry = currentlyPlayingEntry;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
if (entry == nil)
{
@@ -1034,18 +1034,18 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
return 0;
}
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
STKQueueEntry* entry = currentlyPlayingEntry;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
if (entry == nil)
{
return 0;
}
- setLock(entry->spinLock);
+ setLock(&entry->spinLock);
double retval = entry->seekTime + (entry->framesPlayed / canonicalAudioStreamBasicDescription.mSampleRate);
- lockUnlock(entry->spinLock);
+ lockUnlock(&entry->spinLock);
return retval;
}
@@ -1074,7 +1074,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
AudioUnitSetParameter(playbackRateUnit, kNewTimePitchParam_Overlap, kAudioUnitScope_Global, 0, overlap, 0);
}
--(BOOL) invokeOnPlaybackThread:(void(^)())block
+-(BOOL) invokeOnPlaybackThread:(void(^)(void))block
{
NSRunLoop* runLoop = playbackThreadRunLoop;
@@ -1113,7 +1113,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
return;
}
- setLock(seekLock);
+ setLock(&seekLock);
BOOL seekAlreadyRequested = seekToTimeWasRequested;
@@ -1124,14 +1124,14 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
{
OSAtomicIncrement32(&seekVersion);
- lockUnlock(seekLock);
+ lockUnlock(&seekLock);
[self wakeupPlaybackThread];
return;
}
- lockUnlock(seekLock);
+ lockUnlock(&seekLock);
}
-(void) createPlaybackThread
@@ -1182,9 +1182,9 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
[currentlyReadingEntry.dataSource close];
}
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
currentlyReadingEntry = entry;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
currentlyReadingEntry.dataSource.delegate = self;
[currentlyReadingEntry.dataSource registerForEvents:[NSRunLoop currentRunLoop]];
@@ -1228,25 +1228,25 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
{
if (!isPlayingSameItemProbablySeek)
{
- setLock(next->spinLock);
+ setLock(&next->spinLock);
next->seekTime = 0;
- lockUnlock(next->spinLock);
+ lockUnlock(&next->spinLock);
- setLock(seekLock);
+ setLock(&seekLock);
seekToTimeWasRequested = NO;
- lockUnlock(seekLock);
+ lockUnlock(&seekLock);
}
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
currentlyPlayingEntry = next;
NSObject* playingQueueItemId = playingQueueItemId = currentlyPlayingEntry.queueItemId;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
if (!isPlayingSameItemProbablySeek && entry)
{
[self playbackThreadQueueMainThreadSyncBlock:^
{
- [self.delegate audioPlayer:self didFinishPlayingQueueItemId:queueItemId withReason:stopReason andProgress:progress andDuration:duration];
+ [self.delegate audioPlayer:self didFinishPlayingQueueItemId:queueItemId withReason:self->stopReason andProgress:progress andDuration:duration];
}];
}
@@ -1262,15 +1262,15 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
}
else
{
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
currentlyPlayingEntry = nil;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
if (!isPlayingSameItemProbablySeek && entry)
{
[self playbackThreadQueueMainThreadSyncBlock:^
{
- [self.delegate audioPlayer:self didFinishPlayingQueueItemId:queueItemId withReason:stopReason andProgress:progress andDuration:duration];
+ [self.delegate audioPlayer:self didFinishPlayingQueueItemId:queueItemId withReason:self->stopReason andProgress:progress andDuration:duration];
}];
}
}
@@ -1278,7 +1278,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
[self wakeupPlaybackThread];
}
--(void) dispatchSyncOnMainThread:(void(^)())block
+-(void) dispatchSyncOnMainThread:(void(^)(void))block
{
__block BOOL finished = NO;
@@ -1289,15 +1289,15 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
dispatch_async(dispatch_get_main_queue(), ^
{
- if (!disposeWasRequested)
+ if (!self->disposeWasRequested)
{
block();
}
- pthread_mutex_lock(&mainThreadSyncCallMutex);
+ pthread_mutex_lock(&self->mainThreadSyncCallMutex);
finished = YES;
- pthread_cond_signal(&mainThreadSyncCallReadyCondition);
- pthread_mutex_unlock(&mainThreadSyncCallMutex);
+ pthread_cond_signal(&self->mainThreadSyncCallReadyCondition);
+ pthread_mutex_unlock(&self->mainThreadSyncCallMutex);
});
pthread_mutex_lock(&mainThreadSyncCallMutex);
@@ -1320,13 +1320,13 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
pthread_mutex_unlock(&mainThreadSyncCallMutex);
}
--(void) playbackThreadQueueMainThreadSyncBlock:(void(^)())block
+-(void) playbackThreadQueueMainThreadSyncBlock:(void(^)(void))block
{
block = [block copy];
[self invokeOnPlaybackThread:^
{
- if (disposeWasRequested)
+ if (self->disposeWasRequested)
{
return;
}
@@ -1426,21 +1426,21 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
int32_t originalSeekVersion;
BOOL originalSeekToTimeRequested;
- setLock(seekLock);
+ setLock(&seekLock);
originalSeekVersion = seekVersion;
originalSeekToTimeRequested = seekToTimeWasRequested;
- lockUnlock(seekLock);
+ lockUnlock(&seekLock);
if (originalSeekToTimeRequested && currentlyReadingEntry == currentlyPlayingEntry)
{
[self processSeekToTime];
- setLock(seekLock);
+ setLock(&seekLock);
if (originalSeekVersion == seekVersion)
{
seekToTimeWasRequested = NO;
}
- lockUnlock(seekLock);
+ lockUnlock(&seekLock);
}
}
else if (currentlyPlayingEntry == nil && seekToTimeWasRequested)
@@ -1489,10 +1489,10 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
currentlyPlayingEntry.dataSource.delegate = nil;
pthread_mutex_lock(&playerMutex);
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
currentlyPlayingEntry = nil;
currentlyReadingEntry = nil;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
pthread_mutex_unlock(&playerMutex);
[self closeRecordAudioFile];
@@ -1527,9 +1527,9 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
seekByteOffset = currentEntry.dataSource.length - 2 * currentEntry->packetBufferSize;
}
- setLock(currentEntry->spinLock);
+ setLock(¤tEntry->spinLock);
currentEntry->seekTime = requestedSeekTime;
- lockUnlock(currentEntry->spinLock);
+ lockUnlock(¤tEntry->spinLock);
double calculatedBitRate = [currentEntry calculatedBitRate];
@@ -1546,9 +1546,9 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
if (!(ioFlags & kAudioFileStreamSeekFlag_OffsetIsEstimated)) {
double delta = ((seekByteOffset - (SInt64)currentEntry->audioDataOffset) - packetAlignedByteOffset) / calculatedBitRate * 8;
- setLock(currentEntry->spinLock);
+ setLock(¤tEntry->spinLock);
currentEntry->seekTime -= delta;
- lockUnlock(currentEntry->spinLock);
+ lockUnlock(¤tEntry->spinLock);
}
}
}
@@ -1642,7 +1642,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
return;
}
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
if (currentlyReadingEntry == nil)
{
@@ -1650,7 +1650,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
[dataSourceIn close];
}
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
}
}
@@ -1700,17 +1700,17 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
return;
}
- setLock(currentlyReadingEntry->spinLock);
+ setLock(¤tlyReadingEntry->spinLock);
currentlyReadingEntry->lastFrameQueued = currentlyReadingEntry->framesQueued;
- lockUnlock(currentlyReadingEntry->spinLock);
+ lockUnlock(¤tlyReadingEntry->spinLock);
currentlyReadingEntry.dataSource.delegate = nil;
[currentlyReadingEntry.dataSource unregisterForEvents];
[currentlyReadingEntry.dataSource close];
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
currentlyReadingEntry = nil;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
pthread_mutex_unlock(&playerMutex);
@@ -1791,7 +1791,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
-(void) resetPcmBuffers
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
self->pcmBufferFrameStartIndex = 0;
self->pcmBufferUsedFrameCount = 0;
@@ -1800,7 +1800,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
self->averagePowerDb[0] = STK_DBMIN;
self->averagePowerDb[1] = STK_DBMIN;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
}
-(void) stop
@@ -1822,26 +1822,26 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
[self invokeOnPlaybackThread:^
{
- pthread_mutex_lock(&playerMutex);
+ pthread_mutex_lock(&self->playerMutex);
{
- currentlyReadingEntry.dataSource.delegate = nil;
- [currentlyReadingEntry.dataSource unregisterForEvents];
- [currentlyReadingEntry.dataSource close];
+ self->currentlyReadingEntry.dataSource.delegate = nil;
+ [self->currentlyReadingEntry.dataSource unregisterForEvents];
+ [self->currentlyReadingEntry.dataSource close];
- if (currentlyPlayingEntry)
+ if (self->currentlyPlayingEntry)
{
- [self processFinishPlayingIfAnyAndPlayingNext:currentlyPlayingEntry withNext:nil];
+ [self processFinishPlayingIfAnyAndPlayingNext:self->currentlyPlayingEntry withNext:nil];
}
[self clearQueue];
- setLock(currentEntryReferencesLock);
- currentlyPlayingEntry = nil;
- currentlyReadingEntry = nil;
- seekToTimeWasRequested = NO;
- lockUnlock(currentEntryReferencesLock);
+ setLock(&self->currentEntryReferencesLock);
+ self->currentlyPlayingEntry = nil;
+ self->currentlyReadingEntry = nil;
+ self->seekToTimeWasRequested = NO;
+ lockUnlock(&self->currentEntryReferencesLock);
}
- pthread_mutex_unlock(&playerMutex);
+ pthread_mutex_unlock(&self->playerMutex);
}];
[self wakeupPlaybackThread];
@@ -1861,7 +1861,7 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
[self invokeOnPlaybackThread:^
{
- disposeWasRequested = YES;
+ self->disposeWasRequested = YES;
CFRunLoopStop(CFRunLoopGetCurrent());
}];
@@ -1947,20 +1947,20 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
-(NSObject*) currentlyPlayingQueueItemId
{
- setLock(currentEntryReferencesLock);
+ setLock(¤tEntryReferencesLock);
STKQueueEntry* entry = currentlyPlayingEntry;
if (entry == nil)
{
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
return nil;
}
NSObject* retval = entry.queueItemId;
- lockUnlock(currentEntryReferencesLock);
+ lockUnlock(¤tEntryReferencesLock);
return retval;
}
@@ -2626,12 +2626,12 @@ OSStatus AudioConverterCallback(AudioConverterRef inAudioConverter, UInt32* ioNu
while (true)
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
UInt32 used = pcmBufferUsedFrameCount;
UInt32 start = pcmBufferFrameStartIndex;
UInt32 end = (pcmBufferFrameStartIndex + pcmBufferUsedFrameCount) % pcmBufferTotalFrameCount;
UInt32 framesLeftInsideBuffer = pcmBufferTotalFrameCount - used;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
if (framesLeftInsideBuffer == 0)
{
@@ -2639,12 +2639,12 @@ OSStatus AudioConverterCallback(AudioConverterRef inAudioConverter, UInt32* ioNu
while (true)
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
used = pcmBufferUsedFrameCount;
start = pcmBufferFrameStartIndex;
end = (pcmBufferFrameStartIndex + pcmBufferUsedFrameCount) % pcmBufferTotalFrameCount;
framesLeftInsideBuffer = pcmBufferTotalFrameCount - used;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
if (framesLeftInsideBuffer > 0)
{
@@ -2706,13 +2706,13 @@ OSStatus AudioConverterCallback(AudioConverterRef inAudioConverter, UInt32* ioNu
if (status == 100)
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
pcmBufferUsedFrameCount += framesAdded;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
- setLock(currentlyReadingEntry->spinLock);
+ setLock(¤tlyReadingEntry->spinLock);
currentlyReadingEntry->framesQueued += framesAdded;
- lockUnlock(currentlyReadingEntry->spinLock);
+ lockUnlock(¤tlyReadingEntry->spinLock);
return;
}
@@ -2727,13 +2727,13 @@ OSStatus AudioConverterCallback(AudioConverterRef inAudioConverter, UInt32* ioNu
if (framesToDecode == 0)
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
pcmBufferUsedFrameCount += framesAdded;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
- setLock(currentlyReadingEntry->spinLock);
+ setLock(¤tlyReadingEntry->spinLock);
currentlyReadingEntry->framesQueued += framesAdded;
- lockUnlock(currentlyReadingEntry->spinLock);
+ lockUnlock(¤tlyReadingEntry->spinLock);
continue;
}
@@ -2753,25 +2753,25 @@ OSStatus AudioConverterCallback(AudioConverterRef inAudioConverter, UInt32* ioNu
if (status == 100)
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
pcmBufferUsedFrameCount += framesAdded;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
- setLock(currentlyReadingEntry->spinLock);
+ setLock(¤tlyReadingEntry->spinLock);
currentlyReadingEntry->framesQueued += framesAdded;
- lockUnlock(currentlyReadingEntry->spinLock);
+ lockUnlock(¤tlyReadingEntry->spinLock);
return;
}
else if (status == 0)
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
pcmBufferUsedFrameCount += framesAdded;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
- setLock(currentlyReadingEntry->spinLock);
+ setLock(¤tlyReadingEntry->spinLock);
currentlyReadingEntry->framesQueued += framesAdded;
- lockUnlock(currentlyReadingEntry->spinLock);
+ lockUnlock(¤tlyReadingEntry->spinLock);
continue;
}
@@ -2802,25 +2802,25 @@ OSStatus AudioConverterCallback(AudioConverterRef inAudioConverter, UInt32* ioNu
if (status == 100)
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
pcmBufferUsedFrameCount += framesAdded;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
- setLock(currentlyReadingEntry->spinLock);
+ setLock(¤tlyReadingEntry->spinLock);
currentlyReadingEntry->framesQueued += framesAdded;
- lockUnlock(currentlyReadingEntry->spinLock);
+ lockUnlock(¤tlyReadingEntry->spinLock);
return;
}
else if (status == 0)
{
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
pcmBufferUsedFrameCount += framesAdded;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
- setLock(currentlyReadingEntry->spinLock);
+ setLock(¤tlyReadingEntry->spinLock);
currentlyReadingEntry->framesQueued += framesAdded;
- lockUnlock(currentlyReadingEntry->spinLock);
+ lockUnlock(¤tlyReadingEntry->spinLock);
continue;
}
@@ -2898,12 +2898,12 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
{
STKAudioPlayer* audioPlayer = (__bridge STKAudioPlayer*)inRefCon;
- setLock(audioPlayer->currentEntryReferencesLock);
+ setLock(&audioPlayer->currentEntryReferencesLock);
STKQueueEntry* entry = audioPlayer->currentlyPlayingEntry;
STKQueueEntry* currentlyReadingEntry = audioPlayer->currentlyReadingEntry;
- lockUnlock(audioPlayer->currentEntryReferencesLock);
+ lockUnlock(&audioPlayer->currentEntryReferencesLock);
- setLock(audioPlayer->pcmBufferSpinLock);
+ setLock(&audioPlayer->pcmBufferSpinLock);
BOOL waitForBuffer = NO;
BOOL muted = audioPlayer->muted;
@@ -2963,7 +2963,7 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
}
}
- lockUnlock(audioPlayer->pcmBufferSpinLock);
+ lockUnlock(&audioPlayer->pcmBufferSpinLock);
UInt32 totalFramesCopied = 0;
@@ -2996,10 +2996,10 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
totalFramesCopied = framesToCopy;
- setLock(audioPlayer->pcmBufferSpinLock);
+ setLock(&audioPlayer->pcmBufferSpinLock);
audioPlayer->pcmBufferFrameStartIndex = (audioPlayer->pcmBufferFrameStartIndex + totalFramesCopied) % audioPlayer->pcmBufferTotalFrameCount;
audioPlayer->pcmBufferUsedFrameCount -= totalFramesCopied;
- lockUnlock(audioPlayer->pcmBufferSpinLock);
+ lockUnlock(&audioPlayer->pcmBufferSpinLock);
}
else
{
@@ -3039,10 +3039,10 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
totalFramesCopied = framesToCopy + moreFramesToCopy;
- setLock(audioPlayer->pcmBufferSpinLock);
+ setLock(&audioPlayer->pcmBufferSpinLock);
audioPlayer->pcmBufferFrameStartIndex = (audioPlayer->pcmBufferFrameStartIndex + totalFramesCopied) % audioPlayer->pcmBufferTotalFrameCount;
audioPlayer->pcmBufferUsedFrameCount -= totalFramesCopied;
- lockUnlock(audioPlayer->pcmBufferSpinLock);
+ lockUnlock(&audioPlayer->pcmBufferSpinLock);
}
[audioPlayer setInternalState:STKAudioPlayerInternalStatePlaying ifInState:^BOOL(STKAudioPlayerInternalState state)
@@ -3116,7 +3116,7 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
return 0;
}
- setLock(entry->spinLock);
+ setLock(&entry->spinLock);
SInt64 extraFramesPlayedNotAssigned = 0;
SInt64 framesPlayedForCurrent = totalFramesCopied;
@@ -3131,15 +3131,15 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
BOOL lastFramePlayed = entry->framesPlayed == entry->lastFrameQueued;
- lockUnlock(entry->spinLock);
+ lockUnlock(&entry->spinLock);
if (signal || lastFramePlayed)
{
pthread_mutex_lock(&audioPlayer->playerMutex);
- setLock(audioPlayer->currentEntryReferencesLock);
+ setLock(&audioPlayer->currentEntryReferencesLock);
STKQueueEntry* currentlyPlayingEntry = audioPlayer->currentlyPlayingEntry;
- lockUnlock(audioPlayer->currentEntryReferencesLock);
+ lockUnlock(&audioPlayer->currentEntryReferencesLock);
if (lastFramePlayed && entry == currentlyPlayingEntry)
{
@@ -3147,15 +3147,15 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
while (extraFramesPlayedNotAssigned > 0)
{
- setLock(audioPlayer->currentEntryReferencesLock);
+ setLock(&audioPlayer->currentEntryReferencesLock);
STKQueueEntry* newEntry = audioPlayer->currentlyPlayingEntry;
- lockUnlock(audioPlayer->currentEntryReferencesLock);
+ lockUnlock(&audioPlayer->currentEntryReferencesLock);
if (newEntry != nil)
{
SInt64 framesPlayedForCurrent = extraFramesPlayedNotAssigned;
- setLock(newEntry->spinLock);
+ setLock(&newEntry->spinLock);
if (newEntry->lastFrameQueued > 0)
{
@@ -3166,13 +3166,13 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
if (newEntry->framesPlayed == newEntry->lastFrameQueued)
{
- lockUnlock(newEntry->spinLock);
+ lockUnlock(&newEntry->spinLock);
[audioPlayer audioQueueFinishedPlaying:newEntry];
}
else
{
- lockUnlock(newEntry->spinLock);
+ lockUnlock(&newEntry->spinLock);
}
extraFramesPlayedNotAssigned -= framesPlayedForCurrent;
@@ -3418,7 +3418,7 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
NSArray* replacement = [NSArray arrayWithArray:newFrameFilters];
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
if (newFrameFilters.count > 0)
{
frameFilters = replacement;
@@ -3427,7 +3427,7 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
{
frameFilters = nil;
}
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
pthread_mutex_unlock(&self->playerMutex);
}
@@ -3458,9 +3458,9 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
NSArray* replacement = [NSArray arrayWithArray:newFrameFilters];
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
frameFilters = replacement;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
pthread_mutex_unlock(&self->playerMutex);
}
@@ -3491,9 +3491,9 @@ static OSStatus OutputRenderCallback(void* inRefCon, AudioUnitRenderActionFlags*
NSArray* replacement = [NSArray arrayWithArray:newFrameFilters];
- setLock(pcmBufferSpinLock);
+ setLock(&pcmBufferSpinLock);
frameFilters = replacement;
- lockUnlock(pcmBufferSpinLock);
+ lockUnlock(&pcmBufferSpinLock);
pthread_mutex_unlock(&self->playerMutex);
}
diff --git a/StreamingKit/StreamingKit/STKHTTPDataSource.h b/StreamingKit/StreamingKit/STKHTTPDataSource.h
index 691bbff..445993b 100644
--- a/StreamingKit/StreamingKit/STKHTTPDataSource.h
+++ b/StreamingKit/StreamingKit/STKHTTPDataSource.h
@@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
@class STKHTTPDataSource;
typedef void(^STKURLBlock)(NSURL* url);
-typedef NSURL* _Nonnull (^STKURLProvider)();
+typedef NSURL* _Nonnull (^STKURLProvider)(void);
typedef void(^STKAsyncURLProvider)(STKHTTPDataSource* dataSource, BOOL forSeek, STKURLBlock callback);
@interface STKHTTPDataSource : STKCoreFoundationDataSource
diff --git a/StreamingKit/StreamingKit/STKHTTPDataSource.m b/StreamingKit/StreamingKit/STKHTTPDataSource.m
index e6a8a7c..6b46bf5 100755
--- a/StreamingKit/StreamingKit/STKHTTPDataSource.m
+++ b/StreamingKit/StreamingKit/STKHTTPDataSource.m
@@ -600,11 +600,11 @@
CFHTTPMessageRef message = CFHTTPMessageCreateRequest(NULL, (CFStringRef)@"GET", (__bridge CFURLRef)self->currentUrl, kCFHTTPVersion1_1);
- if (seekStart > 0 && supportsSeek)
+ if (self->seekStart > 0 && self->supportsSeek)
{
- CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Range"), (__bridge CFStringRef)[NSString stringWithFormat:@"bytes=%lld-", seekStart]);
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Range"), (__bridge CFStringRef)[NSString stringWithFormat:@"bytes=%lld-", self->seekStart]);
- discontinuous = YES;
+ self->discontinuous = YES;
}
for (NSString* key in self->requestHeaders)
@@ -617,9 +617,9 @@
CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Accept"), CFSTR("*/*"));
CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Icy-MetaData"), CFSTR("1"));
- stream = CFReadStreamCreateForHTTPRequest(NULL, message);
+ self->stream = CFReadStreamCreateForHTTPRequest(NULL, message);
- if (stream == nil)
+ if (self->stream == nil)
{
CFRelease(message);
@@ -628,9 +628,9 @@
return;
}
- CFReadStreamSetProperty(stream, (__bridge CFStringRef)NSStreamNetworkServiceTypeBackground, (__bridge CFStringRef)NSStreamNetworkServiceTypeBackground);
+ CFReadStreamSetProperty(self->stream, (__bridge CFStringRef)NSStreamNetworkServiceTypeBackground, (__bridge CFStringRef)NSStreamNetworkServiceTypeBackground);
- if (!CFReadStreamSetProperty(stream, kCFStreamPropertyHTTPShouldAutoredirect, kCFBooleanTrue))
+ if (!CFReadStreamSetProperty(self->stream, kCFStreamPropertyHTTPShouldAutoredirect, kCFBooleanTrue))
{
CFRelease(message);
@@ -641,7 +641,7 @@
// Proxy support
CFDictionaryRef proxySettings = CFNetworkCopySystemProxySettings();
- CFReadStreamSetProperty(stream, kCFStreamPropertyHTTPProxy, proxySettings);
+ CFReadStreamSetProperty(self->stream, kCFStreamPropertyHTTPProxy, proxySettings);
CFRelease(proxySettings);
// SSL support
@@ -651,7 +651,7 @@
(NSString*)kCFStreamSocketSecurityLevelNegotiatedSSL, kCFStreamSSLLevel,
[NSNumber numberWithBool:NO], kCFStreamSSLValidatesCertificateChain,
nil];
- CFReadStreamSetProperty(stream, kCFStreamPropertySSLSettings, (__bridge CFTypeRef)sslSettings);
+ CFReadStreamSetProperty(self->stream, kCFStreamPropertySSLSettings, (__bridge CFTypeRef)sslSettings);
}
[self reregisterForEvents];
@@ -659,12 +659,12 @@
self->httpStatusCode = 0;
// Open
- if (!CFReadStreamOpen(stream))
+ if (!CFReadStreamOpen(self->stream))
{
- CFRelease(stream);
+ CFRelease(self->stream);
CFRelease(message);
- stream = 0;
+ self->stream = NULL;
[self errorOccured];
diff --git a/StreamingKit/StreamingKit/STKMacro.h b/StreamingKit/StreamingKit/STKMacro.h
index 9e13485..97c6bad 100644
--- a/StreamingKit/StreamingKit/STKMacro.h
+++ b/StreamingKit/StreamingKit/STKMacro.h
@@ -18,12 +18,12 @@
#define DEPLOYMENT_TARGET_HIGHER_THAN_10 TARGET_OS_WATCH || \
TARGET_OS_TV || \
- (TARGET_OS_IOS &&__IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || \
- (!TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_ALLOWED >= 101200)
+ (TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0) || \
+ (!TARGET_OS_IOS && __MAC_OS_X_VERSION_MIN_ALLOWED >= __MAC_10_12)
#define BASE_SDK_HIGHER_THAN_10 (TARGET_OS_WATCH || \
TARGET_OS_TV || \
- (TARGET_OS_IOS &&__IPHONE_OS_VERSION_MAX_ALLOWED >= 100000) || \
- (!TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200))
+ (TARGET_OS_IOS && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0) || \
+ (!TARGET_OS_IOS && __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_12))
#define DEVICE_HIGHER_THAN_10 objc_getClass("NSDimension")
diff --git a/StreamingKit/StreamingKit/STKQueueEntry.h b/StreamingKit/StreamingKit/STKQueueEntry.h
index 943c6ff..7d8ba4a 100755
--- a/StreamingKit/StreamingKit/STKQueueEntry.h
+++ b/StreamingKit/StreamingKit/STKQueueEntry.h
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface STKQueueEntry : NSObject
{
@public
- os_unfair_lock *spinLock;
+ os_unfair_lock spinLock;
BOOL parsedHeader;
Float64 sampleRate;
diff --git a/StreamingKit/StreamingKit/STKQueueEntry.m b/StreamingKit/StreamingKit/STKQueueEntry.m
index fb56afc..459f9a2 100755
--- a/StreamingKit/StreamingKit/STKQueueEntry.m
+++ b/StreamingKit/StreamingKit/STKQueueEntry.m
@@ -18,7 +18,7 @@
{
if (self = [super init])
{
- self->spinLock = &(OS_UNFAIR_LOCK_INIT);
+ self->spinLock = OS_UNFAIR_LOCK_INIT;
self.dataSource = dataSourceIn;
self.queueItemId = queueItemIdIn;
@@ -31,11 +31,11 @@
-(void) reset
{
- setLock(self->spinLock);
+ setLock(&self->spinLock);
self->framesQueued = 0;
self->framesPlayed = 0;
self->lastFrameQueued = -1;
- lockUnlock(self->spinLock);
+ lockUnlock(&self->spinLock);
}
-(double) calculatedBitRate
@@ -109,9 +109,9 @@
-(Float64) progressInFrames
{
- setLock(self->spinLock);
+ setLock(&self->spinLock);
Float64 retval = (self->seekTime + self->audioStreamBasicDescription.mSampleRate) + self->framesPlayed;
- lockUnlock(self->spinLock);
+ lockUnlock(&self->spinLock);
return retval;
}
diff --git a/StreamingKit/StreamingKit/STKSpinLock.h b/StreamingKit/StreamingKit/STKSpinLock.h
index b95e6b4..6aa84c5 100644
--- a/StreamingKit/StreamingKit/STKSpinLock.h
+++ b/StreamingKit/StreamingKit/STKSpinLock.h
@@ -23,6 +23,8 @@ typedef struct _os_unfair_lock_s {
#if !DEPLOYMENT_TARGET_HIGHER_THAN_10
#import
+static void (*os_unfair_lock_lock_ptr)(void *lock) = NULL;
+static void (*os_unfair_lock_unlock_ptr)(void *lock) = NULL;
#endif
static void setLock(os_unfair_lock *lock)
@@ -32,10 +34,14 @@ static void setLock(os_unfair_lock *lock)
#else
if (DEVICE_HIGHER_THAN_10)
{
- void (*os_unfair_lock_lock)(void *lock) = dlsym(dlopen(NULL, RTLD_NOW | RTLD_GLOBAL), "os_unfair_lock_lock");
- if (os_unfair_lock_lock != NULL)
+ if (os_unfair_lock_lock_ptr == NULL)
{
- os_unfair_lock_lock(lock);
+ os_unfair_lock_lock_ptr = dlsym(dlopen(NULL, RTLD_NOW | RTLD_GLOBAL), "os_unfair_lock_lock");
+ }
+
+ if (os_unfair_lock_lock_ptr != NULL)
+ {
+ os_unfair_lock_lock_ptr(lock);
return;
}
}
@@ -52,11 +58,15 @@ static void lockUnlock(os_unfair_lock *lock)
#else
if (DEVICE_HIGHER_THAN_10)
{
- void (*os_unfair_lock_unlock)(void *lock) = dlsym(dlopen(NULL, RTLD_NOW | RTLD_GLOBAL), "os_unfair_lock_unlock");
- if (os_unfair_lock_unlock != NULL)
+ if (os_unfair_lock_unlock_ptr == NULL)
{
- os_unfair_lock_unlock(lock);
- return;
+ os_unfair_lock_unlock_ptr = dlsym(dlopen(NULL, RTLD_NOW | RTLD_GLOBAL), "os_unfair_lock_unlock");
+ }
+
+ if (os_unfair_lock_unlock_ptr != NULL)
+ {
+ os_unfair_lock_unlock_ptr(lock);
+ return;
}
}