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