Create a control-source. Lets use an interpolation control-source:
csource = gst_interpolation_control_source_new (); g_object_set (csource, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
Now we need to assign the control-source to the gobject property. One control source can only be assigned to one property.
gst_object_add_control_binding (object, gst_direct_control_binding_new (object, "prop1", csource));
This control-source takes new property values from a list of time-stamped parameter changes. The source can e.g. fill gaps by smoothing parameter changes. This behaviour can be configured by setting the interpolation-mode.
Now we can set some control points. These are time-stamped GValues. The values become active when the timestamp is reached. They still stay in the list. If e.g. the pipeline runs a loop (using a segmented seek), the control-curve gets repeated as well. Other control-sources have different functions to specify the control-changes over time.
gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,0 * GST_SECOND, value1); gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,1 * GST_SECOND, value2);
Now everything is ready to play. One final note - the controller subsystem
has a builtin live-mode. Even though a property has a control-source
assigned one can change the GObject property through the
g_object_set()
.
This is highly useful when binding the GObject properties to GUI widgets.
When the user adjusts the value with the widget, one can set the GObject
property and this remains active until the next programmed control-source
value overrides it. This also works with smoothed parameters. It might not
work for control-sources that constantly update the property (e.g. the lfo
control-source).