Fall back on non-container file parsing, since VGMStream is too greedy with its extension list

CQTexperiment
Christopher Snowhill 2020-02-16 01:00:39 -08:00
parent 1bc4ad85d2
commit 7308aa5f7b
2 changed files with 21 additions and 9 deletions

View File

@ -311,6 +311,7 @@ static PluginController *sharedPluginController = nil;
//If no properties reader is defined, use the decoder's properties. //If no properties reader is defined, use the decoder's properties.
- (NSDictionary *)propertiesForURL:(NSURL *)url - (NSDictionary *)propertiesForURL:(NSURL *)url
{ {
NSDictionary *properties = nil;
NSString *ext = [url pathExtension]; NSString *ext = [url pathExtension];
id<CogSource> source = [self audioSourceForURL:url]; id<CogSource> source = [self audioSourceForURL:url];
@ -318,11 +319,13 @@ static PluginController *sharedPluginController = nil;
return nil; return nil;
NSArray *readers = [propertiesReadersByExtension objectForKey:[ext lowercaseString]]; NSArray *readers = [propertiesReadersByExtension objectForKey:[ext lowercaseString]];
NSString *classString; NSString *classString = nil;
if (readers) if (readers)
{ {
if ( [readers count] > 1 ) { if ( [readers count] > 1 ) {
return [CogPropertiesReaderMulti propertiesForSource:source readers:readers]; properties = [CogPropertiesReaderMulti propertiesForSource:source readers:readers];
if (properties != nil && [properties count])
return properties;
} }
else { else {
classString = [readers objectAtIndex:0]; classString = [readers objectAtIndex:0];
@ -336,11 +339,12 @@ static PluginController *sharedPluginController = nil;
{ {
Class propertiesReader = NSClassFromString(classString); Class propertiesReader = NSClassFromString(classString);
return [propertiesReader propertiesForSource:source]; properties = [propertiesReader propertiesForSource:source];
if (properties != nil && [properties count])
return properties;
} }
else
{ {
id<CogDecoder> decoder = [self audioDecoderForSource:source]; id<CogDecoder> decoder = [self audioDecoderForSource:source];
if (![decoder open:source]) if (![decoder open:source])
{ {

View File

@ -337,10 +337,18 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
{ {
//Container vs non-container url //Container vs non-container url
if ([[self acceptableContainerTypes] containsObject:[[url pathExtension] lowercaseString]]) { if ([[self acceptableContainerTypes] containsObject:[[url pathExtension] lowercaseString]]) {
[containedURLs addObjectsFromArray:[AudioContainer urlsForContainerURL:url]]; NSArray * urls = [AudioContainer urlsForContainerURL:url];
if (urls != nil && [urls count] != 0) {
[containedURLs addObjectsFromArray:urls];
//Make sure the container isn't added twice. //Make sure the container isn't added twice.
[uniqueURLs addObject:url]; [uniqueURLs addObject:url];
}
else {
/* Fall back on adding the raw file if all container parsers have failed. */
[fileURLs addObject:url];
}
} }
else if ([[[url pathExtension] lowercaseString] isEqualToString:@"xml"]) else if ([[[url pathExtension] lowercaseString] isEqualToString:@"xml"])
{ {