mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 12:10:37 +00:00
b0346dff44
Original commit message from CVS: * docs/pwg/advanced-dparams.xml: * docs/pwg/building-props.xml: * docs/pwg/other-source.xml: * gst/glib-compat.h: * gst/gstbin.c: (gst_bin_class_init): * gst/gstclock.c: (gst_clock_class_init): * gst/gstindex.c: (gst_index_class_init): * gst/gstobject.c: (gst_object_class_init): * gst/gstpad.c: (gst_pad_class_init): * gst/gstpipeline.c: (gst_pipeline_class_init): * libs/gst/base/gstbasesink.c: (gst_base_sink_class_init): * libs/gst/base/gstbasesrc.c: (gst_base_src_class_init): * libs/gst/base/gstbasetransform.c: (gst_base_transform_class_init): * libs/gst/base/gstdataqueue.c: (gst_data_queue_class_init): * libs/gst/check/gstcheck.c: (_gst_check_fault_handler_restore), (_gst_check_fault_handler_sighandler), (_gst_check_fault_handler_setup), (gst_check_init): * libs/gst/controller/gstcontroller.c: (_gst_controller_class_init): * libs/gst/controller/gstlfocontrolsource.c: (gst_lfo_control_source_class_init): * libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_class_init): * libs/gst/net/gstnettimeprovider.c: (gst_net_time_provider_class_init): * plugins/elements/gstcapsfilter.c: (gst_capsfilter_class_init): * plugins/elements/gstfakesink.c: (gst_fake_sink_class_init): * plugins/elements/gstfakesrc.c: (gst_fake_src_class_init): * plugins/elements/gstfdsink.c: (gst_fd_sink_class_init): * plugins/elements/gstfdsrc.c: (gst_fd_src_class_init): * plugins/elements/gstfilesink.c: (gst_file_sink_class_init): * plugins/elements/gstfilesrc.c: (gst_file_src_class_init): * plugins/elements/gstidentity.c: (gst_identity_class_init): * plugins/elements/gstmultiqueue.c: (gst_multi_queue_class_init): * plugins/elements/gstqueue.c: (gst_queue_class_init): * plugins/elements/gsttee.c: (gst_tee_class_init): * plugins/elements/gsttypefindelement.c: (gst_type_find_element_class_init): * plugins/indexers/gstfileindex.c: (gst_file_index_class_init): Define G_PARAM_STATIC_STRINGS if it's undefined (GLib < 2.13.0) and use it everywhere for GParamSpecs that use static strings (i.e. all). This gives us less memory usage, fewer allocations and thus less memory defragmentation. Fixes bug #523806.
105 lines
3.7 KiB
XML
105 lines
3.7 KiB
XML
|
|
<!-- ############ chapter ############# -->
|
|
|
|
<chapter id="chapter-dparams">
|
|
<title>Supporting Dynamic Parameters</title>
|
|
<para>
|
|
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.
|
|
</para>
|
|
|
|
<sect1 id="section-dparam-start">
|
|
<title>Getting Started</title>
|
|
|
|
<para>
|
|
The controller subsystem is contained within the
|
|
<filename>gstcontroller</filename> library. You need to include the header in
|
|
your element's source file:
|
|
</para>
|
|
<programlisting>
|
|
...
|
|
#include <gst/gst.h>
|
|
#include <gst/controller/gstcontroller.h>
|
|
...
|
|
</programlisting>
|
|
|
|
<para>
|
|
Even though the <filename>gstcontroller</filename> library may be linked into
|
|
the host application, you should make sure it is initialized in your
|
|
<filename>plugin_init</filename> function:
|
|
</para>
|
|
<programlisting>
|
|
static gboolean
|
|
plugin_init (GstPlugin *plugin)
|
|
{
|
|
...
|
|
/* initialize library */
|
|
gst_controller_init (NULL, NULL);
|
|
...
|
|
}
|
|
</programlisting>
|
|
<para>
|
|
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 <constant>GST_PARAM_CONTROLLABLE</constant>.
|
|
when setting up GObject params in the <function>_class_init</function> method.
|
|
</para>
|
|
<programlisting>
|
|
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 | G_PARAM_STATIC_STRINGS));
|
|
</programlisting>
|
|
|
|
</sect1>
|
|
|
|
<sect1 id="chapter-dparam-loop">
|
|
<title>The Data Processing Loop</title>
|
|
|
|
<para>
|
|
In the last section we learned how to mark GObject params as controllable.
|
|
Application developers can then queue parameter changes for these parameters.
|
|
The approach the controller subsystem takes is to make plugins responsible
|
|
for pulling the changes in. This requires just one action:
|
|
</para>
|
|
<programlisting>
|
|
gst_object_sync_values(element,timestamp);
|
|
</programlisting>
|
|
<para>
|
|
This call makes all parameter-changes for the given timestamp active by
|
|
adjusting the GObject properties of the element. Its up to the element to
|
|
determine the synchronisation rate.
|
|
</para>
|
|
|
|
<sect2 id="chapter-dparam-loop-video">
|
|
<title>The Data Processing Loop for Video Elements</title>
|
|
<para>
|
|
For video processing elements it is the best to synchonise for every frame.
|
|
That means one would add the <function>gst_object_sync_values()</function>
|
|
call described in the previous section to the data processing function of
|
|
the element.
|
|
</para>
|
|
</sect2>
|
|
|
|
<sect2 id="chapter-dparam-loop-audio">
|
|
<title>The Data Processing Loop for Audio Elements</title>
|
|
<para>
|
|
For audio processing elements the case is not as easy as for video
|
|
processing elements. The problem here is that audio has a much higher rate.
|
|
For PAL video one will e.g. process 25 full frames per second, but for
|
|
standard audio it will be 44100 samples.
|
|
It is rarely useful to synchronise controllable parameters that often.
|
|
The easiest solution is also to have just one synchronisation call per
|
|
buffer processing. This makes the control-rate dependend on the buffer
|
|
size.
|
|
</para>
|
|
<para>
|
|
Elements that need a specific control-rate need to break their data
|
|
processing loop to synchronise every n-samples.
|
|
</para>
|
|
</sect2>
|
|
</sect1>
|
|
</chapter>
|