forked from jshiffer/matterbridge
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>
35 lines
803 B
Go
35 lines
803 B
Go
// +build cgo
|
|
|
|
package helper
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/Benau/tgsconverter/libtgsconverter"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func CanConvertTgsToX() error {
|
|
return nil
|
|
}
|
|
|
|
// ConvertTgsToX convert input data (which should be tgs format) to any format supported by libtgsconverter
|
|
func ConvertTgsToX(data *[]byte, outputFormat string, logger *logrus.Entry) error {
|
|
options := libtgsconverter.NewConverterOptions()
|
|
options.SetExtension(outputFormat)
|
|
blob, err := libtgsconverter.ImportFromData(*data, options)
|
|
if err != nil {
|
|
return fmt.Errorf("failed to run libtgsconverter.ImportFromData: %s", err.Error())
|
|
}
|
|
|
|
*data = blob
|
|
return nil
|
|
}
|
|
|
|
func SupportsFormat(format string) bool {
|
|
return libtgsconverter.SupportsExtension(format)
|
|
}
|
|
|
|
func LottieBackend() string {
|
|
return "libtgsconverter"
|
|
}
|