summaryrefslogtreecommitdiffstats
path: root/bridge/helper/libtgsconverter.go
blob: 7181da90e8e286b3a8bedaeb4559af1d32767985 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// +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"
}