Gst.Object

const Gst = imports.gi.Gst;

let object = new Gst.Object({
    name: value,
    parent: value,
});
  

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

Gst.Object gives us basic refcounting, parenting functionality and locking. Most of the function are just extended for special GStreamer needs and can be found under the same name in the base class of Gst.Object which is GObject.Object (e.g. GObject.ref becomes Gst.ref).

Since Gst.Object dereives from GObject.InitiallyUnowned, it also inherits the floating reference. Be aware that functions such as Gst.Bin.prototype.add and Gst.Element.prototype.add_pad take ownership of the floating reference.

In contrast to GObject.Object instances, Gst.Object adds a name property. The functions Gst.set_name and Gst.get_name are used to set/get the name of the object.

<refsect2> <title>controlled properties</title> <para> 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 values changes for the current stream-time.

What needs to be changed in a Gst.Element? Very little - it is just two steps to make a plugin controllable! <orderedlist> <listitem><para> mark gobject-properties paramspecs that make sense to be controlled, by GST_PARAM_CONTROLLABLE. </para></listitem> <listitem><para> when processing data (get, chain, loop function) at the beginning call gst_object_sync_values(element,timestamp). This will made the controller to update all gobject properties that are under control with the current values based on timestamp. </para></listitem> </orderedlist>

What needs to be done in applications? Again it's not a lot to change. <orderedlist> <listitem><para> create a Gst.ControlSource. csource = gst_interpolation_control_source_new (); g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL); </para></listitem> <listitem><para> Attach the Gst.ControlSource on the controller to a property. gst_object_add_control_binding (object, gst_direct_control_binding_new (object, "prop1", csource)); </para></listitem> <listitem><para> 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); </para></listitem> <listitem><para> start your pipeline </para></listitem> </orderedlist> </para> </refsect2>

Last reviewed on 2012-03-29 (0.11.3)

Hierarchy

  • GObject.Object
    • GObject.InitiallyUnowned
      • Gst.Object