finish AppSink impl and add example

This commit is contained in:
tinyzimmer
2020-10-03 15:55:47 +03:00
parent 36df9e707b
commit 3870298b98
8 changed files with 481 additions and 34 deletions

23
examples/common.go Normal file
View File

@@ -0,0 +1,23 @@
package examples
import (
"fmt"
"github.com/tinyzimmer/go-gst/gst"
)
// Run is used to wrap the given function in a main loop and print any error
func Run(f func() error) {
mainLoop := gst.NewMainLoop(gst.DefaultMainContext(), false)
defer mainLoop.Unref()
go func() {
if err := f(); err != nil {
fmt.Println("ERROR!", err)
}
mainLoop.Quit()
}()
mainLoop.Run()
}