33 lines
696 B
Go
33 lines
696 B
Go
package main
|
|
|
|
import (
|
|
"git.gammaspectra.live/S.O.N.G/Ignite/encoder"
|
|
"git.gammaspectra.live/S.O.N.G/Ignite/frame"
|
|
"git.gammaspectra.live/S.O.N.G/Ignite/utilities"
|
|
"io"
|
|
"slices"
|
|
)
|
|
|
|
const (
|
|
EncoderX264 = "libx264"
|
|
EncoderAOM = "libaom"
|
|
)
|
|
|
|
type EncoderEntry struct {
|
|
Name string
|
|
Version func() string
|
|
MimeType string
|
|
New func(w io.Writer, properties frame.StreamProperties, settings map[string]any, logger utilities.Logger) (encoder.Encoder, error)
|
|
}
|
|
|
|
var Encoders []EncoderEntry
|
|
|
|
func GetEncoder(name string) *EncoderEntry {
|
|
if i := slices.IndexFunc(Encoders, func(entry EncoderEntry) bool {
|
|
return entry.Name == name
|
|
}); i != -1 {
|
|
return &Encoders[i]
|
|
}
|
|
return nil
|
|
}
|