Encoder interface
This commit is contained in:
parent
b60d7d1274
commit
4898ae67cf
10
encoder/encoder.go
Normal file
10
encoder/encoder.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package encoder
|
||||
|
||||
import "git.gammaspectra.live/S.O.N.G/Ignite/frame"
|
||||
|
||||
type Encoder interface {
|
||||
Encode(pts int64, f frame.Frame) error
|
||||
Flush() error
|
||||
Close()
|
||||
Version() string
|
||||
}
|
|
@ -29,6 +29,12 @@ type Encoder struct {
|
|||
h *C.x264_t
|
||||
}
|
||||
|
||||
var x264Version = "x264 " + C.GoString(C.X264_VERSION)
|
||||
|
||||
func Version() string {
|
||||
return x264Version
|
||||
}
|
||||
|
||||
func NewEncoder(w io.Writer, stream *y4m.Stream, settings map[string]any) (*Encoder, error) {
|
||||
e := &Encoder{
|
||||
w: w,
|
||||
|
@ -225,6 +231,10 @@ func (e *Encoder) Flush() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (e *Encoder) Version() string {
|
||||
return Version()
|
||||
}
|
||||
|
||||
func (e *Encoder) Close() {
|
||||
if e.cleaned.Swap(true) == false {
|
||||
if e.h != nil {
|
||||
|
|
Loading…
Reference in a new issue