mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-07 17:00:54 +08:00
add example files
This commit is contained in:
27
hack/clock_id_wait.go
Normal file
27
hack/clock_id_wait.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/tinyzimmer/go-gst/gst"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gst.Init(nil)
|
||||
pipeline, _ := gst.NewPipelineFromString("fakesrc ! fakesink")
|
||||
defer pipeline.Unref()
|
||||
|
||||
clock := pipeline.GetPipelineClock()
|
||||
|
||||
id := clock.NewSingleShotID(gst.ClockTime(time.Minute.Nanoseconds()))
|
||||
|
||||
go func() {
|
||||
id.Wait(gst.ClockTimeDiff(time.Minute.NanoSeconds()))
|
||||
fmt.Println("I returned")
|
||||
}()
|
||||
|
||||
pipeline.SetState(gst.StatePlaying)
|
||||
fmt.Println("I am waiting")
|
||||
gst.Wait(pipeline)
|
||||
}
|
15
hack/sleep.go
Normal file
15
hack/sleep.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
// #include <unistd.h>
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
go func() {
|
||||
C.sleep(1000000000)
|
||||
fmt.Println("I slept")
|
||||
}()
|
||||
fmt.Println("Hello world")
|
||||
}
|
Reference in New Issue
Block a user