refactor: change decoder init parameter

This commit is contained in:
Unlock Music Dev
2022-12-04 23:05:38 +08:00
parent ad64a0f91d
commit ea3236e14b
10 changed files with 32 additions and 20 deletions

View File

@@ -6,7 +6,13 @@ import (
"strings"
)
type NewDecoderFunc func(rd io.ReadSeeker) Decoder
type DecoderParams struct {
Reader io.ReadSeeker // required
Extension string // required, source extension, eg. ".mp3"
FilePath string // optional, source file path
}
type NewDecoderFunc func(p *DecoderParams) Decoder
type decoderItem struct {
noop bool

View File

@@ -14,8 +14,8 @@ type RawDecoder struct {
audioExt string
}
func NewRawDecoder(rd io.ReadSeeker) Decoder {
return &RawDecoder{rd: rd}
func NewRawDecoder(p *DecoderParams) Decoder {
return &RawDecoder{rd: p.Reader}
}
func (d *RawDecoder) Validate() error {