From 8fc1b481c98aeaa20bc49ad39c4bb0406a50144c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 28 Dec 2024 22:18:00 +0100 Subject: [PATCH] get/set parent/name. --- gst/gst_object.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gst/gst_object.go b/gst/gst_object.go index bbf7aae..18baac6 100644 --- a/gst/gst_object.go +++ b/gst/gst_object.go @@ -40,6 +40,11 @@ func (o *Object) GetName() string { return C.GoString(cName) } +// GetParent retrieves the parent of this object. +func (o *Object) GetParent() *Object { + return wrapObject(glib.Take(unsafe.Pointer(C.gst_object_get_parent(o.Instance())))) +} + // GetValue retrieves the value for the given controlled property at the given timestamp. func (o *Object) GetValue(property string, timestamp ClockTime) *glib.Value { cprop := C.CString(property) @@ -51,6 +56,18 @@ func (o *Object) GetValue(property string, timestamp ClockTime) *glib.Value { return glib.ValueFromNative(unsafe.Pointer(gval)) } +// SetName sets the name of this object. +func (o *Object) SetName(name string) bool { + cName := C.CString(name) + defer C.free(unsafe.Pointer(cName)) + return gobool(C.gst_object_set_name((*C.GstObject)(o.Instance()), (*C.gchar)(cName))) +} + +// SetParent sets the parent of this object. +func (o *Object) SetParent(parent *Object) bool { + return gobool(C.gst_object_set_parent(o.Instance(), parent.Instance())) +} + // SetArg sets the argument name to value on this object. Note that function silently returns // if object has no property named name or when value cannot be converted to the type for this // property.