feat(QMCv2): replace with old decoder

This commit is contained in:
MengYX
2021-12-14 04:01:04 +08:00
parent 7755d47f7a
commit deaa58e91f
8 changed files with 119 additions and 431 deletions

View File

@ -12,15 +12,15 @@ type decoderItem struct {
decoder NewDecoderFunc
}
var decoderRegistry = make(map[string][]decoderItem)
var DecoderRegistry = make(map[string][]decoderItem)
func RegisterDecoder(ext string, noop bool, dispatchFunc NewDecoderFunc) {
decoderRegistry[ext] = append(decoderRegistry[ext],
DecoderRegistry[ext] = append(DecoderRegistry[ext],
decoderItem{noop: noop, decoder: dispatchFunc})
}
func GetDecoder(filename string, skipNoop bool) (rs []NewDecoderFunc) {
ext := strings.ToLower(strings.TrimLeft(filepath.Ext(filename), "."))
for _, dec := range decoderRegistry[ext] {
for _, dec := range DecoderRegistry[ext] {
if skipNoop && dec.noop {
continue
}