Tizen 2.0 Release
[framework/multimedia/gst-plugins-good0.10.git] / docs / plugins / html / gst-plugins-good-plugins-level.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>level</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GStreamer Good Plugins 0.10 Plugins Reference Manual">
8 <link rel="up" href="ch01.html" title="gst-plugins-good Elements">
9 <link rel="prev" href="gst-plugins-good-plugins-jpegenc.html" title="jpegenc">
10 <link rel="next" href="gst-plugins-good-plugins-matroskamux.html" title="matroskamux">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="gst-plugins-good-plugins-jpegenc.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GStreamer Good Plugins 0.10 Plugins Reference Manual</th>
21 <td><a accesskey="n" href="gst-plugins-good-plugins-matroskamux.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#gst-plugins-good-plugins-level.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#gst-plugins-good-plugins-level.description" class="shortcut">Description</a>
27                    | 
28                   <a href="#gst-plugins-good-plugins-level.object-hierarchy" class="shortcut">Object Hierarchy</a>
29                    | 
30                   <a href="#gst-plugins-good-plugins-level.properties" class="shortcut">Properties</a>
31 </td></tr>
32 </table>
33 <div class="refentry">
34 <a name="gst-plugins-good-plugins-level"></a><div class="titlepage"></div>
35 <div class="refnamediv"><table width="100%"><tr>
36 <td valign="top">
37 <h2><span class="refentrytitle"><a name="gst-plugins-good-plugins-level.top_of_page"></a>level</span></h2>
38 <p>level — RMS/Peak/Decaying Peak Level messager for audio/raw</p>
39 </td>
40 <td valign="top" align="right"></td>
41 </tr></table></div>
42 <div class="refsynopsisdiv">
43 <a name="gst-plugins-good-plugins-level.synopsis"></a><h2>Synopsis</h2>
44 <a name="GstLevel"></a><pre class="synopsis">struct              <a class="link" href="gst-plugins-good-plugins-level.html#GstLevel-struct" title="struct GstLevel">GstLevel</a>;
45 </pre>
46 </div>
47 <div class="refsect1">
48 <a name="gst-plugins-good-plugins-level.object-hierarchy"></a><h2>Object Hierarchy</h2>
49 <pre class="synopsis">
50   <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
51    +----<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstObject.html">GstObject</a>
52          +----<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html">GstElement</a>
53                +----<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-libs/html/GstBaseTransform.html">GstBaseTransform</a>
54                      +----GstLevel
55 </pre>
56 </div>
57 <div class="refsect1">
58 <a name="gst-plugins-good-plugins-level.properties"></a><h2>Properties</h2>
59 <pre class="synopsis">
60   "<a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--interval" title='The "interval" property'>interval</a>"                 <span class="type">guint64</span>               : Read / Write
61   "<a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--message" title='The "message" property'>message</a>"                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
62   "<a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--peak-falloff" title='The "peak-falloff" property'>peak-falloff</a>"             <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>               : Read / Write
63   "<a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--peak-ttl" title='The "peak-ttl" property'>peak-ttl</a>"                 <span class="type">guint64</span>               : Read / Write
64 </pre>
65 </div>
66 <div class="refsect1">
67 <a name="gst-plugins-good-plugins-level.description"></a><h2>Description</h2>
68 <p>
69 Level analyses incoming audio buffers and, if the <a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--message" title='The "message" property'><span class="type">"message"</span></a> property
70 is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><span class="type">TRUE</span></a>, generates an element message named
71 <code class="classname">"level"</code>:
72 after each interval of time given by the <a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--interval" title='The "interval" property'><span class="type">"interval"</span></a> property.
73 The message's structure contains these fields:
74 </p>
75 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
76 <li class="listitem"><p>
77   <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a>
78   <code class="classname">"timestamp"</code>:
79   the timestamp of the buffer that triggered the message.
80   </p></li>
81 <li class="listitem"><p>
82   <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a>
83   <code class="classname">"stream-time"</code>:
84   the stream time of the buffer.
85   </p></li>
86 <li class="listitem"><p>
87   <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a>
88   <code class="classname">"running-time"</code>:
89   the running_time of the buffer.
90   </p></li>
91 <li class="listitem"><p>
92   <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a>
93   <code class="classname">"duration"</code>:
94   the duration of the buffer.
95   </p></li>
96 <li class="listitem"><p>
97   <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a>
98   <code class="classname">"endtime"</code>:
99   the end time of the buffer that triggered the message as stream time (this
100   is deprecated, as it can be calculated from stream-time + duration)
101   </p></li>
102 <li class="listitem"><p>
103   <span class="type">GstValueList</span> of <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>
104   <code class="classname">"peak"</code>:
105   the peak power level in dB for each channel
106   </p></li>
107 <li class="listitem"><p>
108   <span class="type">GstValueList</span> of <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>
109   <code class="classname">"decay"</code>:
110   the decaying peak power level in dB for each channel
111   the decaying peak level follows the peak level, but starts dropping
112   if no new peak is reached after the time given by
113   the <a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--peak-ttl" title='The "peak-ttl" property'>the time to live</a>.
114   When the decaying peak level drops, it does so at the decay rate
115   as specified by the
116   <a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--peak-falloff" title='The "peak-falloff" property'>the peak falloff rate</a>.
117   </p></li>
118 <li class="listitem"><p>
119   <span class="type">GstValueList</span> of <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>
120   <code class="classname">"rms"</code>:
121   the Root Mean Square (or average power) level in dB for each channel
122   </p></li>
123 </ul></div>
124 <p>
125 </p>
126 <p>
127 </p>
128 <div class="refsect2">
129 <a name="idp17556384"></a><h3>Example application</h3>
130 <div class="informalexample">
131   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
132     <tbody>
133       <tr>
134         <td class="listing_lines" align="right"><pre>1
135 2
136 3
137 4
138 5
139 6
140 7
141 8
142 9
143 10
144 11
145 12
146 13
147 14
148 15
149 16
150 17
151 18
152 19
153 20
154 21
155 22
156 23
157 24
158 25
159 26
160 27
161 28
162 29
163 30
164 31
165 32
166 33
167 34
168 35
169 36
170 37
171 38
172 39
173 40
174 41
175 42
176 43
177 44
178 45
179 46
180 47
181 48
182 49
183 50
184 51
185 52
186 53
187 54
188 55
189 56
190 57
191 58
192 59
193 60
194 61
195 62
196 63
197 64
198 65
199 66
200 67
201 68
202 69
203 70
204 71
205 72
206 73
207 74
208 75
209 76
210 77
211 78
212 79
213 80
214 81
215 82
216 83
217 84
218 85
219 86
220 87
221 88
222 89
223 90
224 91
225 92
226 93
227 94
228 95
229 96
230 97
231 98
232 99
233 100
234 101
235 102
236 103
237 104
238 105
239 106
240 107
241 108
242 109
243 110
244 111
245 112
246 113
247 114
248 115
249 116
250 117
251 118
252 119
253 120
254 121
255 122
256 123
257 124
258 125
259 126
260 127
261 128
262 129</pre></td>
263         <td class="listing_code"><pre class="programlisting"><span class="comment">/* GStreamer</span>
264 <span class="comment"> * Copyright (C) 2000,2001,2002,2003,2005</span>
265 <span class="comment"> *           Thomas Vander Stichele &lt;thomas at apestaart dot org&gt;</span>
266 <span class="comment"> *</span>
267 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
268 <span class="comment"> * modify it under the terms of the GNU Library General Public</span>
269 <span class="comment"> * License as published by the Free Software Foundation; either</span>
270 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span>
271 <span class="comment"> *</span>
272 <span class="comment"> * This library is distributed in the hope that it will be useful,</span>
273 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
274 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
275 <span class="comment"> * Library General Public License for more details.</span>
276 <span class="comment"> *</span>
277 <span class="comment"> * You should have received a copy of the GNU Library General Public</span>
278 <span class="comment"> * License along with this library; if not, write to the</span>
279 <span class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330,</span>
280 <span class="comment"> * Boston, MA 02111-1307, USA.</span>
281 <span class="comment"> */</span>
282
283 <span class="gtkdoc ppc">#include &lt;string.h&gt;</span>
284 <span class="gtkdoc ppc">#include &lt;math.h&gt;</span>
285
286 <span class="gtkdoc ppc">#include &lt;gst/gst.h&gt;</span>
287
288 <span class="gtkdoc kwb">static</span> gboolean
289 <span class="function">message_handler</span> <span class="gtkdoc opt">(</span>GstBus <span class="gtkdoc opt">*</span> bus<span class="gtkdoc opt">,</span> GstMessage <span class="gtkdoc opt">*</span> message<span class="gtkdoc opt">,</span> gpointer data<span class="gtkdoc opt">)</span>
290 <span class="gtkdoc opt">{</span>
291
292   <span class="keyword">if</span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">-&gt;</span>type <span class="gtkdoc opt">==</span> GST_MESSAGE_ELEMENT<span class="gtkdoc opt">) {</span>
293     <span class="gtkdoc kwb">const</span> GstStructure <span class="gtkdoc opt">*</span>s <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html#gst-message-get-structure">gst_message_get_structure</a></span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">);</span>
294     <span class="gtkdoc kwb">const</span> gchar <span class="gtkdoc opt">*</span>name <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstStructure.html#gst-structure-get-name">gst_structure_get_name</a></span> <span class="gtkdoc opt">(</span>s<span class="gtkdoc opt">);</span>
295
296     <span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function">strcmp</span> <span class="gtkdoc opt">(</span>name<span class="gtkdoc opt">,</span> <span class="string">&quot;level&quot;</span><span class="gtkdoc opt">) ==</span> <span class="number">0</span><span class="gtkdoc opt">) {</span>
297       gint channels<span class="gtkdoc opt">;</span>
298       GstClockTime endtime<span class="gtkdoc opt">;</span>
299       gdouble rms_dB<span class="gtkdoc opt">,</span> peak_dB<span class="gtkdoc opt">,</span> decay_dB<span class="gtkdoc opt">;</span>
300       gdouble rms<span class="gtkdoc opt">;</span>
301       <span class="gtkdoc kwb">const</span> GValue <span class="gtkdoc opt">*</span>list<span class="gtkdoc opt">;</span>
302       <span class="gtkdoc kwb">const</span> GValue <span class="gtkdoc opt">*</span>value<span class="gtkdoc opt">;</span>
303
304       gint i<span class="gtkdoc opt">;</span>
305
306       <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstStructure.html#gst-structure-get-clock-time">gst_structure_get_clock_time</a></span> <span class="gtkdoc opt">(</span>s<span class="gtkdoc opt">,</span> <span class="string">&quot;endtime&quot;</span><span class="gtkdoc opt">, &amp;</span>endtime<span class="gtkdoc opt">))</span>
307         <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#g-warning">g_warning</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Could not parse endtime&quot;</span><span class="gtkdoc opt">);</span>
308       <span class="comment">/* we can get the number of channels as the length of any of the value</span>
309 <span class="comment">       * lists */</span>
310       list <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstStructure.html#gst-structure-get-value">gst_structure_get_value</a></span> <span class="gtkdoc opt">(</span>s<span class="gtkdoc opt">,</span> <span class="string">&quot;rms&quot;</span><span class="gtkdoc opt">);</span>
311       channels <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstValue.html#gst-value-list-get-size">gst_value_list_get_size</a></span> <span class="gtkdoc opt">(</span>list<span class="gtkdoc opt">);</span>
312
313       <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;endtime: %&quot;</span> GST_TIME_FORMAT <span class="string">&quot;, channels: %d</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span>
314           <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstInfo.html#GST-TIME-ARGS:CAPS">GST_TIME_ARGS</a></span> <span class="gtkdoc opt">(</span>endtime<span class="gtkdoc opt">),</span> channels<span class="gtkdoc opt">);</span>
315       <span class="keyword">for</span> <span class="gtkdoc opt">(</span>i <span class="gtkdoc opt">=</span> <span class="number">0</span><span class="gtkdoc opt">;</span> i <span class="gtkdoc opt">&lt;</span> channels<span class="gtkdoc opt">; ++</span>i<span class="gtkdoc opt">) {</span>
316         <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;channel %d</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> i<span class="gtkdoc opt">);</span>
317         list <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstStructure.html#gst-structure-get-value">gst_structure_get_value</a></span> <span class="gtkdoc opt">(</span>s<span class="gtkdoc opt">,</span> <span class="string">&quot;rms&quot;</span><span class="gtkdoc opt">);</span>
318         value <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstValue.html#gst-value-list-get-value">gst_value_list_get_value</a></span> <span class="gtkdoc opt">(</span>list<span class="gtkdoc opt">,</span> i<span class="gtkdoc opt">);</span>
319         rms_dB <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-value-get-double">g_value_get_double</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">);</span>
320         list <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstStructure.html#gst-structure-get-value">gst_structure_get_value</a></span> <span class="gtkdoc opt">(</span>s<span class="gtkdoc opt">,</span> <span class="string">&quot;peak&quot;</span><span class="gtkdoc opt">);</span>
321         value <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstValue.html#gst-value-list-get-value">gst_value_list_get_value</a></span> <span class="gtkdoc opt">(</span>list<span class="gtkdoc opt">,</span> i<span class="gtkdoc opt">);</span>
322         peak_dB <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-value-get-double">g_value_get_double</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">);</span>
323         list <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstStructure.html#gst-structure-get-value">gst_structure_get_value</a></span> <span class="gtkdoc opt">(</span>s<span class="gtkdoc opt">,</span> <span class="string">&quot;decay&quot;</span><span class="gtkdoc opt">);</span>
324         value <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstValue.html#gst-value-list-get-value">gst_value_list_get_value</a></span> <span class="gtkdoc opt">(</span>list<span class="gtkdoc opt">,</span> i<span class="gtkdoc opt">);</span>
325         decay_dB <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-Standard-Parameter-and-Value-Types.html#g-value-get-double">g_value_get_double</a></span> <span class="gtkdoc opt">(</span>value<span class="gtkdoc opt">);</span>
326         <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;    RMS: %f dB, peak: %f dB, decay: %f dB</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span>
327             rms_dB<span class="gtkdoc opt">,</span> peak_dB<span class="gtkdoc opt">,</span> decay_dB<span class="gtkdoc opt">);</span>
328
329         <span class="comment">/* converting from dB to normal gives us a value between 0.0 and 1.0 */</span>
330         rms <span class="gtkdoc opt">=</span> <span class="function">pow</span> <span class="gtkdoc opt">(</span><span class="number">10</span><span class="gtkdoc opt">,</span> rms_dB <span class="gtkdoc opt">/</span> <span class="number">20</span><span class="gtkdoc opt">);</span>
331         <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;    normalized rms value: %f</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> rms<span class="gtkdoc opt">);</span>
332       <span class="gtkdoc opt">}</span>
333     <span class="gtkdoc opt">}</span>
334   <span class="gtkdoc opt">}</span>
335   <span class="comment">/* we handled the message we want, and ignored the ones we didn't want.</span>
336 <span class="comment">   * so the core can unref the message for us */</span>
337   <span class="keyword">return</span> TRUE<span class="gtkdoc opt">;</span>
338 <span class="gtkdoc opt">}</span>
339
340 <span class="gtkdoc kwb">int</span>
341 <span class="function">main</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">int</span> argc<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">char</span> <span class="gtkdoc opt">*</span>argv<span class="gtkdoc opt">[])</span>
342 <span class="gtkdoc opt">{</span>
343   GstElement <span class="gtkdoc opt">*</span>audiotestsrc<span class="gtkdoc opt">, *</span>audioconvert<span class="gtkdoc opt">, *</span>level<span class="gtkdoc opt">, *</span>fakesink<span class="gtkdoc opt">;</span>
344   GstElement <span class="gtkdoc opt">*</span>pipeline<span class="gtkdoc opt">;</span>
345   GstCaps <span class="gtkdoc opt">*</span>caps<span class="gtkdoc opt">;</span>
346   GstBus <span class="gtkdoc opt">*</span>bus<span class="gtkdoc opt">;</span>
347   guint watch_id<span class="gtkdoc opt">;</span>
348   GMainLoop <span class="gtkdoc opt">*</span>loop<span class="gtkdoc opt">;</span>
349
350   <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-Gst.html#gst-init">gst_init</a></span> <span class="gtkdoc opt">(&amp;</span>argc<span class="gtkdoc opt">, &amp;</span>argv<span class="gtkdoc opt">);</span>
351
352   caps <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstCaps.html#gst-caps-from-string">gst_caps_from_string</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;audio/x-raw-int,channels=2&quot;</span><span class="gtkdoc opt">);</span>
353
354   pipeline <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPipeline.html#gst-pipeline-new">gst_pipeline_new</a></span> <span class="gtkdoc opt">(</span>NULL<span class="gtkdoc opt">);</span>
355   <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">);</span>
356   audiotestsrc <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-make">gst_element_factory_make</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;audiotestsrc&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
357   <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>audiotestsrc<span class="gtkdoc opt">);</span>
358   audioconvert <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-make">gst_element_factory_make</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;audioconvert&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
359   <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>audioconvert<span class="gtkdoc opt">);</span>
360   level <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-make">gst_element_factory_make</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;level&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
361   <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>level<span class="gtkdoc opt">);</span>
362   fakesink <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElementFactory.html#gst-element-factory-make">gst_element_factory_make</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;fakesink&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
363   <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Testing.html#g-assert">g_assert</a></span> <span class="gtkdoc opt">(</span>fakesink<span class="gtkdoc opt">);</span>
364
365   <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBin.html#gst-bin-add-many">gst_bin_add_many</a></span> <span class="gtkdoc opt">(</span><span class="function">GST_BIN</span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">),</span> audiotestsrc<span class="gtkdoc opt">,</span> audioconvert<span class="gtkdoc opt">,</span> level<span class="gtkdoc opt">,</span>
366       fakesink<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
367   <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-link">gst_element_link</a></span> <span class="gtkdoc opt">(</span>audiotestsrc<span class="gtkdoc opt">,</span> audioconvert<span class="gtkdoc opt">))</span>
368     <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Failed to link audiotestsrc and audioconvert&quot;</span><span class="gtkdoc opt">);</span>
369   <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-link-filtered">gst_element_link_filtered</a></span> <span class="gtkdoc opt">(</span>audioconvert<span class="gtkdoc opt">,</span> level<span class="gtkdoc opt">,</span> caps<span class="gtkdoc opt">))</span>
370     <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Failed to link audioconvert and level&quot;</span><span class="gtkdoc opt">);</span>
371   <span class="keyword">if</span> <span class="gtkdoc opt">(!</span><span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-link">gst_element_link</a></span> <span class="gtkdoc opt">(</span>level<span class="gtkdoc opt">,</span> fakesink<span class="gtkdoc opt">))</span>
372     <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Failed to link level and fakesink&quot;</span><span class="gtkdoc opt">);</span>
373
374   <span class="comment">/* make sure we'll get messages */</span>
375   <span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-set">g_object_set</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#G-OBJECT:CAPS">G_OBJECT</a></span> <span class="gtkdoc opt">(</span>level<span class="gtkdoc opt">),</span> <span class="string">&quot;message&quot;</span><span class="gtkdoc opt">,</span> TRUE<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
376   <span class="comment">/* run synced and not as fast as we can */</span>
377   <span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-set">g_object_set</a></span> <span class="gtkdoc opt">(</span><span class="function"><a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#G-OBJECT:CAPS">G_OBJECT</a></span> <span class="gtkdoc opt">(</span>fakesink<span class="gtkdoc opt">),</span> <span class="string">&quot;sync&quot;</span><span class="gtkdoc opt">,</span> TRUE<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
378
379   bus <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-get-bus">gst_element_get_bus</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">);</span>
380   watch_id <span class="gtkdoc opt">=</span> <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstBus.html#gst-bus-add-watch">gst_bus_add_watch</a></span> <span class="gtkdoc opt">(</span>bus<span class="gtkdoc opt">,</span> message_handler<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
381
382   <span class="function"><a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-state">gst_element_set_state</a></span> <span class="gtkdoc opt">(</span>pipeline<span class="gtkdoc opt">,</span> GST_STATE_PLAYING<span class="gtkdoc opt">);</span>
383
384   <span class="comment">/* we need to run a GLib main loop to get the messages */</span>
385   loop <span class="gtkdoc opt">=</span> <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-new">g_main_loop_new</a></span> <span class="gtkdoc opt">(</span>NULL<span class="gtkdoc opt">,</span> FALSE<span class="gtkdoc opt">);</span>
386   <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-run">g_main_loop_run</a></span> <span class="gtkdoc opt">(</span>loop<span class="gtkdoc opt">);</span>
387
388   <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-source-remove">g_source_remove</a></span> <span class="gtkdoc opt">(</span>watch_id<span class="gtkdoc opt">);</span>
389   <span class="function"><a href="http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#g-main-loop-unref">g_main_loop_unref</a></span> <span class="gtkdoc opt">(</span>loop<span class="gtkdoc opt">);</span>
390   <span class="keyword">return</span> <span class="number">0</span><span class="gtkdoc opt">;</span>
391 <span class="gtkdoc opt">}</span></pre></td>
392       </tr>
393     </tbody>
394   </table>
395 </div>
396
397 </div>
398 <p>
399 </p>
400 <div class="refsynopsisdiv">
401 <h2>Synopsis</h2>
402 <div class="refsect2">
403 <a name="idp17356064"></a><h3>Element Information</h3>
404 <div class="variablelist"><table border="0">
405 <col align="left" valign="top">
406 <tbody>
407 <tr>
408 <td><p><span class="term">plugin</span></p></td>
409 <td>
410             <a class="link" href="gst-plugins-good-plugins-plugin-level.html#plugin-level">level</a>
411           </td>
412 </tr>
413 <tr>
414 <td><p><span class="term">author</span></p></td>
415 <td>Thomas Vander Stichele &lt;thomas at apestaart dot org&gt;</td>
416 </tr>
417 <tr>
418 <td><p><span class="term">class</span></p></td>
419 <td>Filter/Analyzer/Audio</td>
420 </tr>
421 </tbody>
422 </table></div>
423 </div>
424 <hr>
425 <div class="refsect2">
426 <a name="idp17817280"></a><h3>Element Pads</h3>
427 <div class="variablelist"><table border="0">
428 <col align="left" valign="top">
429 <tbody>
430 <tr>
431 <td><p><span class="term">name</span></p></td>
432 <td>sink</td>
433 </tr>
434 <tr>
435 <td><p><span class="term">direction</span></p></td>
436 <td>sink</td>
437 </tr>
438 <tr>
439 <td><p><span class="term">presence</span></p></td>
440 <td>always</td>
441 </tr>
442 <tr>
443 <td><p><span class="term">details</span></p></td>
444 <td>audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int){ 8, 16, 32 }, depth=(int){ 8, 16, 32 }, signed=(boolean)true</td>
445 </tr>
446 <tr>
447 <td><p><span class="term"></span></p></td>
448 <td> audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int){ 32, 64 }</td>
449 </tr>
450 </tbody>
451 </table></div>
452 <div class="variablelist"><table border="0">
453 <col align="left" valign="top">
454 <tbody>
455 <tr>
456 <td><p><span class="term">name</span></p></td>
457 <td>src</td>
458 </tr>
459 <tr>
460 <td><p><span class="term">direction</span></p></td>
461 <td>source</td>
462 </tr>
463 <tr>
464 <td><p><span class="term">presence</span></p></td>
465 <td>always</td>
466 </tr>
467 <tr>
468 <td><p><span class="term">details</span></p></td>
469 <td>audio/x-raw-int, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int){ 8, 16, 32 }, depth=(int){ 8, 16, 32 }, signed=(boolean)true</td>
470 </tr>
471 <tr>
472 <td><p><span class="term"></span></p></td>
473 <td> audio/x-raw-float, rate=(int)[ 1, 2147483647 ], channels=(int)[ 1, 2147483647 ], endianness=(int)1234, width=(int){ 32, 64 }</td>
474 </tr>
475 </tbody>
476 </table></div>
477 </div>
478 </div>
479 <p>
480 </p>
481 </div>
482 <div class="refsect1">
483 <a name="gst-plugins-good-plugins-level.details"></a><h2>Details</h2>
484 <div class="refsect2">
485 <a name="GstLevel-struct"></a><h3>struct GstLevel</h3>
486 <pre class="programlisting">struct GstLevel;</pre>
487 <p>
488 Opaque data structure.
489 </p>
490 </div>
491 </div>
492 <div class="refsect1">
493 <a name="gst-plugins-good-plugins-level.property-details"></a><h2>Property Details</h2>
494 <div class="refsect2">
495 <a name="GstLevel--interval"></a><h3>The <code class="literal">"interval"</code> property</h3>
496 <pre class="programlisting">  "interval"                 <span class="type">guint64</span>               : Read / Write</pre>
497 <p>Interval of time between message posts (in nanoseconds).</p>
498 <p>Allowed values: &gt;= 1</p>
499 <p>Default value: 100000000</p>
500 </div>
501 <hr>
502 <div class="refsect2">
503 <a name="GstLevel--message"></a><h3>The <code class="literal">"message"</code> property</h3>
504 <pre class="programlisting">  "message"                  <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
505 <p>Post a level message for each passed interval.</p>
506 <p>Default value: TRUE</p>
507 </div>
508 <hr>
509 <div class="refsect2">
510 <a name="GstLevel--peak-falloff"></a><h3>The <code class="literal">"peak-falloff"</code> property</h3>
511 <pre class="programlisting">  "peak-falloff"             <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>               : Read / Write</pre>
512 <p>Decay rate of decay peak after TTL (in dB/sec).</p>
513 <p>Allowed values: &gt;= 0</p>
514 <p>Default value: 10</p>
515 </div>
516 <hr>
517 <div class="refsect2">
518 <a name="GstLevel--peak-ttl"></a><h3>The <code class="literal">"peak-ttl"</code> property</h3>
519 <pre class="programlisting">  "peak-ttl"                 <span class="type">guint64</span>               : Read / Write</pre>
520 <p>Time To Live of decay peak before it falls back (in nanoseconds).</p>
521 <p>Default value: 300000000</p>
522 </div>
523 </div>
524 </div>
525 <div class="footer">
526 <hr>
527           Generated by GTK-Doc V1.18</div>
528 </body>
529 </html>