Try the next importer if one fails.

This commit is contained in:
Damiano Galassi committed 2016-04-01 08:26:47 +02:00
1 parent a33fcd02a0
commit 15a0509306
3 files changed
+10 -2

No files matched your search

+1 -1
View File
@@ -45,7 +45,7 @@
@implementation MP42AVFImporter @implementation MP42AVFImporter
+ (NSArray<NSString *> *)supportedFileFormats { + (NSArray<NSString *> *)supportedFileFormats {
return @[@"mov", @"m2ts", @"ts", @"mts", @"ac3", @"eac3", @"ec3", @"webvtt", @"vtt"]; return @[@"mov", @"mp4", @"m4v", @"m4a", @"m2ts", @"ts", @"mts", @"ac3", @"eac3", @"ec3", @"webvtt", @"vtt"];
} }
- (NSString *)formatForTrack:(AVAssetTrack *)track { - (NSString *)formatForTrack:(AVAssetTrack *)track {
+7
View File
@@ -183,6 +183,13 @@ static void logCallback(MP4LogLevel loglevel, const char *fmt, va_list ap) {
} }
} }
// Refuse to open fragmented mp4
if (MP4HaveAtom(_fileHandle, "moof")) {
[self stopReading];
[self release];
return nil;
};
// Wraps the tracks in obj-c objects // Wraps the tracks in obj-c objects
_tracks = [[NSMutableArray alloc] init]; _tracks = [[NSMutableArray alloc] init];
uint32_t tracksCount = MP4GetNumberOfTracks(_fileHandle, 0, 0); uint32_t tracksCount = MP4GetNumberOfTracks(_fileHandle, 0, 0);
+2 -1
View File
@@ -87,8 +87,9 @@ static NSArray<NSString *> *_supportedFileFormats;
for (MP42Track *track in _tracksArray) { for (MP42Track *track in _tracksArray) {
track.muxer_helper->importer = self; track.muxer_helper->importer = self;
} }
break;
} }
return self;
} }
} }