docs/manual/: Some more minor docs additions and updates.
[platform/upstream/gstreamer.git] / docs / manual / intro-basics.xml
1 <chapter id="chapter-intro-basics">
2   <title>Foundations</title>
3   <para>
4     This chapter of the guide introduces the basic concepts of &GStreamer;.
5     Understanding these concepts will be important in reading any of the
6     rest of this guide, all of them assume understanding of these basic
7     concepts.
8   </para>
9
10   <sect1 id="section-intro-basics-elements">
11     <title>Elements</title>
12     <para>
13       An <emphasis>element</emphasis> is the most important class of objects
14       in &GStreamer;. You will usually create a chain of elements linked
15       together and let data flow through this chain of elements. An element
16       has one specific function, which can be the reading of data from a
17       file, decoding of this data or outputting this data to your sound
18       card (or anything else). By chaining together several such elements,
19       you create a <emphasis>pipeline</emphasis> that can do a specific task,
20       for example media playback or capture. &GStreamer; ships with a large
21       collection of elements by default, making the development of a large
22       variety of media applications possible. If needed, you can also write
23       new elements. That topic is explained in great deal in the Plugin
24       Writer's Guide.
25     </para>
26   </sect1>
27
28   <sect1 id="section-intro-basics-bins">
29     <title>Bins and pipelines</title>
30
31     <para>
32       A <emphasis>bin</emphasis> is a container for a collection of elements.
33       A pipeline is a special subtype of a bin that allows execution of all
34       of its contained child elements. Since bins are subclasses of elements
35       themselves, you can mostly control a bin as if it where an element,
36       thereby abstracting away a lot of complexity for your application. You
37       can, for example change state on all elements in a bin by changing the
38       state of that bin itself. Bins also forward bus messages from their
39       contained children (such as error messages, tag messages or EOS messages).
40     </para>
41     <para>
42       A pipeline is a top-level bin. As you set it to PAUSED or PLAYING state,
43       data flow will start and media processing will take place. Once started,
44       pipelines will run in a separate thread until you stop them or the end
45       of the data stream is reached.
46     </para>
47   </sect1>
48
49   <sect1 id="section-intro-basics-pads">
50     <title>Pads</title>
51     <para>
52       <emphasis>Pads</emphasis> are used to negotiate links and data flow
53       between elements in &GStreamer;. A pad can be viewed as a
54       <quote>plug</quote> or <quote>port</quote> on an element where
55       links may be made with other elements, and through which data can
56       flow to or from those elements. Pads have specific data handling
57       capabilities: A pad can restrict the type of data that flows
58       through it. Links are only allowed between two pads when the
59       allowed data types of the two pads are compatible. Data types are
60       negotiated between pads using a process called <emphasis>caps
61       negotiation</emphasis>. Data types are described as a
62       <classname>GstCaps</classname>.
63     </para>
64     <para>
65       An analogy may be helpful here. A pad is similar to a plug or jack on a
66       physical device. Consider, for example, a home theater system consisting
67       of an amplifier, a DVD player, and a (silent) video projector. Linking
68       the DVD player to the amplifier is allowed because both devices have audio
69       jacks, and linking the projector to the DVD player is allowed because
70       both devices have compatible video jacks. Links between the
71       projector and the amplifier may not be made because the projector and
72       amplifier have different types of jacks. Pads in &GStreamer; serve the
73       same purpose as the jacks in the home theater system.
74     </para>
75     <para>
76       For the most part, all data in &GStreamer; flows one way through a link
77       between elements. Data flows out of one element through one or more
78       <emphasis>source pads</emphasis>, and elements accept incoming data
79       through one or more <emphasis>sink pads</emphasis>. Source and sink
80       elements have only source and sink pads, respectively. Data usually
81       means buffers (described by the <ulink type="http"
82       url="&URLAPI;/gstreamer-GstBuffer.html"><classname>GstBuffer
83       </classname></ulink> object) and events (described by the <ulink
84       type="http" url="&URLAPI;/gstreamer-GstEvent.html"><classname>
85       GstEvent</classname></ulink> object).
86     </para>
87   </sect1>
88 </chapter>