By linking a source element with zero or more filter-like elements and finally a sink element, you set up a media pipeline. Data will flow through the elements. This is the basic concept of media handling in GStreamer.
By linking these three elements, we have created a very simple chain of elements. The effect of this will be that the output of the source element ("element1") will be used as input for the filter-like element ("element2"). The filter-like element will do something with the data and send the result to the final sink element ("element3").
Imagine the above graph as a simple Ogg/Vorbis audio decoder. The source is a disk source which reads the file from disc. The second element is a Ogg/Vorbis audio decoder. The sink element is your soundcard, playing back the decoded audio data. We will use this simple graph to construct an Ogg/Vorbis player later in this manual.
In code, the above graph is written like this:
#include <gst/gst.h>
int
main (int argc,
char *argv[])
{
GstElement *source, *filter, *sink;
/* init */
gst_init (&argc, &argv);
/* create elements */
source = gst_element_factory_make ("fakesrc", "source");
filter = gst_element_factory_make ("identity", "filter");
sink = gst_element_factory_make ("fakesink", "sink");
/* link */
gst_element_link_many (source, filter, sink, NULL);
[..]
}
For more specific behaviour, there are also the functions
gst_element_link () and
gst_element_link_pads (). You can also obtain
references to individual pads and link those using various
gst_pad_link_* () functions. See the API
references for more details.