1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
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">
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">
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>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#gst-plugins-good-plugins-level.synopsis" class="shortcut">Top</a>
26 <a href="#gst-plugins-good-plugins-level.description" class="shortcut">Description</a>
28 <a href="#gst-plugins-good-plugins-level.object-hierarchy" class="shortcut">Object Hierarchy</a>
30 <a href="#gst-plugins-good-plugins-level.properties" class="shortcut">Properties</a>
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>
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>
40 <td valign="top" align="right"></td>
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>;
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>
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
66 <div class="refsect1">
67 <a name="gst-plugins-good-plugins-level.description"></a><h2>Description</h2>
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:
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.
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.
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.
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.
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)
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
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
116 <a class="link" href="gst-plugins-good-plugins-level.html#GstLevel--peak-falloff" title='The "peak-falloff" property'>the peak falloff rate</a>.
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
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">
134 <td class="listing_lines" align="right"><pre>1
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 <thomas at apestaart dot org></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>
283 <span class="gtkdoc ppc">#include <string.h></span>
284 <span class="gtkdoc ppc">#include <math.h></span>
286 <span class="gtkdoc ppc">#include <gst/gst.h></span>
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>
292 <span class="keyword">if</span> <span class="gtkdoc opt">(</span>message<span class="gtkdoc opt">-></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>
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">"level"</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>
304 gint i<span class="gtkdoc opt">;</span>
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">"endtime"</span><span class="gtkdoc opt">, &</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">"Could not parse endtime"</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">"rms"</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>
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">"endtime: %"</span> GST_TIME_FORMAT <span class="string">", channels: %d</span><span class="gtkdoc esc">\n</span><span class="string">"</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"><</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">"channel %d</span><span class="gtkdoc esc">\n</span><span class="string">"</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">"rms"</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">"peak"</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">"decay"</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">" RMS: %f dB, peak: %f dB, decay: %f dB</span><span class="gtkdoc esc">\n</span><span class="string">"</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>
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">" normalized rms value: %f</span><span class="gtkdoc esc">\n</span><span class="string">"</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>
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>
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">(&</span>argc<span class="gtkdoc opt">, &</span>argv<span class="gtkdoc opt">);</span>
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">"audio/x-raw-int,channels=2"</span><span class="gtkdoc opt">);</span>
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">"audiotestsrc"</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">"audioconvert"</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">"level"</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">"fakesink"</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>
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">"Failed to link audiotestsrc and audioconvert"</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">"Failed to link audioconvert and level"</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">"Failed to link level and fakesink"</span><span class="gtkdoc opt">);</span>
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">"message"</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">"sync"</span><span class="gtkdoc opt">,</span> TRUE<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
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>
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>
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>
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>
400 <div class="refsynopsisdiv">
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">
408 <td><p><span class="term">plugin</span></p></td>
410 <a class="link" href="gst-plugins-good-plugins-plugin-level.html#plugin-level">level</a>
414 <td><p><span class="term">author</span></p></td>
415 <td>Thomas Vander Stichele <thomas at apestaart dot org></td>
418 <td><p><span class="term">class</span></p></td>
419 <td>Filter/Analyzer/Audio</td>
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">
431 <td><p><span class="term">name</span></p></td>
435 <td><p><span class="term">direction</span></p></td>
439 <td><p><span class="term">presence</span></p></td>
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>
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>
452 <div class="variablelist"><table border="0">
453 <col align="left" valign="top">
456 <td><p><span class="term">name</span></p></td>
460 <td><p><span class="term">direction</span></p></td>
464 <td><p><span class="term">presence</span></p></td>
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>
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>
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>
488 Opaque data structure.
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: >= 1</p>
499 <p>Default value: 100000000</p>
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>
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: >= 0</p>
514 <p>Default value: 10</p>
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>
527 Generated by GTK-Doc V1.18</div>