Once you have created your elements you can create and attach dparams to them. First you need to get the element's dparams manager. If you know exactly what kind of element you have, you may be able to get the dparams manager directly. However if this is not possible, you can get the dparams manager by calling gst_dpman_get_manager.
Once you have the dparams manager, you must set the mode that the manager will run in. There is currently only one mode implemented called "synchronous" - this is used for real-time applications where the dparam value cannot be known ahead of time (such as a slider in a GUI). The mode is called "synchronous" because the dparams are polled by the element for changes before each buffer is processed. Another yet-to-be-implemented mode is "asynchronous". This is used when parameter changes are known ahead of time - such as with a timelined editor. The mode is called "asynchronous" because parameter changes may happen in the middle of a buffer being processed.
GstElement *sinesrc; GstDParamManager *dpman; ... sinesrc = gst_element_factory_make("sinesrc","sine-source"); ... dpman = gst_dpman_get_manager (sinesrc); gst_dpman_set_mode(dpman, "synchronous");
If you don't know the names of the required dparams for your element you can call gst_dpman_list_dparam_specs(dpman) to get a NULL terminated array of param specs. This array should be freed after use. You can find the name of the required dparam by calling g_param_spec_get_name on each param spec in the array. In our example, "volume" will be the name of our required dparam.
Each type of dparam currently has its own new function. This may eventually be replaced by a factory method for creating new instances. A default dparam instance can be created with the gst_dparam_new function. Once it is created it can be attached to a required dparam in the element.
GstDParam *volume; ... volume = gst_dparam_new(G_TYPE_FLOAT); if (gst_dpman_attach_dparam (dpman, "volume", volume)){ /* the dparam was successfully attached */ ... }