language updates from cameron

Original commit message from CVS:
language updates from cameron
This commit is contained in:
Thomas Vander Stichele 2002-09-14 14:13:34 +00:00
parent 121c19e9f4
commit ef63411dc8
32 changed files with 246 additions and 236 deletions

View file

@ -4,7 +4,7 @@
The small application we created in the previous chapter used the The small application we created in the previous chapter used the
concept of a factory to create the elements. In this chapter we will concept of a factory to create the elements. In this chapter we will
show you how to use the factory concepts to create elements based show you how to use the factory concepts to create elements based
on what they do instead of how they are called. on what they do instead of what they are called.
</para> </para>
<para> <para>
@ -28,9 +28,9 @@
<para> <para>
While this mechanism is quite effective it also has some big problems: While this mechanism is quite effective it also has some big problems:
The elements are created based on their name. Indeed, we create an The elements are created based on their name. Indeed, we create an
element mad by explicitly stating the mad element's name. Our little element, mad, by explicitly stating the mad element's name. Our little
program therefore always uses the mad decoder element to decode program therefore always uses the mad decoder element to decode
the MP3 audio stream, even if there are 3 other MP3 decoders in the the MP3 audio stream, even if there are three other MP3 decoders in the
system. We will see how we can use a more general way to create an system. We will see how we can use a more general way to create an
MP3 decoder element. MP3 decoder element.
</para> </para>
@ -43,14 +43,14 @@
<sect1> <sect1>
<title>More on MIME Types</title> <title>More on MIME Types</title>
<para> <para>
GStreamer uses MIME types to indentify the different types of data GStreamer uses MIME types to identify the different types of data
that can be handled by the elements. They are the high level that can be handled by the elements. They are the high level
mechanisms to make sure that everyone is talking about the right mechanisms to make sure that everyone is talking about the right
kind of data. kind of data.
</para> </para>
<para> <para>
A MIME (Multipurpose Internet Mail Extension) types are a set of A MIME (Multipurpose Internet Mail Extension) type is a pair of
string that denote a certain type of data. examples include: strings that denote a certain type of data. Examples include:
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
@ -59,12 +59,12 @@
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
audio/mpeg : mpeg audio audio/mpeg : MPEG audio
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
video/mpeg : mpeg video video/mpeg : MPEG video
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
@ -77,7 +77,7 @@
will see. will see.
</para> </para>
<para> <para>
As we have seen in the previous chapter, the MIME types are added As we have seen in the previous chapter, MIME types are added
to the Capability structure of a pad. to the Capability structure of a pad.
</para> </para>
@ -125,7 +125,7 @@
</para> </para>
<para> <para>
There is also an association between a MIME type and a file extension, There is also an association between a MIME type and a file extension,
but the use of typefind functions (similar to file(1)) is preferred.. but the use of typefind functions (similar to file(1)) is preferred.
</para> </para>
<para> <para>
The type information is maintained in a list of The type information is maintained in a list of
@ -149,7 +149,7 @@ struct _GstType {
<para> <para>
All operations on <classname>GstType</classname> occur All operations on <classname>GstType</classname> occur
via their <classname>guint16 id</classname> numbers, with via their <classname>guint16 id</classname> numbers, with
<classname>GstType</classname> structure private to the GStreamer the <classname>GstType</classname> structure private to the GStreamer
library. library.
</para> </para>
@ -182,7 +182,7 @@ struct _GstType {
type = gst_type_find_by_id (id); type = gst_type_find_by_id (id);
</programlisting> </programlisting>
<para> <para>
This function will return NULL if the id was associated with This function will return NULL if the id was not associated with
any known <classname>GstType</classname> any known <classname>GstType</classname>
</para> </para>
</sect2> </sect2>
@ -208,7 +208,7 @@ struct _GstType {
</sect1> </sect1>
<sect1> <sect1>
<title>creating elements with the factory</title> <title>Creating elements with the factory</title>
<para> <para>
In the previous section we described how you could obtain In the previous section we described how you could obtain
an element factory using MIME types. One the factory has been an element factory using MIME types. One the factory has been

View file

@ -4,10 +4,10 @@
<sect1> <sect1>
<title>Getting Started</title> <title>Getting Started</title>
<para> <para>
The dparams subsystem is contained within the The Dynamic Parameters subsystem is contained within the
<filename>gstcontrol</filename> library. <filename>gstcontrol</filename> library.
You need to include the header in your applications's source file: You need to include the header in your application's source file:
</para> </para>
<programlisting> <programlisting>
... ...
@ -19,9 +19,9 @@
Your application should link to the shared library <filename>gstcontrol</filename>. Your application should link to the shared library <filename>gstcontrol</filename>.
</para> </para>
<para> <para>
The <filename>gstcontrol</filename> library needs to be initialised The <filename>gstcontrol</filename> library needs to be initialized
when your application is run. This can be done after the the GStreamer when your application is run. This can be done after the the GStreamer
library has been initialised. library has been initialized.
</para> </para>
<programlisting> <programlisting>
... ...

View file

@ -1,8 +1,8 @@
<chapter id="cha-scheduler"> <chapter id="cha-scheduler">
<title>Understanding schedulers</title> <title>Understanding schedulers</title>
<para> <para>
The scheduler is responsible for managing the plugins at runtime. The The scheduler is responsible for managing the plugins at runtime. Its
main responsabilities are: main responsibilities are:
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
@ -28,14 +28,14 @@
</itemizedlist> </itemizedlist>
</para> </para>
<para> <para>
The scheduler is a plugable component, this means that alternative The scheduler is a plugable component; this means that alternative
schedulers can be written and plugged into GStreamer. The default scheduler schedulers can be written and plugged into GStreamer. The default scheduler
uses cothreads to schedule the plugins in a pipeline. Cothreads are fast uses cothreads to schedule the plugins in a pipeline. Cothreads are fast
and lightweight user-space threads. and lightweight user-space threads.
</para> </para>
<para> <para>
There is usually no need to interact with the scheduler directly, however There is usually no need to interact with the scheduler directly, however
it some cases it is feasable to set a specific clock or force a specific in some cases it is feasible to set a specific clock or force a specific
plugin as the entry point in the pipeline. plugin as the entry point in the pipeline.
</para> </para>

View file

@ -33,7 +33,7 @@
<para> <para>
The above program will create a thread with two elements in it. As soon The above program will create a thread with two elements in it. As soon
as it is set to the PLAYING state, the thread will start to iterate as it is set to the PLAYING state, the thread will start to iterate
itself. You never need to manually iterate a thread. itself. You never need to explicitly iterate a thread.
</para> </para>
<sect2> <sect2>
@ -47,7 +47,7 @@
between the threads, in a thread-safe fashion. This element is the between the threads, in a thread-safe fashion. This element is the
queue, described more fully in <xref linkend="cha-queues"/>. It doesn't queue, described more fully in <xref linkend="cha-queues"/>. It doesn't
matter if the queue is placed in the containing bin or in the thread matter if the queue is placed in the containing bin or in the thread
itself, but it needs to be present on one side of the other to enable itself, but it needs to be present on one side or the other to enable
inter-thread communication. inter-thread communication.
</para> </para>
</sect2> </sect2>

View file

@ -35,10 +35,10 @@ gst-launch filesrc location=redpill.vob ! mpegdemux name=demux \
</para> </para>
<para> <para>
You can also use the the parser in you own You can also use the parser in you own
code. <application>GStreamer</application> provides a function code. <application>GStreamer</application> provides a function
gst_parse_launch () that you can use to construt a pipeline. gst_parse_launch () that you can use to construct a pipeline.
The following programs lets you create an mp3 pipeline using the The following program lets you create an MP3 pipeline using the
gst_parse_launch () function: gst_parse_launch () function:
</para> </para>
<programlisting> <programlisting>
@ -95,8 +95,8 @@ main (int argc, char *argv[])
<para> <para>
A bare identifier (a string beginning with a letter and containing A bare identifier (a string beginning with a letter and containing
only letters, numbers, dashes, underscores, percent signs, or colons) only letters, numbers, dashes, underscores, percent signs, or colons)
will create an element from a given elementfactory. In this example, will create an element from a given element factory. In this example,
an instance of the "mad" mp3 decoding plugin will be created. an instance of the "mad" MP3 decoding plugin will be created.
</para> </para>
</sect3> </sect3>
<sect3> <sect3>

View file

@ -12,8 +12,8 @@
The autoplugger API is implemented in an abstract class. Autoplugger The autoplugger API is implemented in an abstract class. Autoplugger
implementations reside in plugins and are therefore optional and can be implementations reside in plugins and are therefore optional and can be
optimized for a specific task. Two types of autopluggers exist: renderer optimized for a specific task. Two types of autopluggers exist: renderer
ones and non renderer ones. the renderer autopluggers will not have any ones and non-renderer ones. The renderer autopluggers will not have any
src pads while the non renderer ones do. The renderer autopluggers are source pads while the non-renderer ones do. The renderer autopluggers are
mainly used for media playback while the non renderer ones are used for mainly used for media playback while the non renderer ones are used for
arbitrary format conversion. arbitrary format conversion.
</para> </para>
@ -28,10 +28,10 @@
A list of all available autopluggers can be obtained with gst_autoplug_factory_get_list(). A list of all available autopluggers can be obtained with gst_autoplug_factory_get_list().
</para> </para>
<para> <para>
If the autoplugger supports the RENDERER API, use If the autoplugger supports the RENDERER API, use the
gst_autoplug_to_renderers() call to create a bin that connects the gst_autoplug_to_renderers() function to create a bin that connects
src caps to the specified render elements. You can then add the bin the source caps to the specified render elements. You can then add
to a pipeline and run it. the bin to a pipeline and run it.
<programlisting> <programlisting>
@ -61,8 +61,8 @@
</para> </para>
<para> <para>
If the autoplugger supports the CAPS API, use the gst_autoplug_to_caps() If the autoplugger supports the CAPS API, use the gst_autoplug_to_caps()
function to connect the src caps to the destination caps. The created function to connect the source caps to the destination caps. The created
bin will have src and sink pads compatible with the provided caps. bin will have source and sink pads compatible with the provided caps.
<programlisting> <programlisting>
@ -108,24 +108,24 @@
<listitem> <listitem>
<para> <para>
Add the autoplugcache element to a bin and connect the sink pad Add the autoplugcache element to a bin and connect the sink pad
to the src pad of an element with unknown caps. to the source pad of an element with unknown caps.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Connect the src pad of the autoplugcache to the sink pad of the Connect the source pad of the autoplugcache to the sink pad of
typefind element. the typefind element.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Loop the pipeline until the typefind element has found a type. Iterate the pipeline until the typefind element has found a type.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Remove the typefind element and add the plugins needed to play Remove the typefind element and add the plugins needed to play
back the discovered media type to the autoplugcache src pad. back the discovered media type to the autoplugcache source pad.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@ -151,9 +151,9 @@
<title>Another approach to autoplugging</title> <title>Another approach to autoplugging</title>
<para> <para>
The autoplug API is interesting, but often impractical. It is static; The autoplug API is interesting, but often impractical. It is static;
it cannot deal with dynamic pipelines (insert ref here). What one it cannot deal with dynamic pipelines (insert ref here). What you
often wants is just an element to stick into a pipeline that will DWIM often want is just an element to stick into a pipeline that will DWIM
(ref). Enter the spider. (Do What I Mean)(ref). Enter the spider.
</para> </para>
<sect2> <sect2>
<title>The spider element</title> <title>The spider element</title>
@ -179,10 +179,10 @@
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Has request pads on the src side. This means that it can autoplug Has request pads on the source side. This means that it can
one source stream into many sink streams. For example, a MPEG1 autoplug one source stream into many sink streams. For example,
system stream can have audio as well as video; that pipeline an MPEG1 system stream can have audio as well as video; that
would be represented in gst-launch syntax as pipeline would be represented in gst-launch syntax as
<programlisting> <programlisting>
$ gst-launch filesrc location=my.mpeg1 ! spider ! { queue ! osssink } spider.src_%d! $ gst-launch filesrc location=my.mpeg1 ! spider ! { queue ! osssink } spider.src_%d!

View file

@ -49,8 +49,8 @@
<sect1 id="sec-bin-create"> <sect1 id="sec-bin-create">
<title>Creating a bin</title> <title>Creating a bin</title>
<para> <para>
Bins register themselves in the GStreamer registry, so they can be Bins are created in the same way that other elements are created. ie.
created in the normal way: using an element factory, or any of the associated convenience functions:
</para> </para>
<programlisting> <programlisting>
GstElement *bin, *thread, *pipeline; GstElement *bin, *thread, *pipeline;
@ -99,7 +99,7 @@
</programlisting> </programlisting>
<para> <para>
You can see that the name of the element becomes very handy You can see that the name of the element becomes very handy
for retrieving the element from an bin by using the element's for retrieving the element from a bin by using the element's
name. gst_bin_get_by_name () will recursively search nested bins. name. gst_bin_get_by_name () will recursively search nested bins.
</para> </para>
<para> <para>
@ -120,7 +120,7 @@
... ...
</programlisting> </programlisting>
<para> <para>
To remove an element from a bin use: To remove an element from a bin, use:
</para> </para>
<programlisting> <programlisting>
GstElement *element; GstElement *element;
@ -129,8 +129,8 @@
... ...
</programlisting> </programlisting>
<para> <para>
To add many elements to a bin at the same time, try the gst_bin_add_many To add many elements to a bin at the same time, use the gst_bin_add_many
() API. Remember to pass NULL as the last argument. () function. Remember to pass NULL as the last argument.
</para> </para>
<programlisting> <programlisting>
GstElement *filesrc, *decoder, *audiosink; GstElement *filesrc, *decoder, *audiosink;
@ -146,8 +146,8 @@
<title>Custom bins</title> <title>Custom bins</title>
<para> <para>
The application programmer can create custom bins packed with elements The application programmer can create custom bins packed with elements
to perform a specific task. This allow you to write an MPEG audio to perform a specific task. This allows you to write an MPEG audio
decoder with just the follwing lines of code: decoder with just the following lines of code:
</para> </para>
<programlisting> <programlisting>
@ -169,7 +169,8 @@
from a <classname>GstThread</classname>, which begins to play as soon from a <classname>GstThread</classname>, which begins to play as soon
as its state is set to PLAYING. Other bin types may need explicit as its state is set to PLAYING. Other bin types may need explicit
iteration. For more information, see <xref linkend="cha-threads"/>. iteration. For more information, see <xref linkend="cha-threads"/>.
</para>
<para>
Custom bins can be created with a plugin or an XML description. You Custom bins can be created with a plugin or an XML description. You
will find more information about creating custom bin in the Plugin will find more information about creating custom bin in the Plugin
Writers Guide (FIXME ref). Writers Guide (FIXME ref).
@ -227,8 +228,11 @@
</programlisting> </programlisting>
<para> <para>
In the above example, the bin now also has a pad: the pad called 'sink' In the above example, the bin now also has a pad: the pad called 'sink'
of the given element. We can now, for example, connect the srcpad of of the given element.
a filesrc to the bin with: </para>
<para>
We can now, for example, connect the source pad of a filesrc element
to the bin with:
</para> </para>
<programlisting> <programlisting>
GstElement *filesrc; GstElement *filesrc;

View file

@ -3,7 +3,7 @@
<para> <para>
Buffers contain the data that will flow through the pipeline you have Buffers contain the data that will flow through the pipeline you have
created. A source element will typically create a new buffer and pass created. A source element will typically create a new buffer and pass
it through the pad to the next element in the chain. When using the it through a pad to the next element in the chain. When using the
GStreamer infrastructure to create a media pipeline you will not have GStreamer infrastructure to create a media pipeline you will not have
to deal with buffers yourself; the elements will do that for you. to deal with buffers yourself; the elements will do that for you.
</para> </para>
@ -43,7 +43,7 @@
<para> <para>
The simple case is that a buffer is created, memory allocated, data put The simple case is that a buffer is created, memory allocated, data put
in it, and passed to the next filter. That filter reads the data, does in it, and passed to the next element. That element reads the data, does
something (like creating a new buffer and decoding into it), and something (like creating a new buffer and decoding into it), and
unreferences the buffer. This causes the data to be freed and the buffer unreferences the buffer. This causes the data to be freed and the buffer
to be destroyed. A typical MPEG audio decoder works like this. to be destroyed. A typical MPEG audio decoder works like this.

View file

@ -28,7 +28,7 @@
</para> </para>
<para> <para>
Below you see how we will visualize the element. Below you see how we will visualize the element.
We always draw a src pad to the right of the element. We always draw a source pad to the right of the element.
</para> </para>
<figure float="1" id="sec-element-srcimg"> <figure float="1" id="sec-element-srcimg">
<title>Visualisation of a source element</title> <title>Visualisation of a source element</title>
@ -40,8 +40,8 @@
</figure> </figure>
<para> <para>
Source elements do not accept data, they only generate data. You can Source elements do not accept data, they only generate data. You can
see this in the figure because it only has a src pad. A src pad can see this in the figure because it only has a source pad. A source
only generate data. pad can only generate data.
</para> </para>
</sect2> </sect2>
@ -49,7 +49,7 @@
<title>Filters and codecs</title> <title>Filters and codecs</title>
<para> <para>
Filter elements both have input and output pads. They operate on Filter elements both have input and output pads. They operate on
data they receive in their sink pads and produce data on their src data they receive in their sink pads and produce data on their source
pads. For example, MPEG decoders and volume filters would fall into pads. For example, MPEG decoders and volume filters would fall into
this category. this category.
</para> </para>
@ -68,7 +68,7 @@
</figure> </figure>
<para> <para>
The above figure shows the visualisation of a filter element. The above figure shows the visualisation of a filter element.
This element has one sink (input) pad and one src (output) pad. This element has one sink (input) pad and one source (output) pad.
Sink pads are drawn on the left of the element. Sink pads are drawn on the left of the element.
</para> </para>
<figure float="1" id="sec-element-multifilterimg"> <figure float="1" id="sec-element-multifilterimg">

View file

@ -4,7 +4,7 @@
This chapter describes the most rudimentary aspects of a This chapter describes the most rudimentary aspects of a
<application>GStreamer</application> application, including initializing <application>GStreamer</application> application, including initializing
the libraries, creating elements, packing them into a pipeline and playing, the libraries, creating elements, packing them into a pipeline and playing,
pause and stop the pipeline. pausing and stopping the pipeline.
</para> </para>
<sect1> <sect1>
@ -12,7 +12,7 @@
<para> <para>
We will create a simple first application, a complete MP3 player, using We will create a simple first application, a complete MP3 player, using
standard <application>GStreamer</application> components. The player standard <application>GStreamer</application> components. The player
will read from a file that is given as the first argument of the program. will read from a file that is given as the first argument to the program.
</para> </para>
<programlisting> <programlisting>
@ -91,9 +91,9 @@ main (int argc, char *argv[])
</programlisting> </programlisting>
<para> <para>
We are going to create 3 elements and one pipeline. Since all elements We are going to create three elements and one pipeline. Since all
share the same base type, <classname>GstElement</classname>, we can elements share the same base type, <classname>GstElement</classname>,
define them as: we can define them as:
</para> </para>
<programlisting> <programlisting>
... ...
@ -104,14 +104,14 @@ main (int argc, char *argv[])
<para> <para>
Next, we are going to create an empty pipeline. As you have seen in Next, we are going to create an empty pipeline. As you have seen in
the basic introduction, this pipeline will hold and manage all the the basic introduction, this pipeline will hold and manage all the
elements we are going to stuff into it. elements we are going to pack into it.
</para> </para>
<programlisting> <programlisting>
/* create a new pipeline to hold the elements */ /* create a new pipeline to hold the elements */
pipeline = gst_pipeline_new ("pipeline"); pipeline = gst_pipeline_new ("pipeline");
</programlisting> </programlisting>
<para> <para>
We use the standard constructor for a pipeline: gst_pipeline_new ("name"). We use the standard constructor for a pipeline: gst_pipeline_new ().
</para> </para>
<para> <para>
@ -149,7 +149,7 @@ main (int argc, char *argv[])
<para> <para>
Finally we create our audio sink element. This element will be able Finally we create our audio sink element. This element will be able
to playback the audio using OSS. to play back the audio using OSS.
</para> </para>
<programlisting> <programlisting>
/* and an audio sink */ /* and an audio sink */
@ -203,7 +203,7 @@ main (int argc, char *argv[])
</note> </note>
<para> <para>
Since we do not use threads, nothing will happen yet. We manually have to Since we do not use threads, nothing will happen yet. We have to
call gst_bin_iterate() to execute one iteration of the pipeline. call gst_bin_iterate() to execute one iteration of the pipeline.
</para> </para>
<programlisting> <programlisting>
@ -211,7 +211,7 @@ main (int argc, char *argv[])
</programlisting> </programlisting>
<para> <para>
The gst_bin_iterate() function will return TRUE as long as something The gst_bin_iterate() function will return TRUE as long as something
interesting happended inside the pipeline. When the end-of-file has been interesting happened inside the pipeline. When the end-of-file has been
reached the _iterate function will return FALSE and we can end the loop. reached the _iterate function will return FALSE and we can end the loop.
</para> </para>
<programlisting> <programlisting>
@ -257,13 +257,14 @@ main (int argc, char *argv[])
<title>Conclusion</title> <title>Conclusion</title>
<para> <para>
This concludes our first example. As you see, setting up a pipeline This concludes our first example. As you see, setting up a pipeline
is very lowlevel but powerful. You will later in this manual how is very low-level but powerful. You will see later in this manual how
you can create a custom MP3 element with a more high level API. you can create a custom MP3 element with a higher-level API.
</para> </para>
<para> <para>
It should be clear from the example that we can very easily replace the It should be clear from the example that we can very easily replace the
filesrc element with an httpsrc, giving you instant network streaming. filesrc element with an httpsrc element, giving you instant network
An element could be build to handle icecast connections, for example. streaming. An element could be built to handle icecast connections,
for example.
</para> </para>
<para> <para>
We can also choose to use another type of sink instead of the audiosink. We can also choose to use another type of sink instead of the audiosink.

View file

@ -24,7 +24,7 @@
This function will get the pad named "src" from the given element. This function will get the pad named "src" from the given element.
</para> </para>
<para> <para>
Alternatively, you can also request a GList of pads from the element. The Alternatively, you can request a GList of pads from the element. The
following code example will print the names of all the pads of an following code example will print the names of all the pads of an
element. element.
</para> </para>
@ -49,8 +49,8 @@
</para> </para>
<para> <para>
gst_pad_get_direction (GstPad *pad) can be used to query if the pad gst_pad_get_direction (GstPad *pad) can be used to query if the pad
is a sink or a src pad. Remember a src pad is a pad that can output is a sink or a source pad. Remember that a source pad is a pad that
data and a sink pad is one that accepts data. can output data and a sink pad is one that accepts data.
</para> </para>
<para> <para>
You can get the parent of the pad, this is the element that this pad belongs to, You can get the parent of the pad, this is the element that this pad belongs to,
@ -62,9 +62,9 @@
<title>Dynamic pads</title> <title>Dynamic pads</title>
<para> <para>
Some elements might not have their pads when they are created. This Some elements might not have their pads when they are created. This
can, for example, happen with an MPEG2 system demuxer. The demuxer will can happen, for example, with an MPEG2 system demultiplexer. The
create its pads at runtime when it detects the different elementary demultiplexer will create its pads at runtime when it detects the
streams in the MPEG2 system stream. different elementary streams in the MPEG2 system stream.
</para> </para>
<para> <para>
Running <application>gst-inspect mpegdemux</application> will show that Running <application>gst-inspect mpegdemux</application> will show that
@ -102,7 +102,7 @@ main(int argc, char *argv[])
GstElement *pipeline; GstElement *pipeline;
GstElement *mpeg2parser; GstElement *mpeg2parser;
// create pipeline and do something usefull // create pipeline and do something useful
... ...
mpeg2parser = gst_element_factory_make ("mpegdemux", "mpegdemux"); mpeg2parser = gst_element_factory_make ("mpegdemux", "mpegdemux");
@ -124,8 +124,8 @@ main(int argc, char *argv[])
<title>Request pads</title> <title>Request pads</title>
<para> <para>
An element can also have request pads. These pads are not created An element can also have request pads. These pads are not created
automatically but are only created on demand. This is very usefull automatically but are only created on demand. This is very useful
for muxers, aggregators and tee elements. for multiplexers, aggregators and tee elements.
</para> </para>
<para> <para>
The tee element, for example, has one input pad and a request padtemplate for the The tee element, for example, has one input pad and a request padtemplate for the
@ -152,10 +152,10 @@ main(int argc, char *argv[])
</para> </para>
<para> <para>
It is also possible to request a pad that is compatible with another It is also possible to request a pad that is compatible with another
padtemplate. This is very usefull if you want to connect an element to pad template. This is very useful if you want to connect an element
a muxer element and you need to request a pad that is compatible. The to a multiplexer element and you need to request a pad that is
gst_element_get_compatible_pad is used to request a compatible pad, compatible. The gst_element_get_compatible_pad is used to request
as is shown in the next example. a compatible pad, as is shown in the next example.
</para> </para>
<programlisting> <programlisting>
... ...
@ -217,9 +217,9 @@ struct _GstCaps {
three properties: layer, bitrate and framed. three properties: layer, bitrate and framed.
</para> </para>
<para> <para>
The src pad (output pad) is called 'src' and outputs data of MIME The source pad (output pad) is called 'src' and outputs data of
type 'audio/raw'. It also has four properties: format, depth, rate MIME type 'audio/raw'. It also has four properties: format, depth,
and channels. rate and channels.
</para> </para>
<programlisting> <programlisting>
Pads: Pads:
@ -247,8 +247,8 @@ Pads:
<sect2 id="sec-pads-props"> <sect2 id="sec-pads-props">
<title>What are properties</title> <title>What are properties</title>
<para> <para>
Properties are used to describe extra information for the Properties are used to describe extra information for
capabilities. The properties basically exist of a key (a string) and capabilities. The properties basically consist of a key (a string) and
a value. There are different possibile value types that can be used: a value. There are different possibile value types that can be used:
</para> </para>
@ -261,8 +261,8 @@ Pads:
<listitem> <listitem>
<para> <para>
An integer range value. The property denotes a range of possible An integer range value. The property denotes a range of possible
values. In the case of the mad element: the src pad has a property values. In the case of the mad element, the source pad has a
rate that can go from 11025 to 48000. property rate that can go from 11025 to 48000.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@ -273,7 +273,7 @@ Pads:
<listitem> <listitem>
<para> <para>
a fourcc value: this is a value that is commonly used to describe an encoding for video, a fourcc value: this is a value that is commonly used to describe an encoding for video,
as used be the AVI specification. as used by the AVI specification.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@ -300,7 +300,7 @@ Pads:
</sect2> </sect2>
<sect2 id="sec-pads-caps-use"> <sect2 id="sec-pads-caps-use">
<title>What are the capabilities used for?</title> <title>What capabilities are used for</title>
<para> <para>
Capabilities describe in great detail the type of media that is handled by the pads. Capabilities describe in great detail the type of media that is handled by the pads.
They are mostly used for: They are mostly used for:
@ -343,17 +343,17 @@ Pads:
</programlisting> </programlisting>
</sect2> </sect2>
<sect2 id="sec-pads-caps-create"> <sect2 id="sec-pads-caps-create">
<title>Creating capabilities structures</title> <title>Creating capability structures</title>
<para> <para>
While the capabilities are mainly used inside the plugin to describe While capabilities are mainly used inside a plugin to describe the
the media type of the pads, the application programmer also has media type of the pads, the application programmer also has to have
to have basic understanding of caps in order to interface with the basic understanding of capabilities in order to interface with the
plugins, specially when using the autopluggers. plugins, specially when using the autopluggers.
</para> </para>
<para> <para>
As we said, a capability has a name, a mime-type and some As we said, a capability has a name, a mime-type and some
properties. The signature of the function to create a new properties. The signature of the function to create a new
<classname>GstCaps</classname> structure is like: <classname>GstCaps</classname> structure is:
<programlisting> <programlisting>
GstCaps* gst_caps_new (const gchar *name, const gchar *mime, GstProps *props); GstCaps* gst_caps_new (const gchar *name, const gchar *mime, GstProps *props);
@ -442,7 +442,7 @@ GstProps* gst_props_new (const gchar *firstname, ...);
NULL NULL
); );
</programlisting> </programlisting>
Optionally the convenient shortcut macro can be used. The above complex Optionally, the convenient shortcut macro can be used. The above complex
capability can be created with: capability can be created with:
<programlisting> <programlisting>
GstCaps *newcaps; GstCaps *newcaps;

View file

@ -49,8 +49,8 @@
<sect1 id="sec-bin-create"> <sect1 id="sec-bin-create">
<title>Creating a bin</title> <title>Creating a bin</title>
<para> <para>
Bins register themselves in the GStreamer registry, so they can be Bins are created in the same way that other elements are created. ie.
created in the normal way: using an element factory, or any of the associated convenience functions:
</para> </para>
<programlisting> <programlisting>
GstElement *bin, *thread, *pipeline; GstElement *bin, *thread, *pipeline;
@ -99,7 +99,7 @@
</programlisting> </programlisting>
<para> <para>
You can see that the name of the element becomes very handy You can see that the name of the element becomes very handy
for retrieving the element from an bin by using the element's for retrieving the element from a bin by using the element's
name. gst_bin_get_by_name () will recursively search nested bins. name. gst_bin_get_by_name () will recursively search nested bins.
</para> </para>
<para> <para>
@ -120,7 +120,7 @@
... ...
</programlisting> </programlisting>
<para> <para>
To remove an element from a bin use: To remove an element from a bin, use:
</para> </para>
<programlisting> <programlisting>
GstElement *element; GstElement *element;
@ -129,8 +129,8 @@
... ...
</programlisting> </programlisting>
<para> <para>
To add many elements to a bin at the same time, try the gst_bin_add_many To add many elements to a bin at the same time, use the gst_bin_add_many
() API. Remember to pass NULL as the last argument. () function. Remember to pass NULL as the last argument.
</para> </para>
<programlisting> <programlisting>
GstElement *filesrc, *decoder, *audiosink; GstElement *filesrc, *decoder, *audiosink;
@ -146,8 +146,8 @@
<title>Custom bins</title> <title>Custom bins</title>
<para> <para>
The application programmer can create custom bins packed with elements The application programmer can create custom bins packed with elements
to perform a specific task. This allow you to write an MPEG audio to perform a specific task. This allows you to write an MPEG audio
decoder with just the follwing lines of code: decoder with just the following lines of code:
</para> </para>
<programlisting> <programlisting>
@ -169,7 +169,8 @@
from a <classname>GstThread</classname>, which begins to play as soon from a <classname>GstThread</classname>, which begins to play as soon
as its state is set to PLAYING. Other bin types may need explicit as its state is set to PLAYING. Other bin types may need explicit
iteration. For more information, see <xref linkend="cha-threads"/>. iteration. For more information, see <xref linkend="cha-threads"/>.
</para>
<para>
Custom bins can be created with a plugin or an XML description. You Custom bins can be created with a plugin or an XML description. You
will find more information about creating custom bin in the Plugin will find more information about creating custom bin in the Plugin
Writers Guide (FIXME ref). Writers Guide (FIXME ref).
@ -227,8 +228,11 @@
</programlisting> </programlisting>
<para> <para>
In the above example, the bin now also has a pad: the pad called 'sink' In the above example, the bin now also has a pad: the pad called 'sink'
of the given element. We can now, for example, connect the srcpad of of the given element.
a filesrc to the bin with: </para>
<para>
We can now, for example, connect the source pad of a filesrc element
to the bin with:
</para> </para>
<programlisting> <programlisting>
GstElement *filesrc; GstElement *filesrc;

View file

@ -3,7 +3,7 @@
<para> <para>
Buffers contain the data that will flow through the pipeline you have Buffers contain the data that will flow through the pipeline you have
created. A source element will typically create a new buffer and pass created. A source element will typically create a new buffer and pass
it through the pad to the next element in the chain. When using the it through a pad to the next element in the chain. When using the
GStreamer infrastructure to create a media pipeline you will not have GStreamer infrastructure to create a media pipeline you will not have
to deal with buffers yourself; the elements will do that for you. to deal with buffers yourself; the elements will do that for you.
</para> </para>
@ -43,7 +43,7 @@
<para> <para>
The simple case is that a buffer is created, memory allocated, data put The simple case is that a buffer is created, memory allocated, data put
in it, and passed to the next filter. That filter reads the data, does in it, and passed to the next element. That element reads the data, does
something (like creating a new buffer and decoding into it), and something (like creating a new buffer and decoding into it), and
unreferences the buffer. This causes the data to be freed and the buffer unreferences the buffer. This causes the data to be freed and the buffer
to be destroyed. A typical MPEG audio decoder works like this. to be destroyed. A typical MPEG audio decoder works like this.

View file

@ -15,16 +15,16 @@
</figure> </figure>
<para> <para>
By connecting these three elements, we have created a very simple 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 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 (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 filter element will do something with the data and send the result to
the final sink element (element3). the final sink element (element3).
</para> </para>
<para> <para>
Imagine the above graph as a simple mpeg audio decoder. The source 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 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 the sink element is your audiocard. We will use this simple graph to
construct an mpeg player later in this manual. construct an MPEG player later in this manual.
</para> </para>
<sect1 id="sec-conn-basic"> <sect1 id="sec-conn-basic">
@ -88,8 +88,8 @@
You can query if a pad is connected with GST_PAD_IS_CONNECTED (pad). You can query if a pad is connected with GST_PAD_IS_CONNECTED (pad).
</para> </para>
<para> <para>
To query for the <classname>GstPad</classname> this srcpad is connected To query for the <classname>GstPad</classname> a pad is connected to, use
to, use gst_pad_get_peer (srcpad). gst_pad_get_peer (pad).
</para> </para>
</sect1> </sect1>

View file

@ -31,7 +31,7 @@
</para> </para>
<para> <para>
Before proceding to the concept of loop-based elements we will first Before proceding to the concept of loop-based elements we will first
explain the chain-based elements explain the chain-based elements.
</para> </para>
<sect1 id="sec-chain-based"> <sect1 id="sec-chain-based">
@ -100,7 +100,7 @@ chain_function (GstPad *pad, GstBuffer *buffer)
When the request for a buffer cannot immediatly satisfied, the control When the request for a buffer cannot immediatly satisfied, the control
will be given to the source element of the loop-based element until it will be given to the source element of the loop-based element until it
performs a push on its source pad. At that time the control is handed performs a push on its source pad. At that time the control is handed
back to the loop-based element, etc... The the execution trace can get back to the loop-based element, etc... The execution trace can get
fairly complex using cothreads when there are multiple input/output fairly complex using cothreads when there are multiple input/output
pads for the loop-based element. Cothread switches are performed within pads for the loop-based element. Cothread switches are performed within
the call to gst_pad_pull and gst_pad_push; from the perspective of the call to gst_pad_pull and gst_pad_push; from the perspective of
@ -110,10 +110,10 @@ chain_function (GstPad *pad, GstBuffer *buffer)
<para> <para>
Loop based elements are mainly used for the more complex elements Loop based elements are mainly used for the more complex elements
that need a specific amount of data before they can start to produce that need a specific amount of data before they can start to produce
output. An example of such an element is the mpeg video decoder. the output. An example of such an element is the MPEG video decoder. The
element will pull a buffer, performs some decoding on it and optionally element will pull a buffer, perform some decoding on it and optionally
requests more buffers to decode, when a complete video frame has request more buffers to decode, and when a complete video frame has
been decoded, a buffer is send out. For example, any plugin using the been decoded, a buffer is sent out. For example, any plugin using the
bytestream library will need to be loop-based. bytestream library will need to be loop-based.
</para> </para>
<para> <para>

View file

@ -4,10 +4,10 @@
<sect1> <sect1>
<title>Getting Started</title> <title>Getting Started</title>
<para> <para>
The dparams subsystem is contained within the The Dynamic Parameters subsystem is contained within the
<filename>gstcontrol</filename> library. <filename>gstcontrol</filename> library.
You need to include the header in your applications's source file: You need to include the header in your application's source file:
</para> </para>
<programlisting> <programlisting>
... ...
@ -19,9 +19,9 @@
Your application should link to the shared library <filename>gstcontrol</filename>. Your application should link to the shared library <filename>gstcontrol</filename>.
</para> </para>
<para> <para>
The <filename>gstcontrol</filename> library needs to be initialised The <filename>gstcontrol</filename> library needs to be initialized
when your application is run. This can be done after the the GStreamer when your application is run. This can be done after the the GStreamer
library has been initialised. library has been initialized.
</para> </para>
<programlisting> <programlisting>
... ...

View file

@ -2,14 +2,14 @@
<title>Dynamic pipelines</title> <title>Dynamic pipelines</title>
<para> <para>
In this chapter we will see how you can create a dynamic pipeline. A In this chapter we will see how you can create a dynamic pipeline. A
dynamic pipeline is a pipeline that is updated or created while media dynamic pipeline is a pipeline that is updated or created while data
is flowing through it. We will create a partial pipeline first and add is flowing through it. We will create a partial pipeline first and add
more elements while the pipeline is playing. Dynamic pipelines cause more elements while the pipeline is playing. Dynamic pipelines cause
all sorts of scheduling issues and will remain a topic of research for all sorts of scheduling issues and will remain a topic of research for
a long time in GStreamer. a long time in GStreamer.
</para> </para>
<para> <para>
We will show how to create an mpeg1 video player using dynamic pipelines. We will show how to create an MPEG1 video player using dynamic pipelines.
As you have seen in the pad section, we can attach a signal to an element As you have seen in the pad section, we can attach a signal to an element
when a pad is created. We will use this to create our MPEG1 player. when a pad is created. We will use this to create our MPEG1 player.
</para> </para>

View file

@ -28,7 +28,7 @@
</para> </para>
<para> <para>
Below you see how we will visualize the element. Below you see how we will visualize the element.
We always draw a src pad to the right of the element. We always draw a source pad to the right of the element.
</para> </para>
<figure float="1" id="sec-element-srcimg"> <figure float="1" id="sec-element-srcimg">
<title>Visualisation of a source element</title> <title>Visualisation of a source element</title>
@ -40,8 +40,8 @@
</figure> </figure>
<para> <para>
Source elements do not accept data, they only generate data. You can Source elements do not accept data, they only generate data. You can
see this in the figure because it only has a src pad. A src pad can see this in the figure because it only has a source pad. A source
only generate data. pad can only generate data.
</para> </para>
</sect2> </sect2>
@ -49,7 +49,7 @@
<title>Filters and codecs</title> <title>Filters and codecs</title>
<para> <para>
Filter elements both have input and output pads. They operate on Filter elements both have input and output pads. They operate on
data they receive in their sink pads and produce data on their src data they receive in their sink pads and produce data on their source
pads. For example, MPEG decoders and volume filters would fall into pads. For example, MPEG decoders and volume filters would fall into
this category. this category.
</para> </para>
@ -68,7 +68,7 @@
</figure> </figure>
<para> <para>
The above figure shows the visualisation of a filter element. The above figure shows the visualisation of a filter element.
This element has one sink (input) pad and one src (output) pad. This element has one sink (input) pad and one source (output) pad.
Sink pads are drawn on the left of the element. Sink pads are drawn on the left of the element.
</para> </para>
<figure float="1" id="sec-element-multifilterimg"> <figure float="1" id="sec-element-multifilterimg">

View file

@ -4,7 +4,7 @@
The small application we created in the previous chapter used the The small application we created in the previous chapter used the
concept of a factory to create the elements. In this chapter we will concept of a factory to create the elements. In this chapter we will
show you how to use the factory concepts to create elements based show you how to use the factory concepts to create elements based
on what they do instead of how they are called. on what they do instead of what they are called.
</para> </para>
<para> <para>
@ -28,9 +28,9 @@
<para> <para>
While this mechanism is quite effective it also has some big problems: While this mechanism is quite effective it also has some big problems:
The elements are created based on their name. Indeed, we create an The elements are created based on their name. Indeed, we create an
element mad by explicitly stating the mad element's name. Our little element, mad, by explicitly stating the mad element's name. Our little
program therefore always uses the mad decoder element to decode program therefore always uses the mad decoder element to decode
the MP3 audio stream, even if there are 3 other MP3 decoders in the the MP3 audio stream, even if there are three other MP3 decoders in the
system. We will see how we can use a more general way to create an system. We will see how we can use a more general way to create an
MP3 decoder element. MP3 decoder element.
</para> </para>
@ -43,14 +43,14 @@
<sect1> <sect1>
<title>More on MIME Types</title> <title>More on MIME Types</title>
<para> <para>
GStreamer uses MIME types to indentify the different types of data GStreamer uses MIME types to identify the different types of data
that can be handled by the elements. They are the high level that can be handled by the elements. They are the high level
mechanisms to make sure that everyone is talking about the right mechanisms to make sure that everyone is talking about the right
kind of data. kind of data.
</para> </para>
<para> <para>
A MIME (Multipurpose Internet Mail Extension) types are a set of A MIME (Multipurpose Internet Mail Extension) type is a pair of
string that denote a certain type of data. examples include: strings that denote a certain type of data. Examples include:
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
@ -59,12 +59,12 @@
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
audio/mpeg : mpeg audio audio/mpeg : MPEG audio
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
video/mpeg : mpeg video video/mpeg : MPEG video
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
@ -77,7 +77,7 @@
will see. will see.
</para> </para>
<para> <para>
As we have seen in the previous chapter, the MIME types are added As we have seen in the previous chapter, MIME types are added
to the Capability structure of a pad. to the Capability structure of a pad.
</para> </para>
@ -125,7 +125,7 @@
</para> </para>
<para> <para>
There is also an association between a MIME type and a file extension, There is also an association between a MIME type and a file extension,
but the use of typefind functions (similar to file(1)) is preferred.. but the use of typefind functions (similar to file(1)) is preferred.
</para> </para>
<para> <para>
The type information is maintained in a list of The type information is maintained in a list of
@ -149,7 +149,7 @@ struct _GstType {
<para> <para>
All operations on <classname>GstType</classname> occur All operations on <classname>GstType</classname> occur
via their <classname>guint16 id</classname> numbers, with via their <classname>guint16 id</classname> numbers, with
<classname>GstType</classname> structure private to the GStreamer the <classname>GstType</classname> structure private to the GStreamer
library. library.
</para> </para>
@ -182,7 +182,7 @@ struct _GstType {
type = gst_type_find_by_id (id); type = gst_type_find_by_id (id);
</programlisting> </programlisting>
<para> <para>
This function will return NULL if the id was associated with This function will return NULL if the id was not associated with
any known <classname>GstType</classname> any known <classname>GstType</classname>
</para> </para>
</sect2> </sect2>
@ -208,7 +208,7 @@ struct _GstType {
</sect1> </sect1>
<sect1> <sect1>
<title>creating elements with the factory</title> <title>Creating elements with the factory</title>
<para> <para>
In the previous section we described how you could obtain In the previous section we described how you could obtain
an element factory using MIME types. One the factory has been an element factory using MIME types. One the factory has been

View file

@ -233,7 +233,7 @@
<partintro> <partintro>
<para> <para>
<application>GStreamer</application> comes prepackaged with a few <application>GStreamer</application> comes prepackaged with a few
programs. and some usefull debugging options. programs, and some useful debugging options.
</para> </para>
</partintro> </partintro>

View file

@ -4,7 +4,7 @@
This chapter describes the most rudimentary aspects of a This chapter describes the most rudimentary aspects of a
<application>GStreamer</application> application, including initializing <application>GStreamer</application> application, including initializing
the libraries, creating elements, packing them into a pipeline and playing, the libraries, creating elements, packing them into a pipeline and playing,
pause and stop the pipeline. pausing and stopping the pipeline.
</para> </para>
<sect1> <sect1>
@ -12,7 +12,7 @@
<para> <para>
We will create a simple first application, a complete MP3 player, using We will create a simple first application, a complete MP3 player, using
standard <application>GStreamer</application> components. The player standard <application>GStreamer</application> components. The player
will read from a file that is given as the first argument of the program. will read from a file that is given as the first argument to the program.
</para> </para>
<programlisting> <programlisting>
@ -91,9 +91,9 @@ main (int argc, char *argv[])
</programlisting> </programlisting>
<para> <para>
We are going to create 3 elements and one pipeline. Since all elements We are going to create three elements and one pipeline. Since all
share the same base type, <classname>GstElement</classname>, we can elements share the same base type, <classname>GstElement</classname>,
define them as: we can define them as:
</para> </para>
<programlisting> <programlisting>
... ...
@ -104,14 +104,14 @@ main (int argc, char *argv[])
<para> <para>
Next, we are going to create an empty pipeline. As you have seen in Next, we are going to create an empty pipeline. As you have seen in
the basic introduction, this pipeline will hold and manage all the the basic introduction, this pipeline will hold and manage all the
elements we are going to stuff into it. elements we are going to pack into it.
</para> </para>
<programlisting> <programlisting>
/* create a new pipeline to hold the elements */ /* create a new pipeline to hold the elements */
pipeline = gst_pipeline_new ("pipeline"); pipeline = gst_pipeline_new ("pipeline");
</programlisting> </programlisting>
<para> <para>
We use the standard constructor for a pipeline: gst_pipeline_new ("name"). We use the standard constructor for a pipeline: gst_pipeline_new ().
</para> </para>
<para> <para>
@ -149,7 +149,7 @@ main (int argc, char *argv[])
<para> <para>
Finally we create our audio sink element. This element will be able Finally we create our audio sink element. This element will be able
to playback the audio using OSS. to play back the audio using OSS.
</para> </para>
<programlisting> <programlisting>
/* and an audio sink */ /* and an audio sink */
@ -203,7 +203,7 @@ main (int argc, char *argv[])
</note> </note>
<para> <para>
Since we do not use threads, nothing will happen yet. We manually have to Since we do not use threads, nothing will happen yet. We have to
call gst_bin_iterate() to execute one iteration of the pipeline. call gst_bin_iterate() to execute one iteration of the pipeline.
</para> </para>
<programlisting> <programlisting>
@ -211,7 +211,7 @@ main (int argc, char *argv[])
</programlisting> </programlisting>
<para> <para>
The gst_bin_iterate() function will return TRUE as long as something The gst_bin_iterate() function will return TRUE as long as something
interesting happended inside the pipeline. When the end-of-file has been interesting happened inside the pipeline. When the end-of-file has been
reached the _iterate function will return FALSE and we can end the loop. reached the _iterate function will return FALSE and we can end the loop.
</para> </para>
<programlisting> <programlisting>
@ -257,13 +257,14 @@ main (int argc, char *argv[])
<title>Conclusion</title> <title>Conclusion</title>
<para> <para>
This concludes our first example. As you see, setting up a pipeline This concludes our first example. As you see, setting up a pipeline
is very lowlevel but powerful. You will later in this manual how is very low-level but powerful. You will see later in this manual how
you can create a custom MP3 element with a more high level API. you can create a custom MP3 element with a higher-level API.
</para> </para>
<para> <para>
It should be clear from the example that we can very easily replace the It should be clear from the example that we can very easily replace the
filesrc element with an httpsrc, giving you instant network streaming. filesrc element with an httpsrc element, giving you instant network
An element could be build to handle icecast connections, for example. streaming. An element could be built to handle icecast connections,
for example.
</para> </para>
<para> <para>
We can also choose to use another type of sink instead of the audiosink. We can also choose to use another type of sink instead of the audiosink.

View file

@ -18,9 +18,9 @@
<para> <para>
We create a simple pipeline and write it to stdout with We create a simple pipeline and write it to stdout with
gst_xml_write_file (). The following code constructs an mp3 player gst_xml_write_file (). The following code constructs an MP3 player
pipeline with two threads and then writes out the XML both to stdout pipeline with two threads and then writes out the XML both to stdout
and to a file. Use this program with one argument: the mp3 file on disk. and to a file. Use this program with one argument: the MP3 file on disk.
</para> </para>
<programlisting> <programlisting>
@ -170,7 +170,7 @@ main(int argc, char *argv[])
<para> <para>
In addition to loading a file, you can also load a from a xmlDocPtr and In addition to loading a file, you can also load a from a xmlDocPtr and
an in memory buffer using gst_xml_parse_doc and gst_xml_parse_memory an in memory buffer using gst_xml_parse_doc and gst_xml_parse_memory
respectivily. both of these methods return a gboolean indicating respectively. Both of these methods return a gboolean indicating
success or failure of the requested action. success or failure of the requested action.
</para> </para>
</sect1> </sect1>
@ -180,7 +180,7 @@ main(int argc, char *argv[])
<para> <para>
It is possible to add custom XML tags to the core XML created with It is possible to add custom XML tags to the core XML created with
gst_xml_write. This feature can be used by an application to add more gst_xml_write. This feature can be used by an application to add more
information to the save plugins. the editor will for example insert information to the save plugins. The editor will for example insert
the position of the elements on the screen using the custom XML tags. the position of the elements on the screen using the custom XML tags.
</para> </para>
<para> <para>
@ -258,7 +258,7 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
<para> <para>
Whenever a new object has been loaded, the xml_loaded function will Whenever a new object has been loaded, the xml_loaded function will
be called. this function looks like: be called. This function looks like:
</para> </para>
<programlisting> <programlisting>
static void static void

View file

@ -25,7 +25,7 @@
One of the the most obvious uses of GStreamer is using it to build One of the the most obvious uses of GStreamer is using it to build
a media player. GStreamer already includes components for building a a media player. GStreamer already includes components for building a
media player that can support a very wide variety of formats, including media player that can support a very wide variety of formats, including
mp3, Ogg Vorbis, MPEG1, MPEG2, AVI, Quicktime, mod and so on. GStreamer, MP3, Ogg Vorbis, MPEG1, MPEG2, AVI, Quicktime, mod and so on. GStreamer,
however, is much more than just another media player. Its main advantages however, is much more than just another media player. Its main advantages
are that the pluggable components can be mixed and matched into arbitrary are that the pluggable components can be mixed and matched into arbitrary
pipelines so that it's possible to write a full-fledged video or audio pipelines so that it's possible to write a full-fledged video or audio

View file

@ -25,7 +25,7 @@
One of the the most obvious uses of GStreamer is using it to build One of the the most obvious uses of GStreamer is using it to build
a media player. GStreamer already includes components for building a a media player. GStreamer already includes components for building a
media player that can support a very wide variety of formats, including media player that can support a very wide variety of formats, including
mp3, Ogg Vorbis, MPEG1, MPEG2, AVI, Quicktime, mod and so on. GStreamer, MP3, Ogg Vorbis, MPEG1, MPEG2, AVI, Quicktime, mod and so on. GStreamer,
however, is much more than just another media player. Its main advantages however, is much more than just another media player. Its main advantages
are that the pluggable components can be mixed and matched into arbitrary are that the pluggable components can be mixed and matched into arbitrary
pipelines so that it's possible to write a full-fledged video or audio pipelines so that it's possible to write a full-fledged video or audio

View file

@ -24,7 +24,7 @@
This function will get the pad named "src" from the given element. This function will get the pad named "src" from the given element.
</para> </para>
<para> <para>
Alternatively, you can also request a GList of pads from the element. The Alternatively, you can request a GList of pads from the element. The
following code example will print the names of all the pads of an following code example will print the names of all the pads of an
element. element.
</para> </para>
@ -49,8 +49,8 @@
</para> </para>
<para> <para>
gst_pad_get_direction (GstPad *pad) can be used to query if the pad gst_pad_get_direction (GstPad *pad) can be used to query if the pad
is a sink or a src pad. Remember a src pad is a pad that can output is a sink or a source pad. Remember that a source pad is a pad that
data and a sink pad is one that accepts data. can output data and a sink pad is one that accepts data.
</para> </para>
<para> <para>
You can get the parent of the pad, this is the element that this pad belongs to, You can get the parent of the pad, this is the element that this pad belongs to,
@ -62,9 +62,9 @@
<title>Dynamic pads</title> <title>Dynamic pads</title>
<para> <para>
Some elements might not have their pads when they are created. This Some elements might not have their pads when they are created. This
can, for example, happen with an MPEG2 system demuxer. The demuxer will can happen, for example, with an MPEG2 system demultiplexer. The
create its pads at runtime when it detects the different elementary demultiplexer will create its pads at runtime when it detects the
streams in the MPEG2 system stream. different elementary streams in the MPEG2 system stream.
</para> </para>
<para> <para>
Running <application>gst-inspect mpegdemux</application> will show that Running <application>gst-inspect mpegdemux</application> will show that
@ -102,7 +102,7 @@ main(int argc, char *argv[])
GstElement *pipeline; GstElement *pipeline;
GstElement *mpeg2parser; GstElement *mpeg2parser;
// create pipeline and do something usefull // create pipeline and do something useful
... ...
mpeg2parser = gst_element_factory_make ("mpegdemux", "mpegdemux"); mpeg2parser = gst_element_factory_make ("mpegdemux", "mpegdemux");
@ -124,8 +124,8 @@ main(int argc, char *argv[])
<title>Request pads</title> <title>Request pads</title>
<para> <para>
An element can also have request pads. These pads are not created An element can also have request pads. These pads are not created
automatically but are only created on demand. This is very usefull automatically but are only created on demand. This is very useful
for muxers, aggregators and tee elements. for multiplexers, aggregators and tee elements.
</para> </para>
<para> <para>
The tee element, for example, has one input pad and a request padtemplate for the The tee element, for example, has one input pad and a request padtemplate for the
@ -152,10 +152,10 @@ main(int argc, char *argv[])
</para> </para>
<para> <para>
It is also possible to request a pad that is compatible with another It is also possible to request a pad that is compatible with another
padtemplate. This is very usefull if you want to connect an element to pad template. This is very useful if you want to connect an element
a muxer element and you need to request a pad that is compatible. The to a multiplexer element and you need to request a pad that is
gst_element_get_compatible_pad is used to request a compatible pad, compatible. The gst_element_get_compatible_pad is used to request
as is shown in the next example. a compatible pad, as is shown in the next example.
</para> </para>
<programlisting> <programlisting>
... ...
@ -217,9 +217,9 @@ struct _GstCaps {
three properties: layer, bitrate and framed. three properties: layer, bitrate and framed.
</para> </para>
<para> <para>
The src pad (output pad) is called 'src' and outputs data of MIME The source pad (output pad) is called 'src' and outputs data of
type 'audio/raw'. It also has four properties: format, depth, rate MIME type 'audio/raw'. It also has four properties: format, depth,
and channels. rate and channels.
</para> </para>
<programlisting> <programlisting>
Pads: Pads:
@ -247,8 +247,8 @@ Pads:
<sect2 id="sec-pads-props"> <sect2 id="sec-pads-props">
<title>What are properties</title> <title>What are properties</title>
<para> <para>
Properties are used to describe extra information for the Properties are used to describe extra information for
capabilities. The properties basically exist of a key (a string) and capabilities. The properties basically consist of a key (a string) and
a value. There are different possibile value types that can be used: a value. There are different possibile value types that can be used:
</para> </para>
@ -261,8 +261,8 @@ Pads:
<listitem> <listitem>
<para> <para>
An integer range value. The property denotes a range of possible An integer range value. The property denotes a range of possible
values. In the case of the mad element: the src pad has a property values. In the case of the mad element, the source pad has a
rate that can go from 11025 to 48000. property rate that can go from 11025 to 48000.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@ -273,7 +273,7 @@ Pads:
<listitem> <listitem>
<para> <para>
a fourcc value: this is a value that is commonly used to describe an encoding for video, a fourcc value: this is a value that is commonly used to describe an encoding for video,
as used be the AVI specification. as used by the AVI specification.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
@ -300,7 +300,7 @@ Pads:
</sect2> </sect2>
<sect2 id="sec-pads-caps-use"> <sect2 id="sec-pads-caps-use">
<title>What are the capabilities used for?</title> <title>What capabilities are used for</title>
<para> <para>
Capabilities describe in great detail the type of media that is handled by the pads. Capabilities describe in great detail the type of media that is handled by the pads.
They are mostly used for: They are mostly used for:
@ -343,17 +343,17 @@ Pads:
</programlisting> </programlisting>
</sect2> </sect2>
<sect2 id="sec-pads-caps-create"> <sect2 id="sec-pads-caps-create">
<title>Creating capabilities structures</title> <title>Creating capability structures</title>
<para> <para>
While the capabilities are mainly used inside the plugin to describe While capabilities are mainly used inside a plugin to describe the
the media type of the pads, the application programmer also has media type of the pads, the application programmer also has to have
to have basic understanding of caps in order to interface with the basic understanding of capabilities in order to interface with the
plugins, specially when using the autopluggers. plugins, specially when using the autopluggers.
</para> </para>
<para> <para>
As we said, a capability has a name, a mime-type and some As we said, a capability has a name, a mime-type and some
properties. The signature of the function to create a new properties. The signature of the function to create a new
<classname>GstCaps</classname> structure is like: <classname>GstCaps</classname> structure is:
<programlisting> <programlisting>
GstCaps* gst_caps_new (const gchar *name, const gchar *mime, GstProps *props); GstCaps* gst_caps_new (const gchar *name, const gchar *mime, GstProps *props);
@ -442,7 +442,7 @@ GstProps* gst_props_new (const gchar *firstname, ...);
NULL NULL
); );
</programlisting> </programlisting>
Optionally the convenient shortcut macro can be used. The above complex Optionally, the convenient shortcut macro can be used. The above complex
capability can be created with: capability can be created with:
<programlisting> <programlisting>
GstCaps *newcaps; GstCaps *newcaps;

View file

@ -35,10 +35,10 @@ gst-launch filesrc location=redpill.vob ! mpegdemux name=demux \
</para> </para>
<para> <para>
You can also use the the parser in you own You can also use the parser in you own
code. <application>GStreamer</application> provides a function code. <application>GStreamer</application> provides a function
gst_parse_launch () that you can use to construt a pipeline. gst_parse_launch () that you can use to construct a pipeline.
The following programs lets you create an mp3 pipeline using the The following program lets you create an MP3 pipeline using the
gst_parse_launch () function: gst_parse_launch () function:
</para> </para>
<programlisting> <programlisting>
@ -95,8 +95,8 @@ main (int argc, char *argv[])
<para> <para>
A bare identifier (a string beginning with a letter and containing A bare identifier (a string beginning with a letter and containing
only letters, numbers, dashes, underscores, percent signs, or colons) only letters, numbers, dashes, underscores, percent signs, or colons)
will create an element from a given elementfactory. In this example, will create an element from a given element factory. In this example,
an instance of the "mad" mp3 decoding plugin will be created. an instance of the "mad" MP3 decoding plugin will be created.
</para> </para>
</sect3> </sect3>
<sect3> <sect3>

View file

@ -8,7 +8,7 @@
<para> <para>
A buffer that is sinked to a Queue will not automatically be pushed to the 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 connected element but will be buffered. It will be pushed to the next
element as soon as a gst_pad_pull () is called on the queues srcpad. element as soon as a gst_pad_pull () is called on the queue's source pad.
</para> </para>
<para> <para>
Queues are mostly used in conjunction with a <classname>GstThread</classname> to Queues are mostly used in conjunction with a <classname>GstThread</classname> to
@ -41,7 +41,7 @@
</programlisting> </programlisting>
<para> <para>
The following mp3 player shows you how to create the above pipeline The following MP3 player shows you how to create the above pipeline
using a thread and a queue. using a thread and a queue.
</para> </para>

View file

@ -1,8 +1,8 @@
<chapter id="cha-scheduler"> <chapter id="cha-scheduler">
<title>Understanding schedulers</title> <title>Understanding schedulers</title>
<para> <para>
The scheduler is responsible for managing the plugins at runtime. The The scheduler is responsible for managing the plugins at runtime. Its
main responsabilities are: main responsibilities are:
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
@ -28,14 +28,14 @@
</itemizedlist> </itemizedlist>
</para> </para>
<para> <para>
The scheduler is a plugable component, this means that alternative The scheduler is a plugable component; this means that alternative
schedulers can be written and plugged into GStreamer. The default scheduler schedulers can be written and plugged into GStreamer. The default scheduler
uses cothreads to schedule the plugins in a pipeline. Cothreads are fast uses cothreads to schedule the plugins in a pipeline. Cothreads are fast
and lightweight user-space threads. and lightweight user-space threads.
</para> </para>
<para> <para>
There is usually no need to interact with the scheduler directly, however There is usually no need to interact with the scheduler directly, however
it some cases it is feasable to set a specific clock or force a specific in some cases it is feasible to set a specific clock or force a specific
plugin as the entry point in the pipeline. plugin as the entry point in the pipeline.
</para> </para>

View file

@ -1,8 +1,8 @@
<chapter id="cha-states"> <chapter id="cha-states">
<title>Element states</title> <title>Element states</title>
<para> <para>
One you have created a pipeline packed with elements, nothing will Once you have created a pipeline packed with elements, nothing will happen
happen yet. This is where the different states come into play. right away. This is where the different states come into play.
</para> </para>
<sect1 id="sec-states"> <sect1 id="sec-states">
@ -37,7 +37,7 @@
<para> <para>
All elements start with the NULL state. The elements will go throught All elements start with the NULL state. The elements will go throught
the following state changes: NULL -&gt; READY -&gt; PAUSED -&gt; the following state changes: NULL -&gt; READY -&gt; PAUSED -&gt;
PLAYING. Remember when going from PLAYING to READY GStreamer will PLAYING. Remember when going from PLAYING to READY, GStreamer will
internally go throught the intermediate states. internally go throught the intermediate states.
</para> </para>
<para> <para>
@ -113,7 +113,7 @@
<note> <note>
<para> <para>
You can also go from the NULL to PLAYING state directly without You can also go from the NULL to PLAYING state directly without
going through the READY state. this is a shortcut, the framework going through the READY state. This is a shortcut; the framework
will internally go through the READY and the PAUSED state for you. will internally go through the READY and the PAUSED state for you.
</para> </para>
</note> </note>
@ -140,7 +140,7 @@
<para> <para>
The PAUSED state is available for temporarily freezing the pipeline. The PAUSED state is available for temporarily freezing the pipeline.
Elements will typically not free their resources in the PAUSED state. Elements will typically not free their resources in the PAUSED state.
Use the NULL state if you want to stop the data flow permanantly. Use the NULL state if you want to stop the data flow permanently.
</para> </para>
</note> </note>
<para> <para>

View file

@ -33,7 +33,7 @@
<para> <para>
The above program will create a thread with two elements in it. As soon The above program will create a thread with two elements in it. As soon
as it is set to the PLAYING state, the thread will start to iterate as it is set to the PLAYING state, the thread will start to iterate
itself. You never need to manually iterate a thread. itself. You never need to explicitly iterate a thread.
</para> </para>
<sect2> <sect2>
@ -47,7 +47,7 @@
between the threads, in a thread-safe fashion. This element is the between the threads, in a thread-safe fashion. This element is the
queue, described more fully in <xref linkend="cha-queues"/>. It doesn't queue, described more fully in <xref linkend="cha-queues"/>. It doesn't
matter if the queue is placed in the containing bin or in the thread matter if the queue is placed in the containing bin or in the thread
itself, but it needs to be present on one side of the other to enable itself, but it needs to be present on one side or the other to enable
inter-thread communication. inter-thread communication.
</para> </para>
</sect2> </sect2>

View file

@ -1,9 +1,9 @@
<chapter id="cha-typedetection"> <chapter id="cha-typedetection">
<title>Typedetection</title> <title>Typedetection</title>
<para> <para>
Sometimes the capabilities of a pad are not specificied. The filesrc, Sometimes the capabilities of a pad are not specificied. The filesrc
for example, does not know what type of file it is reading. Before you element, for example, does not know what type of file it is reading. Before
can attach an element to the pad of the filesrc, you need to determine you can attach an element to the pad of the filesrc, you need to determine
the media type in order to be able to choose a compatible element. the media type in order to be able to choose a compatible element.
</para> </para>
<para> <para>
@ -104,14 +104,14 @@ main(int argc, char *argv[])
<para> <para>
We create a very simple pipeline with only a filesrc and the typefind We create a very simple pipeline with only a filesrc and the typefind
element in it. The sinkpad of the typefind element has been connected element in it. The sinkpad of the typefind element has been connected
to the src pad of the filesrc. to the source pad of the filesrc.
</para> </para>
<para> <para>
We attached a signal 'have_type' to the typefind element which will be called We attached a signal 'have_type' to the typefind element which will be called
when the type of the media stream as been detected. when the type of the media stream as been detected.
</para> </para>
<para> <para>
the typefind function will loop over all the registered types and will The typefind function will loop over all the registered types and will
execute each of the typefind functions. As soon as a function returns execute each of the typefind functions. As soon as a function returns
a GstCaps pointer, the type_found function will be called: a GstCaps pointer, the type_found function will be called:
</para> </para>
@ -138,7 +138,7 @@ type_found (GstElement *typefind, GstCaps* caps)
XML representation of the caps structure to stdout. XML representation of the caps structure to stdout.
</para> </para>
<para> <para>
A more usefull option would be to use the registry to look up an element A more useful option would be to use the registry to look up an element
that can handle this particular caps structure, or we can also use the that can handle this particular caps structure, or we can also use the
autoplugger to connect this caps structure to, for example, a videosink. autoplugger to connect this caps structure to, for example, a videosink.
</para> </para>

View file

@ -18,9 +18,9 @@
<para> <para>
We create a simple pipeline and write it to stdout with We create a simple pipeline and write it to stdout with
gst_xml_write_file (). The following code constructs an mp3 player gst_xml_write_file (). The following code constructs an MP3 player
pipeline with two threads and then writes out the XML both to stdout pipeline with two threads and then writes out the XML both to stdout
and to a file. Use this program with one argument: the mp3 file on disk. and to a file. Use this program with one argument: the MP3 file on disk.
</para> </para>
<programlisting> <programlisting>
@ -170,7 +170,7 @@ main(int argc, char *argv[])
<para> <para>
In addition to loading a file, you can also load a from a xmlDocPtr and In addition to loading a file, you can also load a from a xmlDocPtr and
an in memory buffer using gst_xml_parse_doc and gst_xml_parse_memory an in memory buffer using gst_xml_parse_doc and gst_xml_parse_memory
respectivily. both of these methods return a gboolean indicating respectively. Both of these methods return a gboolean indicating
success or failure of the requested action. success or failure of the requested action.
</para> </para>
</sect1> </sect1>
@ -180,7 +180,7 @@ main(int argc, char *argv[])
<para> <para>
It is possible to add custom XML tags to the core XML created with It is possible to add custom XML tags to the core XML created with
gst_xml_write. This feature can be used by an application to add more gst_xml_write. This feature can be used by an application to add more
information to the save plugins. the editor will for example insert information to the save plugins. The editor will for example insert
the position of the elements on the screen using the custom XML tags. the position of the elements on the screen using the custom XML tags.
</para> </para>
<para> <para>
@ -258,7 +258,7 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
<para> <para>
Whenever a new object has been loaded, the xml_loaded function will Whenever a new object has been loaded, the xml_loaded function will
be called. this function looks like: be called. This function looks like:
</para> </para>
<programlisting> <programlisting>
static void static void