mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-04 23:46:43 +00:00
3d34ce7b95
Original commit message from CVS: Updated the manual and the docs. Removed the esdsink in gst/elements/ we have a real one not in the plugins dir. Added more APIs to query the plugins, types and caps. more fields now have a getter and a setter. This is needed to make gstreamer wrapper fiendly. Added gst_element_disconnect beacuse we also have a gst_element_connect
61 lines
1.9 KiB
Text
61 lines
1.9 KiB
Text
<chapter id="cha-connections">
|
|
<title>Connecting elements</title>
|
|
<para>
|
|
You can connect the different pads of elements together so that the elements
|
|
form a chain.
|
|
</para>
|
|
|
|
<figure float="1" id="sec-connection">
|
|
<title>Visualisation of three connected elements</title>
|
|
<graphic fileref="images/connected-elements" format="png"></graphic>
|
|
</figure>
|
|
<para>
|
|
By connecting these three elements, we have created a very simple pipeline. The effect
|
|
of this will be that the output of the source element (element1) will be used as input
|
|
for the filter element (element2). The filter element will do something with the data and
|
|
send the result to the final sink element (element3).
|
|
</para>
|
|
<para>
|
|
Imagine the above graph as a simple mpeg audio decoder. The source element is a
|
|
disk source, the filter element is the mpeg decoder and the sink element is your
|
|
audiocard. We will use this simple graph to construct an mpeg player later
|
|
in this manual.
|
|
</para>
|
|
<para>
|
|
You can connect two pads with:
|
|
</para>
|
|
<programlisting>
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
srcpad = gst_element_get_pad (element1, "src");
|
|
sinpad = gst_element_get_pad (element2, "sink");
|
|
|
|
// connect them
|
|
gst_pad_connect (srcpad, sinkpad);
|
|
....
|
|
// and disconnect them
|
|
gst_pad_disconnect (srcpad, sinkpad);
|
|
|
|
</programlisting>
|
|
<para>
|
|
A convenient shortcut for the above code is done with the gst_element_connect ()
|
|
function:
|
|
</para>
|
|
<programlisting>
|
|
|
|
// connect them
|
|
gst_element_connect (element1, "src", element2, "sink");
|
|
....
|
|
// and disconnect them
|
|
gst_element_disconnect (element1, "src", element2, "sink");
|
|
|
|
</programlisting>
|
|
<para>
|
|
You can query if a pad is connected with GST_PAD_IS_CONNECTED (pad).
|
|
</para>
|
|
<para>
|
|
To query for the <classname>GstPad</classname> this srcpad is connected to, use
|
|
gst_pad_get_peer (srcpad).
|
|
</para>
|
|
|
|
</chapter>
|