diff --git a/MP42/MP42ChapterTrack.h b/MP42/MP42ChapterTrack.h index 37f09f5..3558762 100644 --- a/MP42/MP42ChapterTrack.h +++ b/MP42/MP42ChapterTrack.h @@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN @interface NSArray (CSVAdditions) -+ (NSArray *)arrayWithContentsOfCSVURL: (NSURL *)url; ++ (NSArray *> * __nullable)arrayWithContentsOfCSVURL:(NSURL *)url; @end diff --git a/MP42/MP42ChapterTrack.m b/MP42/MP42ChapterTrack.m index fb805a3..7f4da0f 100644 --- a/MP42/MP42ChapterTrack.m +++ b/MP42/MP42ChapterTrack.m @@ -355,7 +355,7 @@ // // // -+ (NSArray *)arrayWithContentsOfCSVURL: (NSURL *)url ++ (NSArray *> * __nullable)arrayWithContentsOfCSVURL:(NSURL *)url; { NSString *str1 = STLoadFileWithUnknownEncoding(url.path); NSMutableString *csvString = STStandardizeStringNewlines(str1); diff --git a/MP42/MP42ConverterProtocol.h b/MP42/MP42ConverterProtocol.h index 21afcb1..0f0ff0e 100644 --- a/MP42/MP42ConverterProtocol.h +++ b/MP42/MP42ConverterProtocol.h @@ -9,6 +9,8 @@ #import #import "MP42Sample.h" +NS_ASSUME_NONNULL_BEGIN + @protocol MP42ConverterProtocol @optional @@ -24,3 +26,5 @@ - (void)setInputDone; @end + +NS_ASSUME_NONNULL_END diff --git a/MP42/MP42Fifo.h b/MP42/MP42Fifo.h index 64f5201..4a434c8 100644 --- a/MP42/MP42Fifo.h +++ b/MP42/MP42Fifo.h @@ -8,6 +8,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + @interface MP42Fifo : NSObject { @private id *_array; @@ -28,8 +30,8 @@ - (instancetype)initWithCapacity:(NSUInteger)numItems; - (void)enqueue:(id)item; -- (id)deque NS_RETURNS_RETAINED; -- (id)dequeAndWait NS_RETURNS_RETAINED; +- (nullable id)deque NS_RETURNS_RETAINED; +- (nullable id)dequeAndWait NS_RETURNS_RETAINED; - (NSInteger)count; @@ -40,3 +42,5 @@ - (void)cancel; @end + +NS_ASSUME_NONNULL_END diff --git a/MP42/MP42File.h b/MP42/MP42File.h index 24266ea..fce7af0 100644 --- a/MP42/MP42File.h +++ b/MP42/MP42File.h @@ -30,11 +30,11 @@ extern NSString * const MP42OrganizeAlternateGroups; /** * MP42Status */ -typedef enum MP42Status : NSInteger { +typedef NS_ENUM(NSUInteger, MP42Status) { MP42StatusLoaded = 0, MP42StatusReading, MP42StatusWriting -} MP42Status; +}; /** * MP42FileDelegate @@ -42,7 +42,6 @@ typedef enum MP42Status : NSInteger { @protocol MP42FileDelegate @optional - (void)progressStatus:(CGFloat)progress; -- (void)saveDidEnd:(id)sender; @end @class MP42Muxer; @@ -77,7 +76,7 @@ typedef enum MP42Status : NSInteger { /** * indicates the URL with which the instance of MP42File was initialized. */ -@property(nonatomic, readonly) NSURL *URL; +@property(nonatomic, readonly, nullable) NSURL *URL; /** * Provides access to the mp4 file MP42Metadata instance. @@ -117,7 +116,7 @@ typedef enum MP42Status : NSInteger { * * @return An instance of MP42File */ -- (instancetype)initWithExistingFile:(NSURL *)URL andDelegate:(_Nullable id )del; +- (instancetype)initWithExistingFile:(NSURL *)URL andDelegate:(nullable id )del; /** * Provides the array of MP42Tracks contained by the mp4 file @@ -140,7 +139,7 @@ typedef enum MP42Status : NSInteger { * * @return An instance of MP42Track; may be nil if no track of the specified trackID is available. */ -- (MP42Track *)trackWithTrackID:(NSUInteger)trackID; +- (MP42Track * __nullable)trackWithTrackID:(NSUInteger)trackID; /** * Provides an array of MP42Track of the file that present media of the specified media type. diff --git a/MP42/MP42File.m b/MP42/MP42File.m index 7ad2e7c..869428c 100644 --- a/MP42/MP42File.m +++ b/MP42/MP42File.m @@ -596,9 +596,6 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { [fileManager release]; } - if ([self.delegate respondsToSelector:@selector(saveDidEnd:)]) - [self.delegate performSelector:@selector(saveDidEnd:) withObject:self]; - return noErr; } @@ -829,10 +826,6 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { [self customChaptersPreview]; } - if ([self.delegate respondsToSelector:@selector(saveDidEnd:)]) { - [self.delegate performSelector:@selector(saveDidEnd:) withObject:self]; - } - return YES; } diff --git a/MP42/MP42FileImporter.h b/MP42/MP42FileImporter.h index 2af05df..26b7156 100644 --- a/MP42/MP42FileImporter.h +++ b/MP42/MP42FileImporter.h @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN - (NSUInteger)timescaleForTrack:(MP42Track *)track; - (NSSize)sizeForTrack:(MP42Track *)track; -- (NSData *)magicCookieForTrack:(MP42Track *)track; +- (nullable NSData *)magicCookieForTrack:(MP42Track *)track; - (AudioStreamBasicDescription)audioDescriptionForTrack:(MP42Track *)track; - (void)setActiveTrack:(MP42Track *)track; @@ -58,10 +58,10 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)done; - (void)setDone:(BOOL)status; -- (BOOL)cleanUp:(MP42FileHandle) fileHandle; +- (BOOL)cleanUp:(MP42FileHandle)fileHandle; -@property(readwrite, retain) MP42Metadata *metadata; -@property(readonly) NSMutableArray *tracks; +@property(readonly) MP42Metadata *metadata; +@property(readonly) NSArray *tracks; @end diff --git a/MP42/MP42Heap.h b/MP42/MP42Heap.h index 83e02d3..6b6684a 100644 --- a/MP42/MP42Heap.h +++ b/MP42/MP42Heap.h @@ -8,6 +8,8 @@ #import +NS_ASSUME_NONNULL_BEGIN + /** * A simple heap/priority queue implementations with a static size. * It takes a NSComparator in input. @@ -24,7 +26,7 @@ - (instancetype)initWithCapacity:(NSUInteger)numItems andComparator:(NSComparator)cmptr; - (void)insert:(id)item; -- (id)extract NS_RETURNS_RETAINED; +- (nullable id)extract NS_RETURNS_RETAINED; - (NSInteger)count; @@ -32,3 +34,5 @@ - (BOOL)isEmpty; @end + +NS_ASSUME_NONNULL_END diff --git a/MP42/MP42Metadata.h b/MP42/MP42Metadata.h index 4da8084..93b0a20 100644 --- a/MP42/MP42Metadata.h +++ b/MP42/MP42Metadata.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MP42Metadata : NSObject { @private NSString *presetName; - NSMutableDictionary *tagsDict; + NSMutableDictionary *tagsDict; NSMutableArray *artworks; @@ -54,11 +54,11 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL) mergeMetadata: (MP42Metadata *) newMetadata; -@property(nonatomic, readonly) NSMutableDictionary *tagsDict; +@property(nonatomic, readonly) NSMutableDictionary *tagsDict; @property(nonatomic, readwrite, copy) NSString *presetName; -@property(nonatomic, readwrite, retain) NSMutableArray *artworks; +@property(nonatomic, readwrite, retain) NSMutableArray *artworks; @property(nonatomic, readwrite, retain, nullable) NSArray *artworkThumbURLs; @property(nonatomic, readwrite, retain, nullable) NSArray *artworkFullsizeURLs; diff --git a/MP42/MP42Mp4Importer.m b/MP42/MP42Mp4Importer.m index dd8f7e4..1332fc4 100644 --- a/MP42/MP42Mp4Importer.m +++ b/MP42/MP42Mp4Importer.m @@ -67,7 +67,7 @@ return NSMakeSize([currentTrack width], [currentTrack height]); } -- (NSData*)magicCookieForTrack:(MP42Track *)track +- (NSData *)magicCookieForTrack:(MP42Track *)track { if (!_fileHandle) _fileHandle = MP4Read([[_fileURL path] UTF8String]); diff --git a/MP42/MP42Muxer.h b/MP42/MP42Muxer.h index a70b289..d91389f 100644 --- a/MP42/MP42Muxer.h +++ b/MP42/MP42Muxer.h @@ -6,7 +6,7 @@ // Copyright 2010 Damiano Galassi. All rights reserved. // -#import +#import #import "mp4v2.h" #import "MP42Logging.h" diff --git a/MP42/MP42Muxer.m b/MP42/MP42Muxer.m index e827667..20d0248 100644 --- a/MP42/MP42Muxer.m +++ b/MP42/MP42Muxer.m @@ -59,7 +59,7 @@ - (BOOL)setup:(NSError **)outError { - NSMutableArray *unsupportedTracks = [[NSMutableArray alloc] init];; + NSMutableArray *unsupportedTracks = [[NSMutableArray alloc] init];; for (MP42Track *track in _workingTracks) { MP4TrackId dstTrackId = 0; @@ -388,21 +388,24 @@ - (void)work { - if (![_workingTracks count]) + if (![_workingTracks count]) { return; + } @autoreleasepool { - NSMutableArray *trackImportersArray = [[NSMutableArray alloc] init]; + NSMutableArray *trackImportersArray = [[NSMutableArray alloc] init]; NSUInteger done = 0, update = 0; CGFloat progress = 0; for (MP42Track *track in _workingTracks) { - if (![trackImportersArray containsObject:track.muxer_helper->importer]) + if (![trackImportersArray containsObject:track.muxer_helper->importer]) { [trackImportersArray addObject:track.muxer_helper->importer]; + } } - for (MP42FileImporter *importerHelper in trackImportersArray) + for (MP42FileImporter *importerHelper in trackImportersArray) { [importerHelper startReading]; + } NSUInteger tracksImportersCount = [trackImportersArray count]; NSUInteger tracksCount = [_workingTracks count]; @@ -426,8 +429,9 @@ done += (track.muxer_helper->done ? 1 : 0); } - if (_cancelled) + if (_cancelled) { break; + } // If all tracks are done, exit the loop if (done == tracksCount) { @@ -439,8 +443,9 @@ // Update progress if (!(update % 200)) { progress = 0; - for (MP42FileImporter *importerHelper in trackImportersArray) + for (MP42FileImporter *importerHelper in trackImportersArray) { progress += [importerHelper progress]; + } progress /= tracksImportersCount; diff --git a/MP42/MP42Sample.h b/MP42/MP42Sample.h index e42f945..523408e 100644 --- a/MP42/MP42Sample.h +++ b/MP42/MP42Sample.h @@ -6,7 +6,7 @@ // Copyright 2010 Damiano Galassi. All rights reserved. // -#import +#import @class MP42Track;