diff --git a/MP42/MP42AudioTrack.m b/MP42/MP42AudioTrack.m index a82177b..5835bf9 100644 --- a/MP42/MP42AudioTrack.m +++ b/MP42/MP42AudioTrack.m @@ -7,6 +7,7 @@ // #import "MP42AudioTrack.h" +#import "MP42Track+Private.h" #import "MP42PrivateUtilities.h" #import "MP42MediaFormat.h" diff --git a/MP42/MP42ChapterTrack.m b/MP42/MP42ChapterTrack.m index b22aea7..43f2b9d 100644 --- a/MP42/MP42ChapterTrack.m +++ b/MP42/MP42ChapterTrack.m @@ -7,6 +7,7 @@ // #import "MP42ChapterTrack.h" +#import "MP42Track+Private.h" #import "MP42SubUtilities.h" #import "MP42PrivateUtilities.h" #import "MP42MediaFormat.h" diff --git a/MP42/MP42ClosedCaptionTrack.m b/MP42/MP42ClosedCaptionTrack.m index cc568dc..5f650af 100644 --- a/MP42/MP42ClosedCaptionTrack.m +++ b/MP42/MP42ClosedCaptionTrack.m @@ -7,6 +7,7 @@ // #import "MP42ClosedCaptionTrack.h" +#import "MP42Track+Private.h" #import "MP42MediaFormat.h" @implementation MP42ClosedCaptionTrack diff --git a/MP42/MP42ComponentLoader.m b/MP42/MP42ComponentLoader.m index ab5babc..addc0de 100644 --- a/MP42/MP42ComponentLoader.m +++ b/MP42/MP42ComponentLoader.m @@ -97,8 +97,8 @@ static NSMutableDictionary *_loadedComponents; - (BOOL)componentLoadedForFormat:(OSType)format { BOOL loaded = NO; - if ([_loadedComponents valueForKey:@(FourCC2Str(format))]) { - loaded = YES;; + if (_loadedComponents[@(FourCC2Str(format))]) { + loaded = YES; } else { AudioComponentDescription acd = { 0 }; acd.componentType = kAudioDecoderComponentType; @@ -137,7 +137,7 @@ static NSMutableDictionary *_loadedComponents; { OSType err = 1; - if ([_loadedComponents valueForKey:@(FourCC2Str(format))]) { + if (_loadedComponents[@(FourCC2Str(format))]) { return noErr; } @@ -172,7 +172,7 @@ static NSMutableDictionary *_loadedComponents; { OSType err = 1; - if ([_loadedComponents valueForKey:@(FourCC2Str(format))]) { + if (_loadedComponents[@(FourCC2Str(format))]) { return noErr; } diff --git a/MP42/MP42File.m b/MP42/MP42File.m index 8ad3450..e243262 100644 --- a/MP42/MP42File.m +++ b/MP42/MP42File.m @@ -13,7 +13,9 @@ #import "MP42PrivateUtilities.h" #import "MP42Languages.h" #import "MP42Track+Muxer.h" +#import "MP42Track+Private.h" #import "MP42PreviewGenerator.h" +#import "MP42Metadata+Private.h" #import "mp4v2.h" @@ -99,8 +101,10 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) { @synthesize muxer = _muxer; + (void)initialize { - MP4SetLogCallback(logCallback); - MP4LogSetLevel(MP4_LOG_INFO); + if (self == [MP42File class]) { + MP4SetLogCallback(logCallback); + MP4LogSetLevel(MP4_LOG_INFO); + } } + (void)setGlobalLogger:(id)logger diff --git a/MP42/MP42FileImporter+Private.h b/MP42/MP42FileImporter+Private.h index d2655ad..c1c2c86 100644 --- a/MP42/MP42FileImporter+Private.h +++ b/MP42/MP42FileImporter+Private.h @@ -23,7 +23,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy) NSArray *inputTracks; @property (nonatomic, copy) NSArray *outputsTracks; -- (BOOL)containsTrack:(MP42Track *)track; - (MP42Track *)inputTrackWithTrackID:(MP42TrackId)trackId; - (void)setActiveTrack:(MP42Track *)track; @@ -33,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)enqueue:(MP42SampleBuffer *)sample; -- (CGFloat)progress; +- (double)progress; - (BOOL)done; - (void)setDone; diff --git a/MP42/MP42Metadata+Private.h b/MP42/MP42Metadata+Private.h index 7db9316..0284741 100644 --- a/MP42/MP42Metadata+Private.h +++ b/MP42/MP42Metadata+Private.h @@ -6,8 +6,13 @@ // Copyright © 2015 Damiano Galassi. All rights reserved. // -#ifndef MP42Metadata_Private_h -#define MP42Metadata_Private_h +NS_ASSUME_NONNULL_BEGIN +@interface MP42Metadata (Private) -#endif /* MP42Metadata_Private_h */ +- (instancetype) initWithFileHandle:(MP42FileHandle)fileHandle; +- (BOOL) writeMetadataWithFileHandle: (MP42FileHandle) fileHandle; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MP42/MP42MkvImporter.m b/MP42/MP42MkvImporter.m index 68d0f5e..9bad3d6 100644 --- a/MP42/MP42MkvImporter.m +++ b/MP42/MP42MkvImporter.m @@ -548,7 +548,7 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t else if (!strcmp(trackInfo->CodecID, "A_EAC3")) { // parse EAC3 header - uint64_t strmtyp, substreamid; + /*uint64_t strmtyp, substreamid; uint64_t frmsiz, fscod, bsid, bsmod, acmod, lfeon; strmtyp = (*(frame+2) >> 6) & 0x3; @@ -571,13 +571,13 @@ int readMkvPacket(struct StdIoStream *ioStream, TrackInfo *trackInfo, uint64_t bsid = (*(frame+5) >> 3) & 0x1f; bsmod = 0; - if (acmod == 0x0) { /* if 1+1 mode (dual mono, so some items need a second value) */ + if (acmod == 0x0) { // if 1+1 mode (dual mono, so some items need a second value) } - if (strmtyp == 0x1) { /* if dependent stream */ + if (strmtyp == 0x1) { // if dependent stream - } + }*/ } mkv_Seek(_matroskaFile, 0, 0); diff --git a/MP42/MP42SubtitleTrack.m b/MP42/MP42SubtitleTrack.m index 3d2937c..2d146d1 100644 --- a/MP42/MP42SubtitleTrack.m +++ b/MP42/MP42SubtitleTrack.m @@ -7,6 +7,7 @@ // #import "MP42SubtitleTrack.h" +#import "MP42Track+Private.h" #import "MP42PrivateUtilities.h" #import "MP42MediaFormat.h" #import "MP42HtmlParser.h" diff --git a/MP42/MP42Track+Private.h b/MP42/MP42Track+Private.h index 327ec5e..8b7d99f 100644 --- a/MP42/MP42Track+Private.h +++ b/MP42/MP42Track+Private.h @@ -6,8 +6,13 @@ // Copyright © 2015 Damiano Galassi. All rights reserved. // -#ifndef MP42Track_Private_h -#define MP42Track_Private_h +NS_ASSUME_NONNULL_BEGIN +@interface MP42Track (Private) -#endif /* MP42Track_Private_h */ +- (instancetype)initWithSourceURL:(NSURL *)URL trackID:(NSInteger)trackID fileHandle:(MP42FileHandle)fileHandle; +- (BOOL)writeToFile:(MP42FileHandle)fileHandle error:(NSError **)outError; + +@end + +NS_ASSUME_NONNULL_END diff --git a/MP42/MP42Track.h b/MP42/MP42Track.h index ee5744f..a765c1a 100644 --- a/MP42/MP42Track.h +++ b/MP42/MP42Track.h @@ -50,10 +50,6 @@ NS_ASSUME_NONNULL_BEGIN void *_helper; } -- (instancetype)initWithSourceURL:(NSURL *)URL trackID:(NSInteger)trackID fileHandle:(MP42FileHandle)fileHandle; - -- (BOOL)writeToFile:(MP42FileHandle)fileHandle error:(NSError **)outError; - @property(nonatomic, readwrite) MP42TrackId trackId; @property(nonatomic, readwrite) MP42TrackId sourceId; diff --git a/MP42/MP42VideoTrack.m b/MP42/MP42VideoTrack.m index d6e0890..cdaa778 100644 --- a/MP42/MP42VideoTrack.m +++ b/MP42/MP42VideoTrack.m @@ -7,7 +7,9 @@ // #import "MP42VideoTrack.h" +#import "MP42Track+Private.h" #import "MP42MediaFormat.h" +#import "MP42Track+Private.h" #import @implementation MP42VideoTrack diff --git a/MP42/NSString+MP42Additions.m b/MP42/NSString+MP42Additions.m index 19b8e4a..3b3d426 100644 --- a/MP42/NSString+MP42Additions.m +++ b/MP42/NSString+MP42Additions.m @@ -11,6 +11,9 @@ @implementation NSString (MP42Additions) - (NSArray *)MP42_componentsSeparatedByRegex:(NSString *)regex { + + NSParameterAssert(regex); + NSMutableArray *results = [NSMutableArray array]; __block NSRange start = NSMakeRange(0, 0); @@ -40,6 +43,9 @@ } - (BOOL)MP42_isMatchedByRegex:(NSString *)regex { + + NSParameterAssert(regex); + NSRegularExpression *r = [NSRegularExpression regularExpressionWithPattern:regex options:NSRegularExpressionCaseInsensitive error:nil]; diff --git a/MP42Foundation.xcodeproj/project.pbxproj b/MP42Foundation.xcodeproj/project.pbxproj index 2ffcf4d..d7b35fd 100644 --- a/MP42Foundation.xcodeproj/project.pbxproj +++ b/MP42Foundation.xcodeproj/project.pbxproj @@ -79,12 +79,16 @@ A96523471BAC315900E994E0 /* NSString+MP42Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = A96523441BAC315900E994E0 /* NSString+MP42Additions.m */; settings = {ASSET_TAGS = (); }; }; A96523481BAC315900E994E0 /* NSString+MP42Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = A96523441BAC315900E994E0 /* NSString+MP42Additions.m */; settings = {ASSET_TAGS = (); }; }; A96523491BAC315900E994E0 /* NSString+MP42Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = A96523441BAC315900E994E0 /* NSString+MP42Additions.m */; settings = {ASSET_TAGS = (); }; }; + A96D28931BAD390400403327 /* MP42Metadata+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A96D28921BAD390400403327 /* MP42Metadata+Private.h */; settings = {ASSET_TAGS = (); }; }; + A96D28941BAD390400403327 /* MP42Metadata+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A96D28921BAD390400403327 /* MP42Metadata+Private.h */; settings = {ASSET_TAGS = (); }; }; A989F1001823AB2E0070AD8C /* MP42Track+Muxer.h in Headers */ = {isa = PBXBuildFile; fileRef = A989F0FF1823AB2E0070AD8C /* MP42Track+Muxer.h */; }; A989F10F1823B3B40070AD8C /* MP42TextSample.h in Headers */ = {isa = PBXBuildFile; fileRef = A989F10D1823B3B40070AD8C /* MP42TextSample.h */; settings = {ATTRIBUTES = (Public, ); }; }; A989F1101823B3B40070AD8C /* MP42TextSample.m in Sources */ = {isa = PBXBuildFile; fileRef = A989F10E1823B3B40070AD8C /* MP42TextSample.m */; }; A991714C195AAAEF005AD68E /* MP42Track+Muxer.m in Sources */ = {isa = PBXBuildFile; fileRef = A991714B195AAAEF005AD68E /* MP42Track+Muxer.m */; }; A991714D195AAAEF005AD68E /* MP42Track+Muxer.m in Sources */ = {isa = PBXBuildFile; fileRef = A991714B195AAAEF005AD68E /* MP42Track+Muxer.m */; }; A991714E195AAAEF005AD68E /* MP42Track+Muxer.m in Sources */ = {isa = PBXBuildFile; fileRef = A991714B195AAAEF005AD68E /* MP42Track+Muxer.m */; }; + A99FCBC41BAD65EF0058E27A /* MP42Track+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A99FCBC31BAD65EF0058E27A /* MP42Track+Private.h */; settings = {ASSET_TAGS = (); }; }; + A99FCBC51BAD65EF0058E27A /* MP42Track+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A99FCBC31BAD65EF0058E27A /* MP42Track+Private.h */; settings = {ASSET_TAGS = (); }; }; A9A0C99C19814B0800A72763 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9A0C99B19814B0800A72763 /* CoreAudio.framework */; }; A9A0C9A419814C9B00A72763 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9A0C9A319814C9B00A72763 /* AudioUnit.framework */; }; A9A0C9B11981593900A72763 /* MP42ComponentLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A9A0C9AF1981593900A72763 /* MP42ComponentLoader.h */; }; @@ -274,10 +278,12 @@ A94BFB2C184C862A00810224 /* eng.traineddata */ = {isa = PBXFileReference; lastKnownFileType = file; name = eng.traineddata; path = Tesseract/share/tessdata/eng.traineddata; sourceTree = SOURCE_ROOT; }; A96523431BAC315900E994E0 /* NSString+MP42Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+MP42Additions.h"; sourceTree = ""; }; A96523441BAC315900E994E0 /* NSString+MP42Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+MP42Additions.m"; sourceTree = ""; }; + A96D28921BAD390400403327 /* MP42Metadata+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MP42Metadata+Private.h"; sourceTree = ""; }; A989F0FF1823AB2E0070AD8C /* MP42Track+Muxer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MP42Track+Muxer.h"; sourceTree = ""; }; A989F10D1823B3B40070AD8C /* MP42TextSample.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MP42TextSample.h; sourceTree = ""; }; A989F10E1823B3B40070AD8C /* MP42TextSample.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MP42TextSample.m; sourceTree = ""; }; A991714B195AAAEF005AD68E /* MP42Track+Muxer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MP42Track+Muxer.m"; sourceTree = ""; }; + A99FCBC31BAD65EF0058E27A /* MP42Track+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MP42Track+Private.h"; sourceTree = ""; }; A9A0C99B19814B0800A72763 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; A9A0C9A319814C9B00A72763 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; }; A9A0C9AF1981593900A72763 /* MP42ComponentLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MP42ComponentLoader.h; sourceTree = ""; }; @@ -528,6 +534,7 @@ A9B9C2311823923100416A4E /* MP42File.m */, A9B9C2501823923100416A4E /* MP42Track.h */, A9B9C2511823923100416A4E /* MP42Track.m */, + A99FCBC31BAD65EF0058E27A /* MP42Track+Private.h */, A9B9C2541823923100416A4E /* MP42VideoTrack.h */, A9B9C2551823923100416A4E /* MP42VideoTrack.m */, A9B9C2211823923100416A4E /* MP42AudioTrack.h */, @@ -540,6 +547,7 @@ A9B9C22C1823923100416A4E /* MP42ClosedCaptionTrack.m */, A9B9C23C1823923100416A4E /* MP42Metadata.h */, A9B9C23D1823923100416A4E /* MP42Metadata.m */, + A96D28921BAD390400403327 /* MP42Metadata+Private.h */, A9B9C23A1823923100416A4E /* MP42MediaFormat.h */, A9B9C23B1823923100416A4E /* MP42MediaFormat.m */, A917286519FD2BCE00348DF8 /* MP42Logging.h */, @@ -717,7 +725,9 @@ buildActionMask = 2147483647; files = ( A9A0C9B21981593900A72763 /* MP42ComponentLoader.h in Headers */, + A96D28941BAD390400403327 /* MP42Metadata+Private.h in Headers */, A917286719FD2BCE00348DF8 /* MP42Logging.h in Headers */, + A99FCBC51BAD65EF0058E27A /* MP42Track+Private.h in Headers */, A9AEFE161B9B111B00771292 /* MP42FileImporter+Private.h in Headers */, A96523461BAC315900E994E0 /* NSString+MP42Additions.h in Headers */, ); @@ -744,6 +754,7 @@ A9B9C2831823923200416A4E /* MP42Image.h in Headers */, A9B9C2C41823957800416A4E /* MP42Languages.h in Headers */, A9B9C2CF182396A100416A4E /* MP42Ratings.h in Headers */, + A99FCBC41BAD65EF0058E27A /* MP42Track+Private.h in Headers */, A925AAAF18379AF800BE84D4 /* MP42Utilities.h in Headers */, A9B9C2911823923200416A4E /* MP42QTImporter.h in Headers */, A9B9C28F1823923200416A4E /* MP42OCRWrapper.h in Headers */, @@ -777,6 +788,7 @@ A9B9C2A11823923200416A4E /* MP42VobSubImporter.h in Headers */, A9B9C2AC1823923200416A4E /* mbs.h in Headers */, A9B9C2891823923200416A4E /* MP42MkvImporter.h in Headers */, + A96D28931BAD390400403327 /* MP42Metadata+Private.h in Headers */, A925AABC1837A16500BE84D4 /* QTKitDecrap.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0;