port more examples over to new generated bindings

plugins not yet working, examples mostly untested
This commit is contained in:
RSWilli
2025-09-16 22:36:07 +02:00
parent 9fb9393213
commit 846581a077
37 changed files with 364 additions and 3196 deletions

View File

@@ -1,22 +1,45 @@
package custombin
import (
"github.com/go-gst/go-gst/gst"
"github.com/diamondburned/gotk4/pkg/core/glib"
"github.com/go-gst/go-gst/pkg/gst"
)
// Register needs to be called after gst.Init() to make the gocustombin available in the standard
// gst element registry. After this call the element can be used like any other gstreamer element
func Register() bool {
return gst.RegisterElement(
registered := glib.RegisterSubclassWithConstructor[*customBin](
func() *customBin {
return &customBin{}
},
glib.WithOverrides[*customBin, gst.BinOverrides](func(b *customBin) gst.BinOverrides {
return gst.BinOverrides{}
}),
glib.WithClassInit[*gst.BinClass](func(bc *gst.BinClass) {
bc.ParentClass().SetStaticMetadata(
"custom test source",
"Src/Test",
"Demo source bin with volume",
"Wilhelm Bartel <bartel.wilhelm@gmail.com>",
)
bc.ParentClass().AddPadTemplate(gst.NewPadTemplate(
"src",
gst.PadSrc,
gst.PadAlways,
gst.CapsFromString("audio/x-raw,channels=2,rate=48000"),
))
}),
)
return gst.ElementRegister(
// no plugin:
nil,
// The name of the element
"gocustombin",
// The rank of the element
gst.RankNone,
uint(gst.RankNone),
// The GoElement implementation for the element
&customBin{},
// The base subclass this element extends
gst.ExtendsBin,
registered.Type(),
)
}