FLAC Input: Correctly prioritize text CUESheet tag
Prioritize "cuesheet" Vorbis tag over binary CUESheet tag, as the former can contain metadata, while the latter cannot. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
4a0690b3ab
commit
a8c9f748c7
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
NSData *albumArt;
|
NSData *albumArt;
|
||||||
|
|
||||||
|
BOOL cuesheetFound;
|
||||||
NSString *cuesheet;
|
NSString *cuesheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,9 @@ void MetadataCallback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMeta
|
||||||
flacDecoder->hasStreamInfo = YES;
|
flacDecoder->hasStreamInfo = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(metadata->type == FLAC__METADATA_TYPE_CUESHEET) {
|
if(metadata->type == FLAC__METADATA_TYPE_CUESHEET && !flacDecoder->cuesheetFound) {
|
||||||
|
flacDecoder->cuesheetFound = YES;
|
||||||
|
|
||||||
NSString *_cuesheet;
|
NSString *_cuesheet;
|
||||||
grabbag__cuesheet_emit(&_cuesheet, metadata, [[NSString stringWithFormat:@"\"%@\"", [[[flacDecoder->source url] path] lastPathComponent]] UTF8String]);
|
grabbag__cuesheet_emit(&_cuesheet, metadata, [[NSString stringWithFormat:@"\"%@\"", [[[flacDecoder->source url] path] lastPathComponent]] UTF8String]);
|
||||||
|
|
||||||
|
@ -256,6 +258,7 @@ void MetadataCallback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMeta
|
||||||
_genre = value;
|
_genre = value;
|
||||||
} else if([name isEqualToString:@"cuesheet"]) {
|
} else if([name isEqualToString:@"cuesheet"]) {
|
||||||
_cuesheet = value;
|
_cuesheet = value;
|
||||||
|
flacDecoder->cuesheetFound = YES;
|
||||||
} else if([name isEqualToString:@"date"] ||
|
} else if([name isEqualToString:@"date"] ||
|
||||||
[name isEqualToString:@"year"]) {
|
[name isEqualToString:@"year"]) {
|
||||||
_year = [NSNumber numberWithInt:[value intValue]];
|
_year = [NSNumber numberWithInt:[value intValue]];
|
||||||
|
@ -358,6 +361,7 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
|
||||||
replayGainTrackGain = 0.0;
|
replayGainTrackGain = 0.0;
|
||||||
replayGainTrackPeak = 0.0;
|
replayGainTrackPeak = 0.0;
|
||||||
albumArt = [NSData data];
|
albumArt = [NSData data];
|
||||||
|
cuesheetFound = NO;
|
||||||
cuesheet = @"";
|
cuesheet = @"";
|
||||||
|
|
||||||
decoder = FLAC__stream_decoder_new();
|
decoder = FLAC__stream_decoder_new();
|
||||||
|
|
Loading…
Reference in New Issue