1
0
forked from um/cli

fix: raw don't access registry

This commit is contained in:
Unlock Music Dev 2022-11-19 07:25:45 +08:00
parent 8fd6763b29
commit 6f1cdc5b4f
Signed by untrusted user: um-dev
GPG Key ID: 95202E10D3413A1D

View File

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