package transcode import "fmt" type Options struct { Format string SampleRate int Channels int Codec string } func WhisperOptions() Options { return Options{ Format: FormatWAV, SampleRate: 16000, Channels: 1, Codec: "pcm_s16le", } } func (o *Options) ApplyDefaults() error { spec, err := ResolveFormat(o.Format) if err != nil { return err } if o.Codec == "" { o.Codec = spec.Codec } return nil } func (o *Options) Validate() error { if err := o.ApplyDefaults(); err != nil { return err } if o.SampleRate < 0 || o.Channels < 0 { return fmt.Errorf("sample_rate and channels must be >= 0") } if o.Channels > 8 { return fmt.Errorf("channels must be <= 8") } return nil }