Avoid testing for FLAC on .opus decoding
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2023-01-28 15:20:54 +01:00
parent 2f8ffb318f
commit 5241fcfde7
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -162,5 +162,5 @@ func (f Format) Encode(source audio.Source, writer io.WriteCloser, options map[s
}
func (f Format) Identify(peek []byte, extension string) bool {
return bytes.Compare(peek[:4], []byte{'O', 'g', 'g', 'S'}) == 0 || bytes.Compare(peek[:4], []byte{'f', 'L', 'a', 'C'}) == 0 || (bytes.Compare(peek[:3], []byte{'I', 'D', '3'}) == 0 && extension != "mp3") || extension == "flac" || extension == "ogg"
return (bytes.Compare(peek[:4], []byte{'O', 'g', 'g', 'S'}) == 0 && extension != "opus" && extension != "vorbis") || bytes.Compare(peek[:4], []byte{'f', 'L', 'a', 'C'}) == 0 || (bytes.Compare(peek[:3], []byte{'I', 'D', '3'}) == 0 && extension != "mp3") || extension == "flac" || extension == "ogg"
}