Fix VGM parsing so it doesn't hit the other two registered VGM container handlers

CQTexperiment
Christopher Snowhill 2019-11-08 15:04:43 -08:00
parent 5c85c2a1b9
commit cb8fb9ce87
1 changed files with 11 additions and 1 deletions

View File

@ -18,7 +18,9 @@
+ (NSArray *)fileTypes
{
//There doesn't seem to be a way to get this list. These are the only multitrack types.
return [NSArray arrayWithObjects:@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sgc", nil];
return [NSArray arrayWithObjects:@"ay", @"gbs", @"hes", @"kss", @"nsf", @"nsfe", @"sap", @"sgc",
@"vgm",@"vgz", // These are included so they can override AdPlug
nil];
}
+ (NSArray *)mimeTypes
@ -38,6 +40,14 @@
// input url already has fragment defined - no need to expand further
return [NSMutableArray arrayWithObject:url];
}
// Dodge both VGMStream and AdPlug
NSString * extension = [url pathExtension];
if (extension && ([extension caseInsensitiveCompare:@"vgm"] == NSOrderedSame ||
[extension caseInsensitiveCompare:@"vgz"] == NSOrderedSame))
{
return [NSMutableArray arrayWithObject:[NSURL URLWithString:[[url absoluteString] stringByAppendingString:@"#0"]]];
}
id audioSourceClass = NSClassFromString(@"AudioSource");
id<CogSource> source = [audioSourceClass audioSourceForURL:url];