mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-17 08:30:33 +02:00
fix(metadata): resolve audio format and local artwork
This commit is contained in:
@@ -54,6 +54,8 @@ String? normalizeAudioFormatValue(String? value) {
|
||||
return switch (normalized) {
|
||||
'flac' => 'flac',
|
||||
'alac' => 'alac',
|
||||
'wav' || 'wave' => 'wav',
|
||||
'aiff' || 'aif' || 'aifc' => 'aiff',
|
||||
'aac' || 'mp4a' => 'aac',
|
||||
'eac3' || 'ec_3' => 'eac3',
|
||||
'ac3' || 'ac_3' => 'ac3',
|
||||
@@ -65,6 +67,17 @@ String? normalizeAudioFormatValue(String? value) {
|
||||
};
|
||||
}
|
||||
|
||||
/// Resolves the actual audio codec reported by native metadata probing, while
|
||||
/// falling back to the container format when the codec is absent or generic.
|
||||
///
|
||||
/// This distinction matters for MP4/M4A files: the same container may hold
|
||||
/// AAC, ALAC, Dolby, or other codecs.
|
||||
String? detectedAudioFormatFromMetadata(Map<String, dynamic> metadata) {
|
||||
final codec = normalizeAudioFormatValue(metadata['audio_codec']?.toString());
|
||||
if (codec != null) return codec;
|
||||
return normalizeAudioFormatValue(metadata['format']?.toString());
|
||||
}
|
||||
|
||||
bool isLossyAudioFormat(String? value) {
|
||||
return const {
|
||||
'aac',
|
||||
|
||||
Reference in New Issue
Block a user