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 5c268ef..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 @@ -174,10 +176,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 @@ -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/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..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; @@ -45,8 +47,10 @@ STKAutoRecoveringHTTPDataSourceOptions; @interface STKAutoRecoveringHTTPDataSource : STKDataSourceWrapper --(id) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSource; +-(instancetype) initWithHTTPDataSource:(STKHTTPDataSource*)innerDataSource; @property (readonly) STKHTTPDataSource* innerDataSource; @end + +NS_ASSUME_NONNULL_END 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/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 4d3e035..cde9b73 100644 --- a/StreamingKit/StreamingKit/STKDataSourceWrapper.h +++ b/StreamingKit/StreamingKit/STKDataSourceWrapper.h @@ -34,10 +34,14 @@ #import "STKDataSource.h" +NS_ASSUME_NONNULL_BEGIN + @interface STKDataSourceWrapper : STKDataSource --(id) initWithDataSource:(STKDataSource*)innerDataSource; +-(instancetype) initWithDataSource:(STKDataSource*)innerDataSource; @property (readonly) STKDataSource* innerDataSource; @end + +NS_ASSUME_NONNULL_END 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..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 @@ -46,11 +48,13 @@ 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 + +NS_ASSUME_NONNULL_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..581f42d 100644 --- a/StreamingKit/StreamingKit/STKLocalFileDataSource.h +++ b/StreamingKit/StreamingKit/STKLocalFileDataSource.h @@ -34,10 +34,14 @@ #import "STKCoreFoundationDataSource.h" +NS_ASSUME_NONNULL_BEGIN + @interface STKLocalFileDataSource : STKCoreFoundationDataSource +(AudioFileTypeID) audioFileTypeHintFromFileExtension:(NSString*)fileExtension; @property (readonly, copy) NSString* filePath; --(id) initWithFilePath:(NSString*)filePath; +-(instancetype) initWithFilePath:(NSString*)filePath; @end + +NS_ASSUME_NONNULL_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..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 @@ -35,7 +37,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; @@ -43,4 +45,6 @@ -(double) calculatedBitRate; -(BOOL) isDefinitelyCompatible:(AudioStreamBasicDescription*)basicDescription; -@end \ No newline at end of file +@end + +NS_ASSUME_NONNULL_END 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