summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/Benau/go_rlottie/go_rlottie.go
diff options
context:
space:
mode:
authorBenau <Benau@users.noreply.github.com>2021-08-25 04:32:50 +0800
committerGitHub <noreply@github.com>2021-08-24 22:32:50 +0200
commit53cafa9f3d0c8be33821fc7338b1da97e91d9cc6 (patch)
tree964a225219099a1a1c282e27913767da588191b4 /vendor/github.com/Benau/go_rlottie/go_rlottie.go
parentd4195deb3a6305c49c50ff30e8af978c7f1bdd92 (diff)
downloadmatterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.tar.gz
matterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.tar.bz2
matterbridge-msglm-53cafa9f3d0c8be33821fc7338b1da97e91d9cc6.zip
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>
Diffstat (limited to 'vendor/github.com/Benau/go_rlottie/go_rlottie.go')
-rw-r--r--vendor/github.com/Benau/go_rlottie/go_rlottie.go56
1 files changed, 56 insertions, 0 deletions
diff --git a/vendor/github.com/Benau/go_rlottie/go_rlottie.go b/vendor/github.com/Benau/go_rlottie/go_rlottie.go
new file mode 100644
index 00000000..c53392e3
--- /dev/null
+++ b/vendor/github.com/Benau/go_rlottie/go_rlottie.go
@@ -0,0 +1,56 @@
+package go_rlottie
+
+/*
+#cgo !windows LDFLAGS: -lm
+#cgo windows CFLAGS: -DRLOTTIE_BUILD=0
+#cgo windows CXXFLAGS: -DRLOTTIE_BUILD=0
+#cgo CXXFLAGS: -std=c++14 -fno-exceptions -fno-asynchronous-unwind-tables -fno-rtti -Wall -fvisibility=hidden -Wnon-virtual-dtor -Woverloaded-virtual -Wno-unused-parameter
+#include "rlottie_capi.h"
+void lottie_configure_model_cache_size(size_t cacheSize);
+*/
+import "C"
+import "unsafe"
+
+type Lottie_Animation *C.Lottie_Animation
+
+func LottieConfigureModelCacheSize(size uint) {
+ C.lottie_configure_model_cache_size(C.size_t(size))
+}
+
+func LottieAnimationFromData(data string, key string, resource_path string) Lottie_Animation {
+ var animation Lottie_Animation
+ animation = C.lottie_animation_from_data(C.CString(data), C.CString(key), C.CString(resource_path))
+ return animation
+}
+
+func LottieAnimationDestroy(animation Lottie_Animation) {
+ C.lottie_animation_destroy(animation)
+}
+
+func LottieAnimationGetSize(animation Lottie_Animation) (uint, uint) {
+ var width C.size_t
+ var height C.size_t
+ C.lottie_animation_get_size(animation, &width, &height)
+ return uint(width), uint(height)
+}
+
+func LottieAnimationGetTotalframe(animation Lottie_Animation) uint {
+ return uint(C.lottie_animation_get_totalframe(animation))
+}
+
+func LottieAnimationGetFramerate(animation Lottie_Animation) float64 {
+ return float64(C.lottie_animation_get_framerate(animation))
+}
+
+func LottieAnimationGetFrameAtPos(animation Lottie_Animation, pos float32) uint {
+ return uint(C.lottie_animation_get_frame_at_pos(animation, C.float(pos)))
+}
+
+func LottieAnimationGetDuration(animation Lottie_Animation) float64 {
+ return float64(C.lottie_animation_get_duration(animation))
+}
+
+func LottieAnimationRender(animation Lottie_Animation, frame_num uint, buffer []byte, width uint, height uint, bytes_per_line uint) {
+ var ptr *C.uint32_t = (*C.uint32_t)(unsafe.Pointer(&buffer[0]));
+ C.lottie_animation_render(animation, C.size_t(frame_num), ptr, C.size_t(width), C.size_t(height), C.size_t(bytes_per_line))
+}