func NewFactory(name string) (*C.GstElementFactory, error) { factory := C.gst_element_factory_find(toGStr(name)) if factory == nil { return nil, errors.New(fmt.Sprintf("failed to find factory %s", name)) } return factory, nil }
// ElementFactoryFind() is a wrapper around gst_element_factory_find(). func ElementFactoryFind(name string) (*ElementFactory, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) c := C.gst_element_factory_find((*C.gchar)(cname)) if c == nil { return nil, nilPtrErr } obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} b := wrapElementFactory(obj) b.RefSink() runtime.SetFinalizer(&b.Object, (*Object).Unref) return b, nil }