Chapter 15. Supporting Dynamic Parameters

Sometimes object properties are not powerful enough to control the parameters that affect the behaviour of your element. When this is the case you can mark these parameters as beeing Controllable. Aware appliations can use the controller subsystem to dynamically adjust the property values over time.

15.1. Getting Started

The controller subsystem is contained within the gstcontroller library. You need to include the header in your element's source file:


...
#include <gst/gst.h>
#include <gst/controller/gstcontroller.h>
...
  

Even though the gstcontroller library may be linked into the host application, you should make sure it is initialized in your plugin_init function:


  static gboolean
  plugin_init (GstPlugin *plugin)
  {
    ...
    /* initialize library */
    gst_controller_init (NULL, NULL);
    ...
  }
  

It makes not sense for all GObject parameter to be real-time controlled. Therefore the next step is to mark controllable parameters. This is done by using the special flag GST_PARAM_CONTROLLABLE. when setting up GObject params in the _class_init method.


  g_object_class_install_property (gobject_class, PROP_FREQ,
      g_param_spec_double ("freq", "Frequency", "Frequency of test signal",
          0.0, 20000.0, 440.0,
          G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));