mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-04 23:52:55 +08:00
port more examples over to new generated bindings
plugins not yet working, examples mostly untested
This commit is contained in:
@@ -5,32 +5,33 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"time"
|
||||
|
||||
"github.com/go-gst/go-gst/examples/plugins/basetransform/internal/customtransform"
|
||||
"github.com/go-gst/go-gst/gst"
|
||||
"github.com/go-gst/go-gst/pkg/gst"
|
||||
)
|
||||
|
||||
func run(ctx context.Context) error {
|
||||
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt)
|
||||
defer cancel()
|
||||
|
||||
gst.Init(nil)
|
||||
gst.Init()
|
||||
|
||||
customtransform.Register()
|
||||
|
||||
pipeline, err := gst.NewPipelineFromString("audiotestsrc ! gocustomtransform ! fakesink")
|
||||
ret, err := gst.ParseLaunch("audiotestsrc ! gocustomtransform ! fakesink")
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pipeline := ret.(*gst.Pipeline)
|
||||
|
||||
pipeline.SetState(gst.StatePlaying)
|
||||
|
||||
<-ctx.Done()
|
||||
|
||||
pipeline.BlockSetState(gst.StateNull)
|
||||
|
||||
gst.Deinit()
|
||||
pipeline.BlockSetState(gst.StateNull, gst.ClockTime(time.Second))
|
||||
|
||||
return ctx.Err()
|
||||
}
|
||||
|
Reference in New Issue
Block a user