Chapter 5. GstElement

Table of Contents

What is a GstElement
Source elements
Filters and codecs
Sink elements
Creating a GstElement
GstElement properties
GstElement signals
More about GstElementFactory
Getting information about an element using the factory details
Finding out what pads an element can contain
Different ways of querying the factories

The most important object in GStreamer for the application programmer is the GstElement object.

What is a GstElement

GstElement is the basic building block for the media pipeline. All the different components you are going to use are derived from GstElement. This means that a lot of functions you are going to use operate on objects of this class.

Elements, from the perspective of GStreamer, are viewed as "black boxes" with a number of different aspects. One of these aspects is the presence of "pads", or link points. This terminology arises from soldering; pads are where wires can be attached.

Source elements

Source elements generate data for use by a pipeline, for example reading from disk or from a sound card.

Below you see how we will visualize the element. We always draw a source pad to the right of the element.

Figure 5.1. Visualisation of a source element

Visualisation of a source element

Source elements do not accept data, they only generate data. You can see this in the figure because it only has a source pad. A source pad can only generate data.

Filters and codecs

Filter elements both have input and output pads. They operate on data they receive in their sink pads and produce data on their source pads. For example, MPEG decoders and volume filters would fall into this category.

Elements are not constrained as to the number of pads they might have; for example, a video mixer might have two input pads (the images of the two different video streams) and one output pad.

Figure 5.2. Visualisation of a filter element

Visualisation of a filter element

The above figure shows the visualisation of a filter element. This element has one sink (input) pad and one source (output) pad. Sink pads are drawn on the left of the element.

Figure 5.3. Visualisation of a filter element with more than one output pad

Visualisation of a filter element with more than one output pad

The above figure shows the visualisation of a filter element with more than one output pad. An example of such a filter is the AVI splitter (demultiplexer). This element will parse the input data and extract the audio and video data. Most of these filters dynamically send out a signal when a new pad is created so that the application programmer can link an arbitrary element to the newly created pad.

Sink elements

Sink elements are terminal points in a media pipeline. They accept data but do not produce anything. Disk writing, soundcard playback, and video output would all be implemented by sink elements.

Figure 5.4. Visualisation of a sink element

Visualisation of a sink element