first pass of connect->link gst-plugins and other stuff compiles without change at this point

Original commit message from CVS:
first pass of connect->link
gst-plugins and other stuff compiles without change at this point
parent 7b087348
2003-01-09 Thomas Vander Stichele <thomas at apestaart dot org>
* first pass at changing _connect/_disconnect -> _link/_unlink
* gst/gstcompat.h: created
2002-11-27 Thomas Vander Stichele <thomas at apestaart dot org>
* ChangeLog: added an entry
......
......@@ -136,7 +136,7 @@ main (int argc, char *argv[])
/* add objects to the thread */
gst_bin_add_many (GST_BIN (thread), filesrc, decoder, audiosink, NULL);
/* connect them in the logical order */
gst_element_connect_many (filesrc, decoder, audiosink, NULL);
gst_element_link_many (filesrc, decoder, audiosink, NULL);
/* start playing */
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
......
......@@ -5,7 +5,7 @@
an <classname>GstElement</classname> itself, it can also be added to another bin.
</para>
<para>
Bins allow you to combine connected elements into one logical element. You do
Bins allow you to combine linked elements into one logical element. You do
not deal with the individual elements anymore but with just one element, the bin.
We will see that this is extremely powerful when you are going to construct
complex pipelines since it allows you to break up the pipeline in smaller chunks.
......@@ -231,7 +231,7 @@
of the given element.
</para>
<para>
We can now, for example, connect the source pad of a filesrc element
We can now, for example, link the source pad of a filesrc element
to the bin with:
</para>
<programlisting>
......@@ -239,7 +239,7 @@
filesrc = gst_element_factory_create ("filesrc", "disk_reader");
gst_element_connect_pads (filesrc, "src", bin, "sink");
gst_element_link_pads (filesrc, "src", bin, "sink");
...
</programlisting>
</sect1>
......
......@@ -47,8 +47,8 @@ main (int argc, char *argv[])
/* add objects to the main pipeline */
gst_bin_add_many (GST_BIN (pipeline), filesrc, decoder, audiosink, NULL);
/* connect src to sink */
gst_element_connect_many (filesrc, decoder, audiosink, NULL);
/* link src to sink */
gst_element_link_many (filesrc, decoder, audiosink, NULL);
/* start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
......@@ -166,11 +166,11 @@ main (int argc, char *argv[])
</programlisting>
<para>
We connect the different pads of the elements together like this:
We link the different pads of the elements together like this:
</para>
<programlisting>
/* connect src to sink */
gst_element_connect_many (filesrc, decoder, audiosink, NULL);
/* link src to sink */
gst_element_link_many (filesrc, decoder, audiosink, NULL);
</programlisting>
<para>
......
......@@ -2,7 +2,7 @@
<title>GstPad</title>
<para>
As we have seen in the previous chapter (GstElement), the pads are the element's
connections with the outside world.
links with the outside world.
</para>
<para>
The specific type of media that the element can handle will be exposed by the pads.
......@@ -81,7 +81,7 @@
</para>
<programlisting>
static void
pad_connect_func (GstElement *parser, GstPad *pad, GstElement *pipeline)
pad_link_func (GstElement *parser, GstPad *pad, GstElement *pipeline)
{
g_print("***** a new pad %s was created\n", gst_pad_get_name(pad));
......@@ -90,7 +90,7 @@ pad_connect_func (GstElement *parser, GstPad *pad, GstElement *pipeline)
if (strncmp (gst_pad_get_name (pad), "private_stream_1.0", 18) == 0) {
// set up an AC3 decoder pipeline
...
// connect pad to the AC3 decoder pipeline
// link pad to the AC3 decoder pipeline
...
}
gst_element_set_state (GST_ELEMENT (audio_thread), GST_STATE_READY);
......@@ -106,7 +106,7 @@ main(int argc, char *argv[])
...
mpeg2parser = gst_element_factory_make ("mpegdemux", "mpegdemux");
g_signal_connect (G_OBJECT (mpeg2parser), "new_pad", pad_connect_func, pipeline);
g_signal_connect (G_OBJECT (mpeg2parser), "new_pad", pad_link_func, pipeline);
...
// start the pipeline
......@@ -134,7 +134,7 @@ main(int argc, char *argv[])
</para>
<para>
The following piece of code can be used to get a pad from the tee element. After
the pad has been requested, it can be used to connect another element to it.
the pad has been requested, it can be used to link another element to it.
</para>
<programlisting>
...
......@@ -152,7 +152,7 @@ main(int argc, char *argv[])
</para>
<para>
It is also possible to request a pad that is compatible with another
pad template. This is very useful if you want to connect an element
pad template. This is very useful if you want to link an element
to a multiplexer element and you need to request a pad that is
compatible. The gst_element_get_compatible_pad is used to request
a compatible pad, as is shown in the next example.
......@@ -313,7 +313,7 @@ Pads:
</listitem>
<listitem>
<para>
Compatibility detection: when two pads are connected, <application>GStreamer</application>
Compatibility detection: when two pads are linked, <application>GStreamer</application>
can verify if the two pads are talking about the same media types.
</para>
</listitem>
......
......@@ -5,7 +5,7 @@
an <classname>GstElement</classname> itself, it can also be added to another bin.
</para>
<para>
Bins allow you to combine connected elements into one logical element. You do
Bins allow you to combine linked elements into one logical element. You do
not deal with the individual elements anymore but with just one element, the bin.
We will see that this is extremely powerful when you are going to construct
complex pipelines since it allows you to break up the pipeline in smaller chunks.
......@@ -231,7 +231,7 @@
of the given element.
</para>
<para>
We can now, for example, connect the source pad of a filesrc element
We can now, for example, link the source pad of a filesrc element
to the bin with:
</para>
<programlisting>
......@@ -239,7 +239,7 @@
filesrc = gst_element_factory_create ("filesrc", "disk_reader");
gst_element_connect_pads (filesrc, "src", bin, "sink");
gst_element_link_pads (filesrc, "src", bin, "sink");
...
</programlisting>
</sect1>
......
<chapter id="cha-connections">
<chapter id="cha-links">
<title>Connecting elements</title>
<para>
You can connect the different pads of elements together so that the elements
You can link 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>
<figure float="1" id="sec-link">
<title>Visualisation of three linked elements</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/connected-elements.&magic;" format="&MAGIC;" />
<imagedata fileref="images/linked-elements.&magic;" format="&MAGIC;" />
</imageobject>
</mediaobject>
</figure>
<para>
By connecting these three elements, we have created a very simple
By linking these three elements, we have created a very simple
chain. 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
......@@ -28,9 +28,9 @@
</para>
<sect1 id="sec-conn-basic">
<title>Making simple connections</title>
<title>Making simple links</title>
<para>
You can connect two pads with:
You can link two pads with:
</para>
<programlisting>
GstPad *srcpad, *sinkpad;
......@@ -38,66 +38,66 @@
srcpad = gst_element_get_pad (element1, "src");
sinpad = gst_element_get_pad (element2, "sink");
// connect them
gst_pad_connect (srcpad, sinkpad);
// link them
gst_pad_link (srcpad, sinkpad);
....
// and disconnect them
gst_pad_disconnect (srcpad, sinkpad);
// and unlink them
gst_pad_unlink (srcpad, sinkpad);
</programlisting>
<para>
A convenient shortcut for the above code is done with the gst_element_connect_pads ()
A convenient shortcut for the above code is done with the gst_element_link_pads ()
function:
</para>
<programlisting>
// connect them
gst_element_connect_pads (element1, "src", element2, "sink");
// link them
gst_element_link_pads (element1, "src", element2, "sink");
....
// and disconnect them
gst_element_disconnect_pads (element1, "src", element2, "sink");
// and unlink them
gst_element_unlink_pads (element1, "src", element2, "sink");
</programlisting>
<para>
An even more convenient shortcut for single-source, single-sink elements is the
gst_element_connect () function:
gst_element_link () function:
</para>
<programlisting>
// connect them
gst_element_connect (element1, element2);
// link them
gst_element_link (element1, element2);
....
// and disconnect them
gst_element_disconnect (element1, element2);
// and unlink them
gst_element_unlink (element1, element2);
</programlisting>
<para>
If you have more than one element to connection, the gst_element_connect_many () function takes
If you have more than one element to link, the gst_element_link_many () function takes
a NULL-terminated list of elements:
</para>
<programlisting>
// connect them
gst_element_connect_many (element1, element2, element3, element4, NULL);
// link them
gst_element_link_many (element1, element2, element3, element4, NULL);
....
// and disconnect them
gst_element_disconnect_many (element1, element2, element3, element4, NULL);
// and unlink them
gst_element_unlink_many (element1, element2, element3, element4, NULL);
</programlisting>
<para>
You can query if a pad is connected with GST_PAD_IS_CONNECTED (pad).
You can query if a pad is linked with GST_PAD_IS_CONNECTED (pad).
</para>
<para>
To query for the <classname>GstPad</classname> a pad is connected to, use
To query for the <classname>GstPad</classname> a pad is linked to, use
gst_pad_get_peer (pad).
</para>
</sect1>
<sect1 id="sec-conn-filtered">
<title>Making filtered connections</title>
<title>Making filtered links</title>
<para>
You can also force a specific media type on the connection by using gst_pad_connect_filtered ()
and gst_element_connect_filtered (). FIXME link to caps documentation.
You can also force a specific media type on the link by using gst_pad_link_filtered ()
and gst_element_link_filtered (). FIXME link to caps documentation.
</para>
</sect1>
......
......@@ -49,7 +49,7 @@ new_pad_created (GstElement *parse, GstPad *pad, GstElement *pipeline)
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
/* connect to audio pad */
/* link to audio pad */
if (strncmp (gst_pad_get_name (pad), "audio_", 6) == 0) {
/* construct internal pipeline elements */
......@@ -62,23 +62,23 @@ new_pad_created (GstElement *parse, GstPad *pad, GstElement *pipeline)
audio_thread = gst_thread_new ("audio_thread");
g_return_if_fail (audio_thread != NULL);
/* construct queue and connect everything in the main pipeline */
/* construct queue and link everything in the main pipeline */
audio_queue = gst_element_factory_make ("queue", "audio_queue");
g_return_if_fail (audio_queue != NULL);
gst_bin_add_many (GST_BIN (audio_thread),
audio_queue, decode_audio, play, NULL);
/* set up pad connections */
/* set up pad links */
gst_element_add_ghost_pad (audio_thread,
gst_element_get_pad (audio_queue, "sink"),
"sink");
gst_element_connect (audio_queue, decode_audio);
gst_element_connect (decode_audio, play);
gst_element_link (audio_queue, decode_audio);
gst_element_link (decode_audio, play);
gst_bin_add (GST_BIN (pipeline), audio_thread);
gst_pad_connect (pad, gst_element_get_pad (audio_thread, "sink"));
gst_pad_link (pad, gst_element_get_pad (audio_thread, "sink"));
/* set up thread state and kick things off */
g_print ("setting to READY state\n");
......@@ -98,7 +98,7 @@ new_pad_created (GstElement *parse, GstPad *pad, GstElement *pipeline)
show = gst_element_factory_make ("xvideosink", "show");
g_return_if_fail (show != NULL);
/* construct queue and connect everything in the main pipeline */
/* construct queue and link everything in the main pipeline */
video_queue = gst_element_factory_make ("queue", "video_queue");
g_return_if_fail (video_queue != NULL);
......@@ -108,16 +108,16 @@ new_pad_created (GstElement *parse, GstPad *pad, GstElement *pipeline)
gst_bin_add_many (GST_BIN (video_thread), video_queue,
decode_video, color, show, NULL);
/* set up pad connections */
/* set up pad links */
gst_element_add_ghost_pad (video_thread,
gst_element_get_pad (video_queue, "sink"),
"sink");
gst_element_connect (video_queue, decode_video);
gst_element_connect_many (decode_video, color, show, NULL);
gst_element_link (video_queue, decode_video);
gst_element_link_many (decode_video, color, show, NULL);
gst_bin_add (GST_BIN (pipeline), video_thread);
gst_pad_connect (pad, gst_element_get_pad (video_thread, "sink"));
gst_pad_link (pad, gst_element_get_pad (video_thread, "sink"));
/* set up thread state and kick things off */
g_print ("setting to READY state\n");
......@@ -154,7 +154,7 @@ main (int argc, char *argv[])
g_signal_connect (G_OBJECT (src), "eos",
G_CALLBACK (eof), NULL);
gst_element_connect (src, demux);
gst_element_link (src, demux);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
......@@ -169,7 +169,7 @@ main (int argc, char *argv[])
<para>
We create two elements: a file source and an MPEG demuxer.
There's nothing special about this piece of code except for
the signal 'new_pad' that we connected to the mpegdemux
the signal 'new_pad' that we linked to the mpegdemux
element using:
</para>
<programlisting>
......
......@@ -47,8 +47,8 @@ main (int argc, char *argv[])
/* add objects to the main pipeline */
gst_bin_add_many (GST_BIN (pipeline), filesrc, decoder, audiosink, NULL);
/* connect src to sink */
gst_element_connect_many (filesrc, decoder, audiosink, NULL);
/* link src to sink */
gst_element_link_many (filesrc, decoder, audiosink, NULL);
/* start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
......@@ -166,11 +166,11 @@ main (int argc, char *argv[])
</programlisting>
<para>
We connect the different pads of the elements together like this:
We link the different pads of the elements together like this:
</para>
<programlisting>
/* connect src to sink */
gst_element_connect_many (filesrc, decoder, audiosink, NULL);
/* link src to sink */
gst_element_link_many (filesrc, decoder, audiosink, NULL);
</programlisting>
<para>
......
......@@ -44,8 +44,8 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin");
cache = gst_bin_get_by_name (GST_BIN (autobin), "cache");
/* disconnect the typefind from the pipeline and remove it */
gst_element_disconnect (cache, typefind);
/* unlink the typefind from the pipeline and remove it */
gst_element_unlink (cache, typefind);
gst_bin_remove (GST_BIN (autobin), typefind);
/* and an audio sink */
......@@ -68,7 +68,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
g_object_set (G_OBJECT (cache), "reset", TRUE, NULL);
gst_element_connect (cache, new_element);
gst_element_link (cache, new_element);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
......@@ -90,10 +90,10 @@ gst_play_cache_empty (GstElement *element, GstElement *pipeline)
cache = gst_bin_get_by_name (GST_BIN (autobin), "cache");
new_element = gst_bin_get_by_name (GST_BIN (autobin), "new_element");
gst_element_disconnect (filesrc, cache);
gst_element_disconnect (cache, new_element);
gst_element_unlink (filesrc, cache);
gst_element_unlink (cache, new_element);
gst_bin_remove (GST_BIN (autobin), cache);
gst_element_connect (filesrc, new_element);
gst_element_link (filesrc, new_element);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
......@@ -137,12 +137,12 @@ main (int argc, char *argv[])
gst_bin_add (GST_BIN (autobin), cache);
gst_bin_add (GST_BIN (autobin), typefind);
gst_element_connect (cache, typefind);
gst_element_link (cache, typefind);
gst_element_add_ghost_pad (autobin,
gst_element_get_pad (cache, "sink"), "sink");
gst_bin_add (GST_BIN( pipeline), autobin);
gst_element_connect (filesrc, autobin);
gst_element_link (filesrc, autobin);
/* start playing */
gst_element_set_state( GST_ELEMENT (pipeline), GST_STATE_PLAYING);
......@@ -187,15 +187,15 @@ main (int argc, char *argv[])
the pipeline:
</para>
<programlisting>
/* disconnect the typefind from the pipeline and remove it */
gst_element_disconnect (cache, "src", typefind, "sink");
/* unlink the typefind from the pipeline and remove it */
gst_element_unlink (cache, "src", typefind, "sink");
gst_bin_remove (GST_BIN (autobin), typefind);
</programlisting>
<para>
Our next step is to construct an element that can play the type we just
detected. We are going to use the autoplugger to create an element that
connects the type to an osssink. We add the new element to our
links the type to an osssink. We add the new element to our
autobin.
</para>
......@@ -230,7 +230,7 @@ main (int argc, char *argv[])
<programlisting>
g_object_set (G_OBJECT (cache), "reset", TRUE, NULL);
gst_element_connect (cache, "src", new_element, "sink");
gst_element_link (cache, "src", new_element, "sink");
</programlisting>
<para>
Finally we set the pipeline back to the playing state. At this point the
......@@ -240,7 +240,7 @@ main (int argc, char *argv[])
<para>
The cache empty function simply removes the autoplugcache element from
the pipeline and reconnects the filesrc to the autoplugged element.
the pipeline and relinks the filesrc to the autoplugged element.
</para>
<para>
......
......@@ -78,15 +78,15 @@ main (int argc, char *argv[])
gst_bin_add (GST_BIN (thread2), osssink);
gst_pad_connect (gst_element_get_pad (filesrc,"src"),
gst_pad_link (gst_element_get_pad (filesrc,"src"),
gst_element_get_pad (queue,"sink"));
gst_pad_connect (gst_element_get_pad (queue,"src"),
gst_pad_link (gst_element_get_pad (queue,"src"),
gst_element_get_pad (decode,"sink"));
gst_pad_connect (gst_element_get_pad (decode,"src"),
gst_pad_link (gst_element_get_pad (decode,"src"),
gst_element_get_pad (queue2,"sink"));
gst_pad_connect (gst_element_get_pad (queue2,"src"),
gst_pad_link (gst_element_get_pad (queue2,"src"),
gst_element_get_pad (osssink,"sink"));
gst_bin_add (GST_BIN (bin), thread);
......@@ -115,7 +115,7 @@ main (int argc, char *argv[])
</para>
<para>
The complete element hierarchy will be saved along with the inter element
pad connections and the element parameters. Future <application>GStreamer</application>
pad links and the element parameters. Future <application>GStreamer</application>
versions will also allow you to store the signals in the XML file.
</para>
</sect1>
......@@ -189,7 +189,7 @@ main(int argc, char *argv[])
interfere with the core XML tags.
</para>
<para>
To insert a hook into the element saving procedure you can connect
To insert a hook into the element saving procedure you can link
a signal to the GstElement using the following piece of code:
</para>
<programlisting>
......
......@@ -2,7 +2,7 @@
<title>GstPad</title>
<para>
As we have seen in the previous chapter (GstElement), the pads are the element's
connections with the outside world.
links with the outside world.
</para>
<para>
The specific type of media that the element can handle will be exposed by the pads.
......@@ -81,7 +81,7 @@
</para>
<programlisting>
static void
pad_connect_func (GstElement *parser, GstPad *pad, GstElement *pipeline)
pad_link_func (GstElement *parser, GstPad *pad, GstElement *pipeline)
{
g_print("***** a new pad %s was created\n", gst_pad_get_name(pad));
......@@ -90,7 +90,7 @@ pad_connect_func (GstElement *parser, GstPad *pad, GstElement *pipeline)
if (strncmp (gst_pad_get_name (pad), "private_stream_1.0", 18) == 0) {
// set up an AC3 decoder pipeline
...
// connect pad to the AC3 decoder pipeline
// link pad to the AC3 decoder pipeline
...
}
gst_element_set_state (GST_ELEMENT (audio_thread), GST_STATE_READY);
......@@ -106,7 +106,7 @@ main(int argc, char *argv[])
...
mpeg2parser = gst_element_factory_make ("mpegdemux", "mpegdemux");
g_signal_connect (G_OBJECT (mpeg2parser), "new_pad", pad_connect_func, pipeline);
g_signal_connect (G_OBJECT (mpeg2parser), "new_pad", pad_link_func, pipeline);
...
// start the pipeline
......@@ -134,7 +134,7 @@ main(int argc, char *argv[])
</para>
<para>
The following piece of code can be used to get a pad from the tee element. After
the pad has been requested, it can be used to connect another element to it.
the pad has been requested, it can be used to link another element to it.
</para>
<programlisting>
...
......@@ -152,7 +152,7 @@ main(int argc, char *argv[])
</para>
<para>
It is also possible to request a pad that is compatible with another
pad template. This is very useful if you want to connect an element
pad template. This is very useful if you want to link an element
to a multiplexer element and you need to request a pad that is
compatible. The gst_element_get_compatible_pad is used to request
a compatible pad, as is shown in the next example.
......@@ -313,7 +313,7 @@ Pads:
</listitem>
<listitem>
<para>
Compatibility detection: when two pads are connected, <application>GStreamer</application>
Compatibility detection: when two pads are linked, <application>GStreamer</application>
can verify if the two pads are talking about the same media types.
</para>
</listitem>
......
......@@ -2,17 +2,17 @@
<title>Queues</title>
<para>
A <classname>GstQueue</classname> is a filter element.
Queues can be used to connect two elements in such way that the data can
Queues can be used to link two elements in such way that the data can
be buffered.
</para>
<para>
A buffer that is sinked to a Queue will not automatically be pushed to the
next connected element but will be buffered. It will be pushed to the next
next linked element but will be buffered. It will be pushed to the next
element as soon as a gst_pad_pull () is called on the queue's source pad.
</para>
<para>
Queues are mostly used in conjunction with a <classname>GstThread</classname> to
provide an external connection for the thread elements. You could have one
provide an external link for the thread elements. You could have one
thread feeding buffers into a <classname>GstQueue</classname> and another
thread repeadedly calling gst_pad_pull () on the queue to feed its
internal elements.
......@@ -105,8 +105,8 @@ main (int argc, char *argv[])
gst_bin_add_many (GST_BIN (bin), filesrc, queue, thread, NULL);
gst_element_connect (filesrc, queue);
gst_element_connect_many (queue, decode, audiosink, NULL);
gst_element_link (filesrc, queue);
gst_element_link_many (queue, decode, audiosink, NULL);
/* start playing */
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
......
......@@ -136,7 +136,7 @@ main (int argc, char *argv[])
/* add objects to the thread */
gst_bin_add_many (GST_BIN (thread), filesrc, decoder, audiosink, NULL);
/* connect them in the logical order */
gst_element_connect_many (filesrc, decoder, audiosink, NULL);
gst_element_link_many (filesrc, decoder, audiosink, NULL);
/* start playing */
gst_element_set_state (GST_ELEMENT (thread), GST_STATE_PLAYING);
......
......@@ -88,8 +88,8 @@ main(int argc, char *argv[])
g_signal_connect (G_OBJECT (typefind), "have_type",
G_CALLBACK (type_found), NULL);
gst_pad_connect (gst_element_get_pad (filesrc, "src"),
gst_element_get_pad (typefind, "sink"));
gst_pad_link (gst_element_get_pad (filesrc, "src"),
gst_element_get_pad (typefind, "sink"));
/* start playing */
gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
......
......@@ -78,15 +78,15 @@ main (int argc, char *argv[])