mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-12 03:10:13 +08:00
more subclassing code, start to migrate example
This commit is contained in:
@@ -1,41 +1,45 @@
|
||||
package custombin
|
||||
|
||||
import (
|
||||
"github.com/diamondburned/gotk4/pkg/gobject/v2"
|
||||
"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 {
|
||||
panic("Register is not implemented yet")
|
||||
// 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>",
|
||||
// )
|
||||
registered := gst.RegisterBinSubClass[*customBin](
|
||||
"gocustombin",
|
||||
func(class *gst.BinClass) {
|
||||
class.ParentClass().SetStaticMetadata(
|
||||
"custom test source",
|
||||
"Src/Test",
|
||||
"Demo source bin with volume",
|
||||
"Wilhelm Bartel <bartel.wilhelm@gmail.com>",
|
||||
)
|
||||
},
|
||||
nil,
|
||||
gst.BinOverrides[*customBin]{
|
||||
ElementOverrides: gst.ElementOverrides[*customBin]{
|
||||
ObjectOverrides: gst.ObjectOverrides[*customBin]{
|
||||
InitiallyUnownedOverrides: gobject.InitiallyUnownedOverrides[*customBin]{
|
||||
ObjectOverrides: gobject.ObjectOverrides[*customBin]{
|
||||
Constructed: (*customBin).constructed,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
map[string]gobject.SignalDefinition{},
|
||||
)
|
||||
|
||||
// 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
|
||||
// uint(gst.RankNone),
|
||||
// // The GoElement implementation for the element
|
||||
// registered.Type(),
|
||||
// )
|
||||
return gst.ElementRegister(
|
||||
// no plugin:
|
||||
nil,
|
||||
// The name of the element
|
||||
"gocustombin",
|
||||
// The rank of the element
|
||||
uint(gst.RankNone),
|
||||
registered,
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user