fix: raw don't access registry

pull/41/head
Unlock Music Dev 2 years ago
parent 8fd6763b29
commit 6f1cdc5b4f
No known key found for this signature in database
GPG Key ID: 95202E10D3413A1D

@ -4,7 +4,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"strings"
) )
type RawDecoder struct { type RawDecoder struct {
@ -26,13 +25,12 @@ func (d *RawDecoder) Validate() error {
return fmt.Errorf("seek file failed: %v", err) return fmt.Errorf("seek file failed: %v", err)
} }
for ext, sniffer := range snifferRegistry { var ok bool
if sniffer(header) { d.audioExt, ok = SniffAll(header)
d.audioExt = strings.ToLower(ext) if !ok {
return nil return errors.New("raw: sniff audio type failed")
}
} }
return errors.New("audio doesn't recognized") return nil
} }
func (d *RawDecoder) Read(p []byte) (n int, err error) { func (d *RawDecoder) Read(p []byte) (n int, err error) {

Loading…
Cancel
Save