Add new methods.
This commit is contained in:
1 parent
0dec3963f6
commit
ba4aca5cfb
3 files changed
+25
-3
No files matched your search
@@ -36,6 +36,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
dispatch_semaphore_t _doneSem;
|
dispatch_semaphore_t _doneSem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (NSArray<NSString *> *)supportedFileFormats;
|
||||||
|
+ (BOOL)canInitWithFileType:(NSString *)fileType;
|
||||||
|
|
||||||
- (instancetype)initWithURL:(NSURL *)fileURL error:(NSError **)error;
|
- (instancetype)initWithURL:(NSURL *)fileURL error:(NSError **)error;
|
||||||
|
|
||||||
@property(nonatomic, readonly) NSURL *fileURL;
|
@property(nonatomic, readonly) NSURL *fileURL;
|
||||||
|
|||||||
+13
-1
@@ -32,6 +32,17 @@
|
|||||||
|
|
||||||
@implementation MP42FileImporter
|
@implementation MP42FileImporter
|
||||||
|
|
||||||
|
+ (NSArray<NSString *> *)supportedFileFormats {
|
||||||
|
return @[@"scc", @"smi", @"txt", @"m4v", @"mp4",
|
||||||
|
@"m4a", @"m4a", @"mov", @"ts", @"mts",
|
||||||
|
@"m2ts", @"mkv", @"mka", @"mks", @"h264",
|
||||||
|
@"264", @"idx", @"aac", @"ac3", @"eac3", @"srt"];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (BOOL)canInitWithFileType:(NSString *)fileType {
|
||||||
|
return [[MP42FileImporter supportedFileFormats] containsObject:fileType.lowercaseString];
|
||||||
|
}
|
||||||
|
|
||||||
- (instancetype)initWithURL:(NSURL *)fileURL error:(NSError **)error;
|
- (instancetype)initWithURL:(NSURL *)fileURL error:(NSError **)error;
|
||||||
{
|
{
|
||||||
[self release];
|
[self release];
|
||||||
@@ -77,7 +88,8 @@
|
|||||||
else if ([pathExtension caseInsensitiveCompare: @"m2ts"] == NSOrderedSame ||
|
else if ([pathExtension caseInsensitiveCompare: @"m2ts"] == NSOrderedSame ||
|
||||||
[pathExtension caseInsensitiveCompare: @"ts"] == NSOrderedSame ||
|
[pathExtension caseInsensitiveCompare: @"ts"] == NSOrderedSame ||
|
||||||
[pathExtension caseInsensitiveCompare: @"mts"] == NSOrderedSame ||
|
[pathExtension caseInsensitiveCompare: @"mts"] == NSOrderedSame ||
|
||||||
[pathExtension caseInsensitiveCompare: @"mov"] == NSOrderedSame) {
|
[pathExtension caseInsensitiveCompare: @"mov"] == NSOrderedSame ||
|
||||||
|
[pathExtension caseInsensitiveCompare: @"eac3"] == NSOrderedSame) {
|
||||||
self = [MP42AVFImporter alloc];
|
self = [MP42AVFImporter alloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-2
@@ -65,15 +65,17 @@
|
|||||||
NSMutableArray<MP42Track *> *unsupportedTracks = [[NSMutableArray alloc] init];;
|
NSMutableArray<MP42Track *> *unsupportedTracks = [[NSMutableArray alloc] init];;
|
||||||
|
|
||||||
for (MP42Track *track in _workingTracks) {
|
for (MP42Track *track in _workingTracks) {
|
||||||
|
|
||||||
MP4TrackId dstTrackId = 0;
|
MP4TrackId dstTrackId = 0;
|
||||||
NSData *magicCookie = nil;;
|
NSData *magicCookie = nil;
|
||||||
NSInteger timeScale = 0;
|
NSInteger timeScale = 0;
|
||||||
muxer_helper *helper = track.muxer_helper;
|
muxer_helper *helper = track.muxer_helper;
|
||||||
|
|
||||||
if (helper) {
|
if (helper) {
|
||||||
magicCookie = [helper->importer magicCookieForTrack:track];
|
magicCookie = [helper->importer magicCookieForTrack:track];
|
||||||
timeScale = [helper->importer timescaleForTrack:track];
|
timeScale = [helper->importer timescaleForTrack:track];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
[unsupportedTracks addObject:track];
|
[unsupportedTracks addObject:track];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -226,6 +228,11 @@
|
|||||||
[helper->importer setActiveTrack:track];
|
[helper->importer setActiveTrack:track];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EAC-3 audio tack
|
||||||
|
else if ([track isMemberOfClass:[MP42AudioTrack class]] && [track.format isEqualToString:MP42AudioFormatEAC3]) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// ALAC audio track
|
// ALAC audio track
|
||||||
else if ([track isMemberOfClass:[MP42AudioTrack class]] && [track.format isEqualToString:MP42AudioFormatALAC]) {
|
else if ([track isMemberOfClass:[MP42AudioTrack class]] && [track.format isEqualToString:MP42AudioFormatALAC]) {
|
||||||
dstTrackId = MP4AddALACAudioTrack(_fileHandle,
|
dstTrackId = MP4AddALACAudioTrack(_fileHandle,
|
||||||
|
|||||||
Reference in new issue
Block a user