Added some nullable and generics, needs Xcode 7 to compile
This commit is contained in:
1 parent
bba1753c48
commit
a6e03a0b06
13 files changed
+83
-45
No files matched your search
+13
-13
@@ -328,7 +328,6 @@
|
||||
* Converts the AVAsset metadata to the MP42File format
|
||||
*/
|
||||
- (void)convertMetadata {
|
||||
NSArray *items = nil;
|
||||
NSDictionary *commonItemsDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Name", AVMetadataCommonKeyTitle,
|
||||
//nil, AVMetadataCommonKeyCreator,
|
||||
//nil, AVMetadataCommonKeySubject,
|
||||
@@ -356,13 +355,14 @@
|
||||
|
||||
_metadata = [[MP42Metadata alloc] init];
|
||||
|
||||
for (NSString *commonKey in [commonItemsDict allKeys]) {
|
||||
items = [AVMetadataItem metadataItemsFromArray:_localAsset.commonMetadata withKey:commonKey keySpace:AVMetadataKeySpaceCommon];
|
||||
if ([items count])
|
||||
for (NSString *commonKey in commonItemsDict.allKeys) {
|
||||
NSArray<AVMetadataItem *> *items = [AVMetadataItem metadataItemsFromArray:_localAsset.commonMetadata withKey:commonKey keySpace:AVMetadataKeySpaceCommon];
|
||||
if ([items count]) {
|
||||
[_metadata setTag:[[items lastObject] value] forKey:[commonItemsDict objectForKey:commonKey]];
|
||||
}
|
||||
}
|
||||
|
||||
items = [AVMetadataItem metadataItemsFromArray:_localAsset.commonMetadata withKey:AVMetadataCommonKeyArtwork keySpace:AVMetadataKeySpaceCommon];
|
||||
NSArray<AVMetadataItem *> *items = [AVMetadataItem metadataItemsFromArray:_localAsset.commonMetadata withKey:AVMetadataCommonKeyArtwork keySpace:AVMetadataKeySpaceCommon];
|
||||
if ([items count]) {
|
||||
id artworkData = [[items lastObject] value];
|
||||
if ([artworkData isKindOfClass:[NSData class]]) {
|
||||
@@ -372,7 +372,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
NSArray *availableMetadataFormats = [_localAsset availableMetadataFormats];
|
||||
NSArray<NSString *> *availableMetadataFormats = [_localAsset availableMetadataFormats];
|
||||
|
||||
if ([availableMetadataFormats containsObject:AVMetadataFormatiTunesMetadata]) {
|
||||
NSArray *itunesMetadata = [_localAsset metadataForFormat:AVMetadataFormatiTunesMetadata];
|
||||
@@ -450,7 +450,7 @@
|
||||
|
||||
for (NSString *itunesKey in [itunesMetadataDict allKeys]) {
|
||||
items = [AVMetadataItem metadataItemsFromArray:itunesMetadata withKey:itunesKey keySpace:AVMetadataKeySpaceiTunes];
|
||||
if ([items count]) {
|
||||
if (items.count) {
|
||||
[_metadata setTag:[[items lastObject] value] forKey:[itunesMetadataDict objectForKey:itunesKey]];
|
||||
}
|
||||
}
|
||||
@@ -466,7 +466,7 @@
|
||||
}*/
|
||||
}
|
||||
if ([availableMetadataFormats containsObject:AVMetadataFormatQuickTimeMetadata]) {
|
||||
NSArray *quicktimeMetadata = [_localAsset metadataForFormat:AVMetadataFormatQuickTimeMetadata];
|
||||
NSArray<AVMetadataItem *> *quicktimeMetadata = [_localAsset metadataForFormat:AVMetadataFormatQuickTimeMetadata];
|
||||
|
||||
NSDictionary *quicktimeMetadataDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"Arist", AVMetadataQuickTimeMetadataKeyAuthor,
|
||||
@@ -494,15 +494,15 @@
|
||||
@"Phonogram Rights", AVMetadataQuickTimeMetadataKeyPhonogramRights,
|
||||
@"Name", AVMetadataQuickTimeMetadataKeyTitle, nil];
|
||||
|
||||
for (NSString *qtKey in [quicktimeMetadataDict allKeys]) {
|
||||
for (NSString *qtKey in quicktimeMetadataDict.allKeys) {
|
||||
items = [AVMetadataItem metadataItemsFromArray:quicktimeMetadata withKey:qtKey keySpace:AVMetadataKeySpaceQuickTimeUserData];
|
||||
if ([items count]) {
|
||||
if (items.count) {
|
||||
[_metadata setTag:[[items lastObject] value] forKey:[quicktimeMetadataDict objectForKey:qtKey]];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ([availableMetadataFormats containsObject:AVMetadataFormatQuickTimeUserData]) {
|
||||
NSArray *quicktimeUserDataMetadata = [_localAsset metadataForFormat:AVMetadataFormatQuickTimeUserData];
|
||||
NSArray<AVMetadataItem *> *quicktimeUserDataMetadata = [_localAsset metadataForFormat:AVMetadataFormatQuickTimeUserData];
|
||||
|
||||
NSDictionary *quicktimeUserDataMetadataDict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"Album", AVMetadataQuickTimeUserDataKeyAlbum,
|
||||
@@ -527,9 +527,9 @@
|
||||
@"Credits", AVMetadataQuickTimeUserDataKeyCredits,
|
||||
@"Phonogram Rights", AVMetadataQuickTimeUserDataKeyPhonogramRights, nil];
|
||||
|
||||
for (NSString *qtUserDataKey in [quicktimeUserDataMetadataDict allKeys]) {
|
||||
for (NSString *qtUserDataKey in quicktimeUserDataMetadataDict.allKeys) {
|
||||
items = [AVMetadataItem metadataItemsFromArray:quicktimeUserDataMetadata withKey:qtUserDataKey keySpace:AVMetadataKeySpaceQuickTimeUserData];
|
||||
if ([items count]) {
|
||||
if (items.count) {
|
||||
[_metadata setTag:[[items lastObject] value] forKey:[quicktimeUserDataMetadataDict objectForKey:qtUserDataKey]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,6 @@
|
||||
@property(nonatomic, readwrite, assign) MP42Track *fallbackTrack;
|
||||
@property(nonatomic, readwrite, assign) MP42Track *followsTrack;
|
||||
|
||||
@property(nonatomic, readwrite, retain) NSString *mixdownType;
|
||||
@property(nonatomic, readwrite, copy) NSString *mixdownType;
|
||||
|
||||
@end
|
||||
@@ -10,9 +10,11 @@
|
||||
#import "MP42Track.h"
|
||||
#import "MP42TextSample.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MP42ChapterTrack : MP42Track <NSCoding> {
|
||||
@private
|
||||
NSMutableArray *chapters;
|
||||
NSMutableArray<MP42TextSample *> *chapters;
|
||||
BOOL _areChaptersEdited;
|
||||
}
|
||||
|
||||
@@ -48,3 +50,5 @@
|
||||
+ (NSArray *)arrayWithContentsOfCSVURL: (NSURL *)url;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+9
-5
@@ -19,6 +19,8 @@
|
||||
#import "MP42MediaFormat.h"
|
||||
#import "MP42Logging.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern NSString * const MP4264BitData;
|
||||
extern NSString * const MP4264BitTime;
|
||||
extern NSString * const MP42GenerateChaptersPreviewTrack;
|
||||
@@ -58,8 +60,8 @@ typedef enum MP42Status : NSInteger {
|
||||
MP42Status _status;
|
||||
BOOL _cancelled;
|
||||
|
||||
NSMutableArray *_tracks;
|
||||
NSMutableArray *_tracksToBeDeleted;
|
||||
NSMutableArray<__kindof MP42Track *> *_tracks;
|
||||
NSMutableArray<MP42Track *> *_tracksToBeDeleted;
|
||||
MP42Metadata *_metadata;
|
||||
MP42Muxer *_muxer;
|
||||
NSMutableDictionary *_importers;
|
||||
@@ -115,12 +117,12 @@ typedef enum MP42Status : NSInteger {
|
||||
*
|
||||
* @return An instance of MP42File
|
||||
*/
|
||||
- (instancetype)initWithExistingFile:(NSURL *)URL andDelegate:(id <MP42FileDelegate>)del;
|
||||
- (instancetype)initWithExistingFile:(NSURL *)URL andDelegate:(_Nullable id <MP42FileDelegate>)del;
|
||||
|
||||
/**
|
||||
* Provides the array of MP42Tracks contained by the mp4 file
|
||||
*/
|
||||
@property(nonatomic, readonly) NSArray *tracks;
|
||||
@property(nonatomic, readonly, copy) NSArray<MP42Track *> *tracks;
|
||||
|
||||
/**
|
||||
* Provides an instance of MP42Track that represents the track of the specified index.
|
||||
@@ -147,7 +149,7 @@ typedef enum MP42Status : NSInteger {
|
||||
*
|
||||
* @return An NSArray of MP42Tracks; may be empty if no tracks of the specified media type are available.
|
||||
*/
|
||||
- (NSArray *)tracksWithMediaType:(NSString *)mediaType;
|
||||
- (NSArray<MP42Track *> *)tracksWithMediaType:(NSString *)mediaType;
|
||||
|
||||
/**
|
||||
* Add a track to the mp4 file.
|
||||
@@ -231,3 +233,5 @@ typedef enum MP42Status : NSInteger {
|
||||
- (void)cancel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+1
-1
@@ -69,7 +69,7 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
|
||||
@property(nonatomic, readwrite) MP42FileHandle fileHandle;
|
||||
@property(nonatomic, readwrite, retain) NSURL *URL;
|
||||
|
||||
@property(nonatomic, readonly) NSMutableArray *itracks;
|
||||
@property(nonatomic, readonly) NSMutableArray<__kindof MP42Track *> *itracks;
|
||||
@property(nonatomic, readonly) NSMutableDictionary *importers;
|
||||
|
||||
@property(nonatomic, readwrite) MP42Status status;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#import "MP42MediaFormat.h"
|
||||
#import "MP42Sample.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MP42Sample;
|
||||
@class MP42Metadata;
|
||||
@class MP42Track;
|
||||
@@ -23,9 +25,9 @@
|
||||
NSInteger _chapterId;
|
||||
MP42Metadata *_metadata;
|
||||
|
||||
NSMutableArray *_tracksArray;
|
||||
NSMutableArray *_inputTracks;
|
||||
NSMutableArray *_outputsTracks;
|
||||
NSMutableArray<MP42Track *> *_tracksArray;
|
||||
NSMutableArray<MP42Track *> *_inputTracks;
|
||||
NSMutableArray<MP42Track *> *_outputsTracks;
|
||||
NSThread *_demuxerThread;
|
||||
|
||||
CGFloat _progress;
|
||||
@@ -59,6 +61,8 @@
|
||||
- (BOOL)cleanUp:(MP42FileHandle) fileHandle;
|
||||
|
||||
@property(readwrite, retain) MP42Metadata *metadata;
|
||||
@property(readonly) NSMutableArray *tracks;
|
||||
@property(readonly) NSMutableArray<MP42Track *> *tracks;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol MP42Logging <NSObject>
|
||||
|
||||
@required
|
||||
@@ -16,3 +18,5 @@
|
||||
- (void)writeErrorToLog:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+14
-8
@@ -9,16 +9,20 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MP42MediaFormat.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MP42Image;
|
||||
|
||||
@interface MP42Metadata : NSObject <NSCoding, NSCopying> {
|
||||
@private
|
||||
NSString *presetName;
|
||||
NSMutableDictionary *tagsDict;
|
||||
|
||||
NSMutableArray *artworks;
|
||||
NSMutableArray<MP42Image *> *artworks;
|
||||
|
||||
NSArray *artworkThumbURLs;
|
||||
NSArray *artworkFullsizeURLs;
|
||||
NSArray *artworkProviderNames;
|
||||
NSArray<NSURL *> *artworkThumbURLs;
|
||||
NSArray<NSURL *> *artworkFullsizeURLs;
|
||||
NSArray<NSString *> *artworkProviderNames;
|
||||
|
||||
NSString *ratingiTunesCode;
|
||||
|
||||
@@ -46,7 +50,7 @@
|
||||
- (BOOL) setContentRatingFromString:(NSString *)contentRatingString;
|
||||
- (BOOL) setArtworkFromFilePath:(NSString *)imageFilePath;
|
||||
|
||||
- (BOOL) writeMetadataWithFileHandle: (MP42FileHandle *) fileHandle;
|
||||
- (BOOL) writeMetadataWithFileHandle: (MP42FileHandle) fileHandle;
|
||||
|
||||
- (BOOL) mergeMetadata: (MP42Metadata *) newMetadata;
|
||||
|
||||
@@ -56,9 +60,9 @@
|
||||
|
||||
@property(nonatomic, readwrite, retain) NSMutableArray *artworks;
|
||||
|
||||
@property(nonatomic, readwrite, retain) NSArray *artworkThumbURLs;
|
||||
@property(nonatomic, readwrite, retain) NSArray *artworkFullsizeURLs;
|
||||
@property(nonatomic ,readwrite, retain) NSArray *artworkProviderNames;
|
||||
@property(nonatomic, readwrite, retain, nullable) NSArray<NSURL *> *artworkThumbURLs;
|
||||
@property(nonatomic, readwrite, retain, nullable) NSArray<NSURL *> *artworkFullsizeURLs;
|
||||
@property(nonatomic ,readwrite, retain, nullable) NSArray<NSString *> *artworkProviderNames;
|
||||
|
||||
@property(nonatomic, readwrite) uint8_t mediaKind;
|
||||
@property(nonatomic, readwrite) uint8_t contentRating;
|
||||
@@ -69,3 +73,5 @@
|
||||
@property(nonatomic, readwrite) BOOL isArtworkEdited;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+2
-2
@@ -543,7 +543,7 @@ static const genreType_t genreType_strings[] = {
|
||||
}
|
||||
}
|
||||
|
||||
for (NSImage *artwork in newMetadata.artworks) {
|
||||
for (MP42Image *artwork in newMetadata.artworks) {
|
||||
isArtworkEdited = YES;
|
||||
[artworks addObject:artwork];
|
||||
}
|
||||
@@ -1042,7 +1042,7 @@ static const genreType_t genreType_strings[] = {
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) writeMetadataWithFileHandle: (MP4FileHandle *)fileHandle
|
||||
- (BOOL) writeMetadataWithFileHandle: (MP4FileHandle)fileHandle
|
||||
{
|
||||
if (!fileHandle)
|
||||
return NO;
|
||||
|
||||
+5
-1
@@ -10,6 +10,8 @@
|
||||
#import "mp4v2.h"
|
||||
#import "MP42Logging.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MP42Track;
|
||||
|
||||
@protocol MP42MuxerDelegate
|
||||
@@ -23,7 +25,7 @@
|
||||
id <MP42MuxerDelegate> _delegate;
|
||||
id <MP42Logging> _logger;
|
||||
|
||||
NSMutableArray *_workingTracks;
|
||||
NSMutableArray<MP42Track *> *_workingTracks;
|
||||
int32_t _cancelled;
|
||||
}
|
||||
|
||||
@@ -37,3 +39,5 @@
|
||||
- (void)cancel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -9,6 +9,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MP42VideoTrack.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MP42SubtitleTrack : MP42VideoTrack <NSCoding> {
|
||||
@private
|
||||
BOOL _verticalPlacement;
|
||||
@@ -26,6 +28,8 @@
|
||||
@property(nonatomic, readwrite) BOOL allSamplesAreForced;
|
||||
|
||||
@property(nonatomic, readonly) MP42TrackId forcedTrackId;
|
||||
@property(nonatomic, readwrite, assign) MP42Track *forcedTrack;
|
||||
@property(nonatomic, readwrite, assign, nullable) MP42Track *forcedTrack;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -11,6 +11,8 @@
|
||||
#import "MP42Fifo.h"
|
||||
#import "MP42ConverterProtocol.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef struct muxer_helper {
|
||||
// Input helpers
|
||||
MP42FileImporter *importer;
|
||||
@@ -25,8 +27,10 @@ typedef struct muxer_helper {
|
||||
|
||||
@interface MP42Track (MP42TrackMuxerExtentions)
|
||||
|
||||
@property(nonatomic, readonly) muxer_helper *muxer_helper;
|
||||
@property(nonatomic, readonly, nullable) muxer_helper *muxer_helper;
|
||||
|
||||
- (MP42SampleBuffer *)copyNextSample;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+11
-7
@@ -9,6 +9,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MP42MediaFormat.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* MP42Track
|
||||
*/
|
||||
@@ -54,14 +56,14 @@
|
||||
@property(nonatomic, readwrite) MP42TrackId Id;
|
||||
@property(nonatomic, readwrite) MP42TrackId sourceId;
|
||||
|
||||
@property(nonatomic, readwrite, retain) NSURL *sourceURL;
|
||||
@property(nonatomic, readwrite, retain) NSString *format;
|
||||
@property(nonatomic, readwrite, retain) NSString *sourceFormat;
|
||||
@property(nonatomic, readonly, retain) NSString *mediaType;
|
||||
@property(nonatomic, readwrite, copy) NSURL *sourceURL;
|
||||
@property(nonatomic, readwrite, copy) NSString *format;
|
||||
@property(nonatomic, readwrite, copy) NSString *sourceFormat;
|
||||
@property(nonatomic, readonly, copy) NSString *mediaType;
|
||||
|
||||
@property(nonatomic, readwrite, retain) NSString *name;
|
||||
@property(nonatomic, readwrite, retain) NSString *language;
|
||||
@property(nonatomic, readwrite, retain) NSString *extendedLanguageTag;
|
||||
@property(nonatomic, readwrite, copy) NSString *name;
|
||||
@property(nonatomic, readwrite, copy) NSString *language;
|
||||
@property(nonatomic, readwrite, copy) NSString *extendedLanguageTag;
|
||||
|
||||
@property(nonatomic, readwrite) BOOL enabled;
|
||||
@property(nonatomic, readwrite) uint64_t alternate_group;
|
||||
@@ -78,3 +80,5 @@
|
||||
@property(nonatomic, readwrite) uint64_t dataLength;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Reference in new issue
Block a user