mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-24 03:32:02 -08:00
53cafa9f3d
This commit adds support for go/cgo tgs conversion when building with the -tags `cgo` The default binaries are still "pure" go and uses the old way of converting. * Move lottie_convert.py conversion code to its own file * Add optional libtgsconverter * Update vendor * Apply suggestions from code review * Update bridge/helper/libtgsconverter.go Co-authored-by: Wim <wim@42.be>
31 lines
528 B
Go
31 lines
528 B
Go
package libtgsconverter
|
|
|
|
import "bytes"
|
|
import "image"
|
|
import "image/png"
|
|
|
|
type topng struct {
|
|
result []byte
|
|
}
|
|
|
|
func(to_png *topng) init(w uint, h uint, options ConverterOptions) {
|
|
}
|
|
|
|
func(to_png *topng) SupportsAnimation() bool {
|
|
return false
|
|
}
|
|
|
|
func (to_png *topng) AddFrame(image *image.RGBA, fps uint) error {
|
|
var data []byte
|
|
w := bytes.NewBuffer(data)
|
|
if err := png.Encode(w, image); err != nil {
|
|
return err
|
|
}
|
|
to_png.result = w.Bytes()
|
|
return nil
|
|
}
|
|
|
|
func (to_png *topng) Result() []byte {
|
|
return to_png.result
|
|
}
|