Load the DTS decoder from Perian too.

This commit is contained in:
Damiano Galassi committed 2014-07-29 12:36:44 +02:00
1 parent adc294be53
commit dbf73e87c8
1 file changed
+17
+17
View File
@@ -41,6 +41,7 @@ static NSMutableDictionary *_loadedComponents;
} }
- (void)loadBundledComponents { - (void)loadBundledComponents {
@synchronized(self) {
NSURL *url = [[[NSBundle mainBundle] resourceURL] URLByAppendingPathComponent:@"Decoders"]; NSURL *url = [[[NSBundle mainBundle] resourceURL] URLByAppendingPathComponent:@"Decoders"];
if (![[NSFileManager defaultManager] fileExistsAtPath:[url path] isDirectory:NULL]) { if (![[NSFileManager defaultManager] fileExistsAtPath:[url path] isDirectory:NULL]) {
@@ -79,11 +80,26 @@ static NSMutableDictionary *_loadedComponents;
NSLog(@"FLAC Decoder loaded"); NSLog(@"FLAC Decoder loaded");
} }
} }
if (![self componentLoadedForFormat:'DTS ']) {
OSStatus err = [self loadComponent:kAudioDecoderComponentType
format:'DTS '
manufacturer:'Peri'
url:[url URLByAppendingPathComponent:@"Perian.component/Contents/MacOS/Perian"]
entry:"FFissionVBRDecoderEntry"];
if (!err) {
NSLog(@"DTS Decoder loaded");
}
}
}
} }
- (BOOL)componentLoadedForFormat:(OSType)format { - (BOOL)componentLoadedForFormat:(OSType)format {
BOOL loaded = NO; BOOL loaded = NO;
if ([_loadedComponents valueForKey:@(FourCC2Str(format))]) {
loaded = YES;;
} else {
AudioComponentDescription acd = { 0 }; AudioComponentDescription acd = { 0 };
acd.componentType = kAudioDecoderComponentType; acd.componentType = kAudioDecoderComponentType;
acd.componentSubType = format; acd.componentSubType = format;
@@ -96,6 +112,7 @@ static NSMutableDictionary *_loadedComponents;
loaded = YES; loaded = YES;
} }
} }
}
return loaded; return loaded;
} }