mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-14 05:49:02 +02:00
fix(audio): preserve Opus codec in M4A scans
This commit is contained in:
@@ -258,6 +258,8 @@ func libraryFormatForM4ACodec(codec string) string {
|
||||
return "ac3"
|
||||
case "ac4", "ac-4":
|
||||
return "ac4"
|
||||
case "opus":
|
||||
return "opus"
|
||||
case "aac", "mp4a":
|
||||
return "m4a"
|
||||
default:
|
||||
|
||||
@@ -842,6 +842,8 @@ func normalizeM4AAudioCodec(atomType string) string {
|
||||
return "ac3"
|
||||
case "ac-4":
|
||||
return "ac4"
|
||||
case "Opus":
|
||||
return "opus"
|
||||
default:
|
||||
return strings.TrimSpace(atomType)
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ func TestM4ACodecFormatMapping(t *testing.T) {
|
||||
"ec-3": "eac3",
|
||||
"ac-3": "ac3",
|
||||
"ac-4": "ac4",
|
||||
"Opus": "opus",
|
||||
}
|
||||
for atomType, want := range cases {
|
||||
if got := normalizeM4AAudioCodec(atomType); got != want {
|
||||
@@ -69,6 +70,9 @@ func TestM4ACodecFormatMapping(t *testing.T) {
|
||||
if got := libraryFormatForM4ACodec("eac3"); got != "eac3" {
|
||||
t.Fatalf("libraryFormatForM4ACodec(eac3) = %q", got)
|
||||
}
|
||||
if got := libraryFormatForM4ACodec("Opus"); got != "opus" {
|
||||
t.Fatalf("libraryFormatForM4ACodec(Opus) = %q", got)
|
||||
}
|
||||
if got := libraryFormatForM4ACodec("aac"); got != "m4a" {
|
||||
t.Fatalf("libraryFormatForM4ACodec(aac) = %q", got)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user