[Cuesheet Input] Don't repeatedly open file
The input file has already been opened for decoding by an earlier step in the testing process, reuse the decoder from that. Spares a decoder open cycle on all embedded cuesheet supporting formats. Signed-off-by: Christopher Snowhill <kode54@gmail.com>main
parent
39d3f7edfe
commit
abd557943c
|
@ -83,6 +83,8 @@ static void *kCueSheetDecoderContext = &kCueSheetDecoderContext;
|
||||||
|
|
||||||
decoder = [NSClassFromString(@"AudioDecoder") audioDecoderForSource:source skipCue:YES];
|
decoder = [NSClassFromString(@"AudioDecoder") audioDecoderForSource:source skipCue:YES];
|
||||||
|
|
||||||
|
[self registerObservers];
|
||||||
|
|
||||||
if(![decoder open:source]) {
|
if(![decoder open:source]) {
|
||||||
ALog(@"Could not open cuesheet decoder");
|
ALog(@"Could not open cuesheet decoder");
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -166,22 +168,6 @@ static void *kCueSheetDecoderContext = &kCueSheetDecoderContext;
|
||||||
} else {
|
} else {
|
||||||
// Fix for embedded cuesheet handler parsing non-embedded files,
|
// Fix for embedded cuesheet handler parsing non-embedded files,
|
||||||
// or files that are already in the playlist without a fragment
|
// or files that are already in the playlist without a fragment
|
||||||
source = [NSClassFromString(@"AudioSource") audioSourceForURL:url];
|
|
||||||
|
|
||||||
if(![source open:url]) {
|
|
||||||
ALog(@"Could not open cuesheet source");
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
decoder = [NSClassFromString(@"AudioDecoder") audioDecoderForSource:source skipCue:YES];
|
|
||||||
|
|
||||||
[self registerObservers];
|
|
||||||
|
|
||||||
if(![decoder open:source]) {
|
|
||||||
ALog(@"Could not open cuesheet decoder");
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSDictionary *properties = [decoder properties];
|
NSDictionary *properties = [decoder properties];
|
||||||
int bitsPerSample = [[properties objectForKey:@"bitsPerSample"] intValue];
|
int bitsPerSample = [[properties objectForKey:@"bitsPerSample"] intValue];
|
||||||
int channels = [[properties objectForKey:@"channels"] intValue];
|
int channels = [[properties objectForKey:@"channels"] intValue];
|
||||||
|
|
Loading…
Reference in New Issue