From abd557943c30edf077c883aef17888656f935135 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sun, 10 Jul 2022 14:57:22 -0700 Subject: [PATCH] [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 --- Plugins/CueSheet/CueSheetDecoder.m | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Plugins/CueSheet/CueSheetDecoder.m b/Plugins/CueSheet/CueSheetDecoder.m index 01b265cf8..8d3f8e6e4 100644 --- a/Plugins/CueSheet/CueSheetDecoder.m +++ b/Plugins/CueSheet/CueSheetDecoder.m @@ -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];