upload tizen1.0 source
[framework/multimedia/gst-plugins-good0.10.git] / docs / plugins / html / gst-plugins-good-plugins-rganalysis.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>rganalysis</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
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-revtv.html" title="revtv">
10 <link rel="next" href="gst-plugins-good-plugins-rglimiter.html" title="rglimiter">
11 <meta name="generator" content="GTK-Doc V1.17 (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-revtv.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-rglimiter.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-rganalysis.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#gst-plugins-good-plugins-rganalysis.description" class="shortcut">Description</a>
27                    | 
28                   <a href="#gst-plugins-good-plugins-rganalysis.object-hierarchy" class="shortcut">Object Hierarchy</a>
29                    | 
30                   <a href="#gst-plugins-good-plugins-rganalysis.properties" class="shortcut">Properties</a>
31 </td></tr>
32 </table>
33 <div class="refentry">
34 <a name="gst-plugins-good-plugins-rganalysis"></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-rganalysis.top_of_page"></a>rganalysis</span></h2>
38 <p>rganalysis — Perform the ReplayGain analysis</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-rganalysis.synopsis"></a><h2>Synopsis</h2>
44 <a name="GstRgAnalysis"></a><pre class="synopsis">struct              <a class="link" href="gst-plugins-good-plugins-rganalysis.html#GstRgAnalysis-struct" title="struct GstRgAnalysis">GstRgAnalysis</a>;
45 </pre>
46 </div>
47 <div class="refsect1">
48 <a name="gst-plugins-good-plugins-rganalysis.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                      +----GstRgAnalysis
55 </pre>
56 </div>
57 <div class="refsect1">
58 <a name="gst-plugins-good-plugins-rganalysis.properties"></a><h2>Properties</h2>
59 <pre class="synopsis">
60   "<a class="link" href="gst-plugins-good-plugins-rganalysis.html#GstRgAnalysis--forced" title='The "forced" property'>forced</a>"                   <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write
61   "<a class="link" href="gst-plugins-good-plugins-rganalysis.html#GstRgAnalysis--num-tracks" title='The "num-tracks" property'>num-tracks</a>"               <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write
62   "<a class="link" href="gst-plugins-good-plugins-rganalysis.html#GstRgAnalysis--reference-level" title='The "reference-level" property'>reference-level</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-rganalysis.html#GstRgAnalysis--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 / Construct
64 </pre>
65 </div>
66 <div class="refsect1">
67 <a name="gst-plugins-good-plugins-rganalysis.description"></a><h2>Description</h2>
68 <p>
69 This element analyzes raw audio sample data in accordance with the proposed
70 <a class="ulink" href="http://replaygain.org" target="_top">ReplayGain standard</a> for
71 calculating the ideal replay gain for music tracks and albums.  The element
72 is designed as a pass-through filter that never modifies any data.  As it
73 receives an EOS event, it finalizes the ongoing analysis and generates a tag
74 list containing the results.  It is sent downstream with a tag event and
75 posted on the message bus with a tag message.  The EOS event is forwarded as
76 normal afterwards.  Result tag lists at least contain the tags
77 <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstTagList.html#GST-TAG-TRACK-GAIN:CAPS"><span class="type">GST_TAG_TRACK_GAIN</span></a>, <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstTagList.html#GST-TAG-TRACK-PEAK:CAPS"><span class="type">GST_TAG_TRACK_PEAK</span></a> and <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstTagList.html#GST-TAG-REFERENCE-LEVEL:CAPS"><span class="type">GST_TAG_REFERENCE_LEVEL</span></a>.
78 </p>
79 <p>
80 Because the generated metadata tags become available at the end of streams,
81 downstream muxer and encoder elements are normally unable to save them in
82 their output since they generally save metadata in the file header.
83 Therefore, it is often necessary that applications read the results in a bus
84 event handler for the tag message.  Obtaining the values this way is always
85 needed for <a class="link" href="gst-plugins-good-plugins-rganalysis.html#GstRgAnalysis--num-tracks" title='The "num-tracks" property'>album processing</a>
86 since the album gain and peak values need to be associated with all tracks of
87 an album, not just the last one.
88 </p>
89 <p>
90 </p>
91 <div class="refsect2">
92 <a name="idp20743456"></a><h3>Example launch lines</h3>
93 <div class="informalexample">
94   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
95     <tbody>
96       <tr>
97         <td class="listing_lines" align="right"><pre>1</pre></td>
98         <td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch <span class="gtkdoc opt">-</span>t audiotestsrc wave<span class="gtkdoc opt">=</span>sine num<span class="gtkdoc opt">-</span>buffers<span class="gtkdoc opt">=</span><span class="number">512</span> <span class="gtkdoc opt">!</span> rganalysis <span class="gtkdoc opt">!</span> fakesink</pre></td>
99       </tr>
100     </tbody>
101   </table>
102 </div>
103  Analyze a simple test waveform
104 <div class="informalexample">
105   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
106     <tbody>
107       <tr>
108         <td class="listing_lines" align="right"><pre>1
109 2</pre></td>
110         <td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch <span class="gtkdoc opt">-</span>t filesrc location<span class="gtkdoc opt">=</span>filename<span class="gtkdoc opt">.</span>ext <span class="gtkdoc opt">!</span> decodebin \
111     <span class="gtkdoc opt">!</span> audioconvert <span class="gtkdoc opt">!</span> audioresample <span class="gtkdoc opt">!</span> rganalysis <span class="gtkdoc opt">!</span> fakesink</pre></td>
112       </tr>
113     </tbody>
114   </table>
115 </div>
116  Analyze a given file
117 <div class="informalexample">
118   <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
119     <tbody>
120       <tr>
121         <td class="listing_lines" align="right"><pre>1
122 2</pre></td>
123         <td class="listing_code"><pre class="programlisting">gst<span class="gtkdoc opt">-</span>launch <span class="gtkdoc opt">-</span>t gnomevfssrc location<span class="gtkdoc opt">=</span>http<span class="gtkdoc opt">:</span><span class="gtkdoc slc">//replaygain.hydrogenaudio.org/ref_pink.wav \</span>
124     <span class="gtkdoc opt">!</span> wavparse <span class="gtkdoc opt">!</span> rganalysis <span class="gtkdoc opt">!</span> fakesink</pre></td>
125       </tr>
126     </tbody>
127   </table>
128 </div>
129  Analyze the pink noise reference file
130 <p>
131 The above launch line yields a result gain of +6 dB (instead of the expected
132 +0 dB).  This is not in error, refer to the <a class="link" href="gst-plugins-good-plugins-rganalysis.html#GstRgAnalysis--reference-level" title='The "reference-level" property'><span class="type">"reference-level"</span></a>
133 property documentation for more information.
134 </p>
135 </div>
136 <p>
137 </p>
138 <hr>
139 <div class="refsect2">
140 <a name="idp16371872"></a><h3>Acknowledgements</h3>
141 <p>
142 This element is based on code used in the <a class="ulink" href="http://sjeng.org/vorbisgain.html" target="_top">vorbisgain</a> program and many
143 others.  The relevant parts are copyrighted by David Robinson, Glen Sawyer
144 and Frank Klemm.
145 </p>
146 </div>
147 <p>
148 </p>
149 <div class="refsynopsisdiv">
150 <h2>Synopsis</h2>
151 <div class="refsect2">
152 <a name="idp15916432"></a><h3>Element Information</h3>
153 <div class="variablelist"><table border="0">
154 <col align="left" valign="top">
155 <tbody>
156 <tr>
157 <td><p><span class="term">plugin</span></p></td>
158 <td>
159             <a class="link" href="gst-plugins-good-plugins-plugin-replaygain.html#plugin-replaygain">replaygain</a>
160           </td>
161 </tr>
162 <tr>
163 <td><p><span class="term">author</span></p></td>
164 <td>René Stadler &lt;mail@renestadler.de&gt;</td>
165 </tr>
166 <tr>
167 <td><p><span class="term">class</span></p></td>
168 <td>Filter/Analyzer/Audio</td>
169 </tr>
170 </tbody>
171 </table></div>
172 </div>
173 <hr>
174 <div class="refsect2">
175 <a name="idp16103152"></a><h3>Element Pads</h3>
176 <div class="variablelist"><table border="0">
177 <col align="left" valign="top">
178 <tbody>
179 <tr>
180 <td><p><span class="term">name</span></p></td>
181 <td>sink</td>
182 </tr>
183 <tr>
184 <td><p><span class="term">direction</span></p></td>
185 <td>sink</td>
186 </tr>
187 <tr>
188 <td><p><span class="term">presence</span></p></td>
189 <td>always</td>
190 </tr>
191 <tr>
192 <td><p><span class="term">details</span></p></td>
193 <td>audio/x-raw-float, width=(int)32, endianness=(int)1234, channels=(int){ 1, 2 }, rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }</td>
194 </tr>
195 <tr>
196 <td><p><span class="term"></span></p></td>
197 <td> audio/x-raw-int, width=(int)16, depth=(int)[ 1, 16 ], signed=(boolean)true, endianness=(int)1234, channels=(int){ 1, 2 }, rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }</td>
198 </tr>
199 </tbody>
200 </table></div>
201 <div class="variablelist"><table border="0">
202 <col align="left" valign="top">
203 <tbody>
204 <tr>
205 <td><p><span class="term">name</span></p></td>
206 <td>src</td>
207 </tr>
208 <tr>
209 <td><p><span class="term">direction</span></p></td>
210 <td>source</td>
211 </tr>
212 <tr>
213 <td><p><span class="term">presence</span></p></td>
214 <td>always</td>
215 </tr>
216 <tr>
217 <td><p><span class="term">details</span></p></td>
218 <td>audio/x-raw-float, width=(int)32, endianness=(int)1234, channels=(int){ 1, 2 }, rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }</td>
219 </tr>
220 <tr>
221 <td><p><span class="term"></span></p></td>
222 <td> audio/x-raw-int, width=(int)16, depth=(int)[ 1, 16 ], signed=(boolean)true, endianness=(int)1234, channels=(int){ 1, 2 }, rate=(int){ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 }</td>
223 </tr>
224 </tbody>
225 </table></div>
226 </div>
227 </div>
228 <p>
229 </p>
230 </div>
231 <div class="refsect1">
232 <a name="gst-plugins-good-plugins-rganalysis.details"></a><h2>Details</h2>
233 <div class="refsect2">
234 <a name="GstRgAnalysis-struct"></a><h3>struct GstRgAnalysis</h3>
235 <pre class="programlisting">struct GstRgAnalysis;</pre>
236 <p>
237 Opaque data structure.
238 </p>
239 </div>
240 </div>
241 <div class="refsect1">
242 <a name="gst-plugins-good-plugins-rganalysis.property-details"></a><h2>Property Details</h2>
243 <div class="refsect2">
244 <a name="GstRgAnalysis--forced"></a><h3>The <code class="literal">"forced"</code> property</h3>
245 <pre class="programlisting">  "forced"                   <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write</pre>
246 <p>
247 Whether to analyze streams even when ReplayGain tags exist.
248 </p>
249 <p>
250 For assisting transcoder/converter applications, the element can silently
251 skip the processing of streams that already contain the necessary tags.
252 Data will flow as usual but the element will not consume CPU time and will
253 not generate result tags.  To enable possible skipping, set this property
254 to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><span class="type">FALSE</span></a>.
255 </p>
256 <p>
257 If used in conjunction with <a class="link" href="gst-plugins-good-plugins-rganalysis.html#GstRgAnalysis--num-tracks" title='The "num-tracks" property'>album
258 processing</a>, the element will skip the number of remaining album
259 tracks if a full set of tags is found for the first track.  If a subsequent
260 track of the album is missing tags, processing cannot start again.  If this
261 is undesired, the application has to scan all files beforehand and enable
262 forcing of processing if needed.
263 </p>
264 <p>Default value: TRUE</p>
265 </div>
266 <hr>
267 <div class="refsect2">
268 <a name="GstRgAnalysis--num-tracks"></a><h3>The <code class="literal">"num-tracks"</code> property</h3>
269 <pre class="programlisting">  "num-tracks"               <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gint"><span class="type">gint</span></a>                  : Read / Write</pre>
270 <p>
271 Number of remaining album tracks.
272 </p>
273 <p>
274 Analyzing several streams sequentially and assigning them a common result
275 gain is known as "album processing".  If this gain is used during playback
276 (by switching to "album mode"), all tracks of an album receive the same
277 amplification.  This keeps the relative volume levels between the tracks
278 intact.  To enable this, set this property to the number of streams that
279 will be processed as album tracks.
280 </p>
281 <p>
282 Every time an EOS event is received, the value of this property is
283 decremented by one.  As it reaches zero, it is assumed that the last track
284 of the album finished.  The tag list for the final stream will contain the
285 additional tags <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstTagList.html#GST-TAG-ALBUM-GAIN:CAPS"><span class="type">GST_TAG_ALBUM_GAIN</span></a> and <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstTagList.html#GST-TAG-ALBUM-PEAK:CAPS"><span class="type">GST_TAG_ALBUM_PEAK</span></a>.  All other
286 streams just get the two track tags posted because the values for the album
287 tags are not known before all tracks are analyzed.  Applications need to
288 ensure that the album gain and peak values are also associated with the
289 other tracks when storing the results.
290 </p>
291 <p>
292 If the total number of album tracks is unknown beforehand, just ensure that
293 the value is greater than 1 before each track starts.  Then before the end
294 of the last track, set it to the value 1.
295 </p>
296 <p>
297 To perform album processing, the element has to preserve data between
298 streams.  This cannot survive a state change to the NULL or READY state.
299 If you change your pipeline's state to NULL or READY between tracks, lock
300 the element's state using <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html#gst-element-set-locked-state"><code class="function">gst_element_set_locked_state()</code></a> when it is in
301 PAUSED or PLAYING.
302 </p>
303 <p>Allowed values: &gt;= 0</p>
304 <p>Default value: 0</p>
305 </div>
306 <hr>
307 <div class="refsect2">
308 <a name="GstRgAnalysis--reference-level"></a><h3>The <code class="literal">"reference-level"</code> property</h3>
309 <pre class="programlisting">  "reference-level"          <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gdouble"><span class="type">gdouble</span></a>               : Read / Write</pre>
310 <p>
311 Reference level [dB].
312 </p>
313 <p>
314 Analyzing the ReplayGain pink noise reference waveform computes a result of
315 +6 dB instead of the expected 0 dB.  This is because the default reference
316 level is 89 dB.  To obtain values as lined out in the original proposal of
317 ReplayGain, set this property to 83.
318 </p>
319 <p>
320 Almost all software uses 89 dB as a reference however, and this value has
321 become the new official value.  That is to say, while the change has been
322 acclaimed by the author of the ReplayGain proposal, the <a class="ulink" href="http://replaygain.org" target="_top">webpage</a> is still outdated at the time
323 of this writing.
324 </p>
325 <p>
326 The value was changed because the original proposal recommends a default
327 pre-amp value of +6 dB for playback.  This seemed a bit odd, as it means
328 that the algorithm has the general tendency to produce adjustment values
329 that are 6 dB too low.  Bumping the reference level by 6 dB compensated for
330 this.
331 </p>
332 <p>
333 The problem of the reference level being ambiguous for lack of concise
334 standardization is to be solved by adopting the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstTagList.html#GST-TAG-REFERENCE-LEVEL:CAPS"><span class="type">GST_TAG_REFERENCE_LEVEL</span></a>
335 tag, which allows to store the used value alongside the gain values.
336 </p>
337 <p>Allowed values: [0,150]</p>
338 <p>Default value: 89</p>
339 </div>
340 <hr>
341 <div class="refsect2">
342 <a name="GstRgAnalysis--message"></a><h3>The <code class="literal">"message"</code> property</h3>
343 <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 / Construct</pre>
344 <p>Post statics messages.</p>
345 <p>Default value: FALSE</p>
346 </div>
347 </div>
348 <div class="refsect1">
349 <a name="gst-plugins-good-plugins-rganalysis.see-also"></a><h2>See Also</h2>
350 <a class="link" href="gst-plugins-good-plugins-rgvolume.html#GstRgVolume"><span class="type">GstRgVolume</span></a>
351 </div>
352 </div>
353 <div class="footer">
354 <hr>
355           Generated by GTK-Doc V1.17</div>
356 </body>
357 </html>