go : support "auto" as an option when set language (#462)

Co-authored-by: Ming <ming@localhost>
This commit is contained in:
polarmoon
2023-02-03 23:09:27 -08:00
committed by GitHub
parent 291980369c
commit b2fc4c7010
3 changed files with 13 additions and 2 deletions

View File

@@ -49,6 +49,10 @@ func (p *Params) SetSpeedup(v bool) {
// Set language id
func (p *Params) SetLanguage(lang int) error {
if lang == -1 {
p.language = nil
return nil
}
str := C.whisper_lang_str(C.int(lang))
if str == nil {
return ErrInvalidLanguage