2020-12-26 07:47:10 +00:00
|
|
|
package common
|
|
|
|
|
|
|
|
type RawDecoder struct {
|
2020-12-26 08:07:48 +00:00
|
|
|
file []byte
|
|
|
|
audioExt string
|
2020-12-26 07:47:10 +00:00
|
|
|
}
|
|
|
|
|
2020-12-26 08:07:48 +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 {
|
2021-05-16 04:15:22 +00:00
|
|
|
return "." + d.audioExt
|
2020-12-26 07:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d RawDecoder) GetMeta() Meta {
|
|
|
|
return nil
|
|
|
|
}
|
2020-12-26 08:07:48 +00:00
|
|
|
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() {
|
2020-12-26 15:21:11 +00:00
|
|
|
/*RegisterDecoder("mp3", DecoderFuncWithExt("mp3"))
|
2020-12-26 08:07:48 +00:00
|
|
|
RegisterDecoder("flac", DecoderFuncWithExt("flac"))
|
|
|
|
RegisterDecoder("wav", DecoderFuncWithExt("wav"))
|
|
|
|
RegisterDecoder("ogg", DecoderFuncWithExt("ogg"))
|
2020-12-26 15:21:11 +00:00
|
|
|
RegisterDecoder("m4a", DecoderFuncWithExt("m4a"))*/
|
2020-12-26 07:47:10 +00:00
|
|
|
}
|