build: $(LIBM) belongs into LIBADD not LDFLAGS
[platform/upstream/gstreamer.git] / docs / manual / advanced-interfaces.xml
1 <chapter id="chapter-interfaces">
2   <title>Interfaces</title>
3
4   <para>
5     In <xref linkend="section-elements-properties"/>, you have learned how
6     to use <classname>GObject</classname> properties as a simple way to do
7     interaction between applications and elements. This method suffices for
8     the simple'n'straight settings, but fails for anything more complicated
9     than a getter and setter. For the more complicated use cases, &GStreamer;
10     uses interfaces based on the Glib <classname>GInterface</classname> type.
11   </para>
12
13   <para>
14     Most of the interfaces handled here will not contain any example code.
15     See the API references for details. Here, we will just describe the
16     scope and purpose of each interface.
17   </para>
18
19   <sect1 id="section-interfaces-uri">
20     <title>The URI interface</title>
21
22     <para>
23       In all examples so far, we have only supported local files through the
24       <quote>filesrc</quote> element. &GStreamer;, obviously, supports many
25       more location sources. However, we don't want applications to need to
26       know any particular element implementation details, such as element
27       names for particular network source types and so on. Therefore, there
28       is a URI interface, which can be used to get the source element that
29       supports a particular URI type. There is no strict rule for URI naming,
30       but in general we follow naming conventions that others use, too. For
31       example, assuming you have the correct plugins installed, &GStreamer;
32       supports <quote>file:///&lt;path&gt;/&lt;file&gt;</quote>,
33       <quote>http://&lt;host&gt;/&lt;path&gt;/&lt;file&gt;</quote>,
34       <quote>mms://&lt;host&gt;/&lt;path&gt;/&lt;file&gt;</quote>, and so on.
35     </para>
36     <para>
37       In order to get the source or sink element supporting a particular URI,
38       use <function>gst_element_make_from_uri ()</function>, with the URI
39       type being either <classname>GST_URI_SRC</classname> for a source
40       element, or <classname>GST_URI_SINK</classname> for a sink element.
41     </para>
42     <para>
43       You can convert filenames to and from URIs using GLib's
44       <function>g_filename_to_uri ()</function> and
45       <function>g_uri_to_filename ()</function>.
46     </para>
47   </sect1>
48
49   <sect1 id="section-interfaces-mixer">
50     <title>The Mixer interface</title>
51
52     <para>
53       The mixer interface provides a uniform way to control the volume on a
54       hardware (or software) mixer. The interface is primarily intended to
55       be implemented by elements for audio inputs and outputs that talk
56       directly to the hardware (e.g. OSS or ALSA plugins).
57     </para>
58     <para>
59       Using this interface, it is possible to control a list of tracks
60       (such as Line-in, Microphone, etc.) from a mixer element. They can
61       be muted, their volume can be changed and, for input tracks, their
62       record flag can be set as well.
63     </para>
64     <para>
65       Example plugins implementing this interface include the OSS elements
66       (osssrc, osssink, ossmixer) and the ALSA plugins (alsasrc, alsasink
67       and alsamixer).
68     </para>
69     <para>
70       You should not use this interface for volume control in a playback
71       application. Either use a <classname>volume</classname> element or use
72       <classname>playbin</classname>'s <quote>volume</quote> property, or use
73       the audiosink's <quote>volume</quote> property (if it has one).
74     </para>
75     <note>
76       <para>
77         In order for the <classname>GstMixer</classname> interface to be
78         usable, the element implementing it needs to be in the right state,
79         so that the underlying mixer device is open. This usually means the
80         element needs to be at least in <classname>GST_STATE_READY</classname>
81         before you can use this interface. You will get confusing warnings
82         if the element is not in the right state when the interface is used.
83       </para>
84     </note>
85   </sect1>
86
87   <sect1 id="section-interfaces-tuner">
88     <title>The Tuner interface</title>
89
90     <para>
91       The tuner interface is a uniform way to control inputs and outputs
92       on a multi-input selection device. This is primarily used for input
93       selection on elements for TV- and capture-cards.
94     </para>
95     <para>
96       Using this interface, it is possible to select one track from a list
97       of tracks supported by that tuner-element. The tuner will than select
98       that track for media-processing internally. This can, for example, be
99       used to switch inputs on a TV-card (e.g. from Composite to S-video).
100     </para>
101     <para>
102       This interface is currently only implemented by the Video4linux and
103       Video4linux2 elements.
104     </para>
105     <note>
106       <para>
107         In order for the <classname>GstTuner</classname> interface to be
108         usable, the element implementing it needs to be in the right state,
109         so that the underlying device is open. This usually means the
110         element needs to be at least in <classname>GST_STATE_READY</classname>
111         before you can use this interface. You will get confusing warnings
112         if the element is not in the right state when the interface is used.
113       </para>
114     </note>
115   </sect1>
116
117   <sect1 id="section-interfaces-colorbalance">
118     <title>The Color Balance interface</title>
119
120     <para>
121       The colorbalance interface is a way to control video-related properties
122       on an element, such as brightness, contrast and so on. It's sole
123       reason for existance is that, as far as its authors know, there's no
124       way to dynamically register properties using
125       <classname>GObject</classname>.
126     </para>
127     <para>
128       The colorbalance interface is implemented by several plugins, including
129       xvimagesink and the Video4linux and Video4linux2 elements.
130     </para>
131   </sect1>
132
133   <sect1 id="section-interfaces-proprobe">
134     <title>The Property Probe interface</title>
135
136     <para>
137       The property probe is a way to autodetect allowed values for a
138       <classname>GObject</classname> property. It's primary use is to autodetect
139       devices in several elements. For example, the OSS elements use this
140       interface to detect all OSS devices on a system. Applications can then
141       <quote>probe</quote> this property and get a list of detected devices.
142     </para>
143     <note>
144       <para>
145         Given the overlap between HAL and the practical implementations of this
146         interface, this might in time be deprecated in favour of HAL.
147       </para>
148     </note>
149     <para>
150       This interface is currently implemented by many elements, including
151       the ALSA, OSS, XVImageSink, Video4linux and Video4linux2 elements.
152     </para>
153   </sect1>
154
155   <sect1 id="section-interfaces-xoverlay">
156     <title>The X Overlay interface</title>
157
158     <para>
159       The X Overlay interface was created to solve the problem of embedding
160       video streams in an application window. The application provides an
161       X-window to the element implementing this interface to draw on, and
162       the element will then use this X-window to draw on rather than creating
163       a new toplevel window. This is useful to embed video in video players.
164     </para>
165     <para>
166       This interface is implemented by, amongst others, the Video4linux and
167       Video4linux2 elements and by ximagesink, xvimagesink and sdlvideosink.
168     </para>
169   </sect1>
170 </chapter>