Creating a New GStreamer Element or Application Using Templates
This wiki describes how to make use of the rather hidden tools included with GStreamer to create empty skeletons for different GStreamer elements.
Preparation for Creating a new GStreamer Element or GStreamer application using Templates
All the utilities described in this wiki are shipped with the `gst-plugins-bad` project, so start by cloning that project. The steps shown were tested on Ubuntu 16.04.
git clone https://github.com/GStreamer/gst-plugins-bad.git # If you are building for a specific version, switch to it now. Otherwise, you can remain in the 'master' git checkout $BRANCH # I recommend saving a copy of the indent script somewhere in your PATH cd gst-plugins-bad NOCONFIGURE=1 ./autogen.sh sudo cp common/gst-indent /usr/local/bin/
If you are going to be developing a new plug-in, then you most likely need installed GStreamer development libraries as well.
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-bad1.0-dev indent
Available tools
Create an empty Autotools project
The gst-project-maker tool creates a barebones autotools project to hold your new plug-in.
cd gst-plugins-bad/tools ./gst-project-maker my_project
Now, you should see a new directory called gst-my_project. You may move this directory to wherever you want and you should be able to build it:
cd gst-my_project ./autogen.sh make
There are a few additional options you may check by running:
./gst-project-maker --help
Create an empty GStreamer element
The gst-element-maker tool creates a barebones GStreamer element which may inherit from a variety of base classes. As per 1.15, the base classes for elements available are:
- audiodecoder
- audioencoder
- audiofilter
- audiosink
- audiosrc
- baseparse
- basesink
- basesrc
- basetransform
- element
- videodecoder
- videoencoder
- videofilter
- videosink
Additionally, you can create classes based on other GStreamer elements such as:
- sinkpad
- sinkpad-audio
- sinkpad-simple
- sinkpad-template
- sinkpad-template-video
- srcpad
- srcpad-audio
- srcpad-simple
- srcpad-template
- srcpad-template-video
By default, and very conveniently, the skeleton will include an empty implementation containing all of its parent virtual methods. This way you'll just need to delete the ones you're not planning on using.
To create a new element/object using the BASE_CLASS parameter (for example BASE_CLASS=videofilter), you may run the following:
cd gst-plugins-bad/tools # Choose any base class from the list above BASE_CLASS=videofilter ./gst-element-maker my_element $BASE_CLASS pkg is gstreamer-video-1.0 Plugin Details: Name myelement Description FIXME plugin description Filename ./gstmyelement.so Version 0.0.FIXME License LGPL Source module FIXME_package Binary package FIXME_package_name Origin URL http://FIXME.org/ myelement: FIXME Long name 1 features: +-- 1 elements
A new pair of gstmyelement.c and gstmyelement.h are created in the new element's directory. You may grab those files and integrate them into your project.
./gst-element-maker --help
Create an empty GStreamer Application
This tool creates a barebones GStreamer application.
cd gst-plugins-bad/tools ./gst-app-maker my_app
The gst-app-maker will create a new gstmyapp.c that you may take and integrate into your project.
RidgeRun Resources | |||||
Contact Us
|