GstObject

#GstObject provides a root for the object hierarchy tree filed in by the GStreamer library. It is currently a thin wrapper on top of #GInitiallyUnowned. It is an abstract class that is not very usable on its own.

#GstObject gives us basic refcounting, parenting functionality and locking. Most of the functions are just extended for special GStreamer needs and can be found under the same name in the base class of #GstObject which is #GObject (e.g. gobject.object.ObjectG.ref_ becomes gst.object.ObjectGst.ref_).

Since #GstObject derives from #GInitiallyUnowned, it also inherits the floating reference. Be aware that functions such as gst.bin.Bin.add and gst.element.Element.addPad take ownership of the floating reference.

In contrast to #GObject instances, #GstObject adds a name property. The functions gst.object.ObjectGst.setName and gst.object.ObjectGst.getName are used to set/get the name of the object.

controlled properties

Controlled properties offers a lightweight way to adjust gobject properties over stream-time. It works by using time-stamped value pairs that are queued for element-properties. At run-time the elements continuously pull value changes for the current stream-time.

What needs to be changed in a #GstElement? Very little - it is just two steps to make a plugin controllable!

  • mark gobject-properties paramspecs that make sense to be controlled, by GST_PARAM_CONTROLLABLE.
  • when processing data (get, chain, loop function) at the beginning call gst_object_sync_values(element,timestamp). This will make the controller update all GObject properties that are under its control with the current values based on the timestamp.

What needs to be done in applications? Again it's not a lot to change.

  • create a #GstControlSource. csource = gst_interpolation_control_source_new (); g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
  • Attach the #GstControlSource on the controller to a property. gst_object_add_control_binding (object, gst_direct_control_binding_new (object, "prop1", csource));
  • Set the control values gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,0 * GST_SECOND, value1); gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,1 * GST_SECOND, value2);
  • start your pipeline

Members

Variables

GstReserved
void* GstReserved;
controlBindings
GList* controlBindings;
controlRate
ulong controlRate;
flags
uint flags;

flags for this object

lastSync
ulong lastSync;
lock
GMutex lock;

object LOCK

name
char* name;

The name of the object

object
GInitiallyUnowned object;
parent
GstObject* parent;

this object's parent, weak ref