add custom transform example and remove calls to deprecated methods

This commit is contained in:
RSWilli
2024-12-09 10:53:09 +01:00
parent b9dce0b926
commit 96b7315e7a
10 changed files with 690 additions and 319 deletions

View File

@@ -0,0 +1,46 @@
package main
import (
"context"
"fmt"
"os"
"os/signal"
"github.com/go-gst/go-gst/examples/plugins/basetransform/internal/customtransform"
"github.com/go-gst/go-gst/gst"
)
func run(ctx context.Context) error {
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt)
defer cancel()
gst.Init(nil)
customtransform.Register()
pipeline, err := gst.NewPipelineFromString("audiotestsrc ! gocustomtransform ! fakesink")
if err != nil {
return err
}
pipeline.SetState(gst.StatePlaying)
<-ctx.Done()
pipeline.BlockSetState(gst.StateNull)
gst.Deinit()
return ctx.Err()
}
func main() {
ctx := context.Background()
err := run(ctx)
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
}