From bea1b98ef135f9a6bc481d0e0703107bf64ad00e Mon Sep 17 00:00:00 2001 From: RSWilli Date: Wed, 25 Oct 2023 14:18:36 +0200 Subject: [PATCH] allow plugin to be nil for gst_element_register --- gst/gst_element.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gst/gst_element.go b/gst/gst_element.go index 7e232c0..3f9b219 100644 --- a/gst/gst_element.go +++ b/gst/gst_element.go @@ -103,9 +103,17 @@ func ElementUnlinkMany(elems ...*Element) { // RegisterElement creates a new elementfactory capable of instantiating objects of the given GoElement // and adds the factory to the plugin. A higher rank means more importance when autoplugging. +// +// plugin can also be nil to register a static element func RegisterElement(plugin *Plugin, name string, rank Rank, elem glib.GoObjectSubclass, extends glib.Extendable, interfaces ...glib.Interface) bool { + var pluginref *C.GstPlugin + + if plugin != nil { + pluginref = plugin.Instance() + } + return gobool(C.gst_element_register( - plugin.Instance(), + pluginref, C.CString(name), C.guint(rank), C.GType(glib.RegisterGoType(name, elem, extends, interfaces...)),