[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
Christopher Snowhill 2022-07-10 14:57:22 -07:00
parent 39d3f7edfe
commit abd557943c
1 changed files with 2 additions and 16 deletions

View File

@ -83,6 +83,8 @@ static void *kCueSheetDecoderContext = &kCueSheetDecoderContext;
decoder = [NSClassFromString(@"AudioDecoder") audioDecoderForSource:source skipCue:YES];
[self registerObservers];
if(![decoder open:source]) {
ALog(@"Could not open cuesheet decoder");
return NO;
@ -166,22 +168,6 @@ static void *kCueSheetDecoderContext = &kCueSheetDecoderContext;
} else {
// Fix for embedded cuesheet handler parsing non-embedded files,
// 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];
int bitsPerSample = [[properties objectForKey:@"bitsPerSample"] intValue];
int channels = [[properties objectForKey:@"channels"] intValue];