4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-08 09:04:04 +00:00

Convert .tgs with go libraries (and cgo) (telegram) (#1569)

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>
This commit is contained in:
Benau
2021-08-25 04:32:50 +08:00
committed by GitHub
parent d4195deb3a
commit 53cafa9f3d
310 changed files with 121526 additions and 85 deletions

View File

@ -0,0 +1,30 @@
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
}