The first thing to do when making a new element is to specify some basic details about it: what its name is, who wrote it, what version number it is, etc. We also need to define an object to represent the element and to store the data the element needs. These details are collectively known as the boilerplate.
The standard way of defining the boilerplate is simply to write some code,
and fill in some structures. As mentioned in the previous section, the
easiest way to do this is to copy a template and add functionality
according to your needs. To help you do so, there is a tool in the
make_element, is a command line utility
that creates the boilerplate code for you.
To use make_element, first open up a terminal window.
Change to the
directory, and then run the make_element command. The
arguments to the make_element are:
the name of the plugin, and
the source file that the tool will use. By default,
gstplugin is used.
For example, the following commands create the MyFilter plugin based on
the plugin template and put the output files in the
Capitalization is important for the name of the plugin. Keep in mind that under some operating systems, capitalization is also important when specifying directory and file names in general.
The last command creates two files:
It is recommended that you create a copy of the
directory before continuing.
Now one needs to adjust the
Makefile.am to use the
new filenames and run
autogen.sh from the parent
directory to bootstrap the build environment. After that, the project
can be built and installed using the well known
make && sudo make install commands.
Be aware that by default
configure would choose
as a default location. One would need to add
to GST_PLUGIN_PATH in order to make the new plugin
show up in a gstreamer that's been installed from packages.
FIXME: this section is slightly outdated. gst-template is still useful as an example for a minimal plugin build system skeleton. However, for creating elements the tool gst-element-maker from gst-plugins-bad is recommended these days.