cli/algo/common/raw.go

48 lines
961 B
Go
Raw Normal View History

2020-12-26 07:47:10 +00:00
package common
type RawDecoder struct {
file []byte
audioExt string
2020-12-26 07:47:10 +00:00
}
//goland:noinspection GoUnusedExportedFunction
2020-12-26 07:47:10 +00:00
func NewRawDecoder(file []byte) Decoder {
return &RawDecoder{file: file}
}
func (d RawDecoder) Validate() error {
return nil
}
func (d RawDecoder) Decode() error {
return nil
}
func (d RawDecoder) GetCoverImage() []byte {
return nil
}
func (d RawDecoder) GetAudioData() []byte {
return d.file
}
func (d RawDecoder) GetAudioExt() string {
return d.audioExt
2020-12-26 07:47:10 +00:00
}
func (d RawDecoder) GetMeta() Meta {
return nil
}
func DecoderFuncWithExt(ext string) NewDecoderFunc {
return func(file []byte) Decoder {
return &RawDecoder{file: file, audioExt: ext}
}
}
2020-12-26 07:47:10 +00:00
func init() {
RegisterDecoder("mp3", DecoderFuncWithExt("mp3"))
RegisterDecoder("flac", DecoderFuncWithExt("flac"))
RegisterDecoder("wav", DecoderFuncWithExt("wav"))
RegisterDecoder("ogg", DecoderFuncWithExt("ogg"))
RegisterDecoder("m4a", DecoderFuncWithExt("m4a"))
2020-12-26 07:47:10 +00:00
}