From 844dffa2f1f45e8ac8ddd1b84420784c85bbea38 Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 9 Mar 2026 18:26:07 -0400 Subject: [PATCH] fix: add 'opus' to the container aliases for improved direct play detection Signed-off-by: Deluan --- core/transcode/aliases.go | 2 +- core/transcode/decider_test.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/transcode/aliases.go b/core/transcode/aliases.go index 67a64151..0c9bfcb4 100644 --- a/core/transcode/aliases.go +++ b/core/transcode/aliases.go @@ -10,7 +10,7 @@ var containerAliasGroups = func() map[string]string { groups := [][]string{ {"aac", "adts", "m4a", "mp4", "m4b", "m4p"}, {"mpeg", "mp3", "mp2"}, - {"ogg", "oga"}, + {"ogg", "oga", "opus"}, {"aif", "aiff"}, {"asf", "wma"}, {"mpc", "mpp"}, diff --git a/core/transcode/decider_test.go b/core/transcode/decider_test.go index 280060fb..cc9b5fb6 100644 --- a/core/transcode/decider_test.go +++ b/core/transcode/decider_test.go @@ -129,6 +129,18 @@ var _ = Describe("Decider", func() { Expect(decision.CanDirectPlay).To(BeTrue()) }) + It("handles container aliases (opus -> ogg)", func() { + mf := withProbe(&model.MediaFile{ID: "1", Suffix: "opus", Codec: "Opus", BitRate: 165, Channels: 2, SampleRate: 48000}) + ci := &ClientInfo{ + DirectPlayProfiles: []DirectPlayProfile{ + {Containers: []string{"ogg"}, AudioCodecs: []string{"opus"}, Protocols: []string{ProtocolHTTP}}, + }, + } + decision, err := svc.MakeDecision(ctx, mf, ci, DecisionOptions{}) + Expect(err).ToNot(HaveOccurred()) + Expect(decision.CanDirectPlay).To(BeTrue()) + }) + It("handles codec aliases (adts -> aac)", func() { mf := withProbe(&model.MediaFile{ID: "1", Suffix: "m4a", Codec: "AAC", BitRate: 256, Channels: 2}) ci := &ClientInfo{