Files
go-gst/examples/plugins/registered_elements/internal/custombin/element.go
RSWilli 846581a077 port more examples over to new generated bindings
plugins not yet working, examples mostly untested
2025-09-16 22:36:07 +02:00

43 lines
965 B
Go

package custombin
import (
"time"
"github.com/go-gst/go-gst/pkg/gst"
)
type customBin struct {
gst.Bin // parent object must be first embedded field
source1 gst.Elementer
source2 gst.Elementer
mixer gst.Elementer
}
// init should initialize the element. Keep in mind that the properties are not yet present. When this is called.
func (bin *customBin) init() {
bin.source1 = gst.ElementFactoryMakeWithProperties("gocustomsrc", map[string]interface{}{
"duration": int64(5 * time.Second),
})
bin.source2 = gst.ElementFactoryMakeWithProperties("gocustomsrc", map[string]interface{}{
"duration": int64(10 * time.Second),
})
bin.mixer = gst.ElementFactoryMake("audiomixer", "")
bin.AddMany(
bin.source1,
bin.source2,
bin.mixer,
)
srcpad := bin.mixer.StaticPad("src")
ghostpad := gst.NewGhostPadFromTemplate("src", srcpad, bin.PadTemplate("src"))
bin.source1.Link(bin.mixer)
bin.source2.Link(bin.mixer)
bin.AddPad(&ghostpad.Pad)
}