From 7308aa5f7b57acc26788d4413976652944ae1c26 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sun, 16 Feb 2020 01:00:39 -0800 Subject: [PATCH] Fall back on non-container file parsing, since VGMStream is too greedy with its extension list --- Audio/PluginController.m | 16 ++++++++++------ Playlist/PlaylistLoader.m | 14 +++++++++++--- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Audio/PluginController.m b/Audio/PluginController.m index a33b13727..a644fda28 100644 --- a/Audio/PluginController.m +++ b/Audio/PluginController.m @@ -311,6 +311,7 @@ static PluginController *sharedPluginController = nil; //If no properties reader is defined, use the decoder's properties. - (NSDictionary *)propertiesForURL:(NSURL *)url { + NSDictionary *properties = nil; NSString *ext = [url pathExtension]; id source = [self audioSourceForURL:url]; @@ -318,11 +319,13 @@ static PluginController *sharedPluginController = nil; return nil; NSArray *readers = [propertiesReadersByExtension objectForKey:[ext lowercaseString]]; - NSString *classString; + NSString *classString = nil; if (readers) { if ( [readers count] > 1 ) { - return [CogPropertiesReaderMulti propertiesForSource:source readers:readers]; + properties = [CogPropertiesReaderMulti propertiesForSource:source readers:readers]; + if (properties != nil && [properties count]) + return properties; } else { classString = [readers objectAtIndex:0]; @@ -336,11 +339,12 @@ static PluginController *sharedPluginController = nil; { Class propertiesReader = NSClassFromString(classString); - return [propertiesReader propertiesForSource:source]; + properties = [propertiesReader propertiesForSource:source]; + if (properties != nil && [properties count]) + return properties; } - else - { - + + { id decoder = [self audioDecoderForSource:source]; if (![decoder open:source]) { diff --git a/Playlist/PlaylistLoader.m b/Playlist/PlaylistLoader.m index 9f57b36a3..ff6d1f176 100755 --- a/Playlist/PlaylistLoader.m +++ b/Playlist/PlaylistLoader.m @@ -337,10 +337,18 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL { //Container vs non-container url 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. - [uniqueURLs addObject:url]; + //Make sure the container isn't added twice. + [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"]) {