Search code examples
cgstreamergstreamer-1.0

Is there any complete example on how to use the GStreamer GstBaseTransform in C?


GstBaseTransform is the class intended for the simple image processing and analysis in GStreamer. Being new to GStreamer, I am looking for some more or less complete plugin that I could use for understanding how to implement mine. Unfortunately, the Plugin Writers Guide does not cover it, and in general I cannot find a complete source code of any simple enough example that uses it. Most of the websites I Google out simply repeat the documentation, some specialized code for Freescale in GitHub and also GLES project are the closest thing I was so far able to find. It is, however, a specialized production code with lots of stuff to remove before trying to understand the rest.

Is it possible to get a complete example/source code of the plugin that uses GstBaseTransform for something very simple, like drawing line over the image?

GStreamer pipeline can be easily launched from the command line like "gst-launch-1.0 videotestsrc ! the_plugin ! videoconvert ! autovideosink".


Solution

  • I recommend a combination of documentation and the element builder. The element builder gives you a template for plugins based on several bases classes including basetransform. The tool can be found at tools/gst-element-maker in the gst-plugins-bad repository.

    Then the documentation of the baseclass - e.g. https://gstreamer.freedesktop.org/documentation/base/gstbasetransform.html?gi-language=c

    Usually the documentation explains in general how the class is expected to work and does have some documentation on the most important/significant functions.

    For basetransform your most important function is going to be transform or transform_ip depending whether your plugin will work in in-place mode or not. There you can do your processing - like writing a line into an image buffer.