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>GstAudioClock: GStreamer Base Plugins 1.0 Library Reference Manual</title> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="index.html" title="GStreamer Base Plugins 1.0 Library Reference Manual"> 8<link rel="up" href="gstreamer-audio.html" title="Audio Library"> 9<link rel="prev" href="GstAudioCdSrc.html" title="GstAudioCdSrc"> 10<link rel="next" href="GstAudioDecoder.html" title="GstAudioDecoder"> 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="#GstAudioClock.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 19 <a href="#GstAudioClock.object-hierarchy" class="shortcut">Object Hierarchy</a></span> 20</td> 21<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> 22<td><a accesskey="u" href="gstreamer-audio.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> 23<td><a accesskey="p" href="GstAudioCdSrc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> 24<td><a accesskey="n" href="GstAudioDecoder.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> 25</tr></table> 26<div class="refentry"> 27<a name="GstAudioClock"></a><div class="titlepage"></div> 28<div class="refnamediv"><table width="100%"><tr> 29<td valign="top"> 30<h2><span class="refentrytitle"><a name="GstAudioClock.top_of_page"></a>GstAudioClock</span></h2> 31<p>GstAudioClock — Helper object for implementing audio clocks</p> 32</td> 33<td class="gallery_image" valign="top" align="right"></td> 34</tr></table></div> 35<div class="refsect1"> 36<a name="GstAudioClock.functions"></a><h2>Functions</h2> 37<div class="informaltable"><table class="informaltable" width="100%" border="0"> 38<colgroup> 39<col width="150px" class="functions_return"> 40<col class="functions_name"> 41</colgroup> 42<tbody> 43<tr> 44<td class="function_type"> 45<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a> 46</td> 47<td class="function_name"> 48<span class="c_punctuation">(</span><a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()">*GstAudioClockGetTimeFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span> 49</td> 50</tr> 51<tr> 52<td class="function_type"> 53<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="returnvalue">GstClock</span></a> * 54</td> 55<td class="function_name"> 56<a class="link" href="GstAudioClock.html#gst-audio-clock-new" title="gst_audio_clock_new ()">gst_audio_clock_new</a> <span class="c_punctuation">()</span> 57</td> 58</tr> 59<tr> 60<td class="function_type"> 61<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a> 62</td> 63<td class="function_name"> 64<a class="link" href="GstAudioClock.html#gst-audio-clock-adjust" title="gst_audio_clock_adjust ()">gst_audio_clock_adjust</a> <span class="c_punctuation">()</span> 65</td> 66</tr> 67<tr> 68<td class="function_type"> 69<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a> 70</td> 71<td class="function_name"> 72<a class="link" href="GstAudioClock.html#gst-audio-clock-get-time" title="gst_audio_clock_get_time ()">gst_audio_clock_get_time</a> <span class="c_punctuation">()</span> 73</td> 74</tr> 75<tr> 76<td class="function_type"> 77<span class="returnvalue">void</span> 78</td> 79<td class="function_name"> 80<a class="link" href="GstAudioClock.html#gst-audio-clock-reset" title="gst_audio_clock_reset ()">gst_audio_clock_reset</a> <span class="c_punctuation">()</span> 81</td> 82</tr> 83<tr> 84<td class="function_type"> 85<span class="returnvalue">void</span> 86</td> 87<td class="function_name"> 88<a class="link" href="GstAudioClock.html#gst-audio-clock-invalidate" title="gst_audio_clock_invalidate ()">gst_audio_clock_invalidate</a> <span class="c_punctuation">()</span> 89</td> 90</tr> 91</tbody> 92</table></div> 93</div> 94<div class="refsect1"> 95<a name="GstAudioClock.other"></a><h2>Types and Values</h2> 96<div class="informaltable"><table class="informaltable" width="100%" border="0"> 97<colgroup> 98<col width="150px" class="name"> 99<col class="description"> 100</colgroup> 101<tbody><tr> 102<td class="datatype_keyword">struct</td> 103<td class="function_name"><a class="link" href="GstAudioClock.html#GstAudioClock-struct" title="struct GstAudioClock">GstAudioClock</a></td> 104</tr></tbody> 105</table></div> 106</div> 107<div class="refsect1"> 108<a name="GstAudioClock.object-hierarchy"></a><h2>Object Hierarchy</h2> 109<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a> 110 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a> 111 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#GstObject-struct">GstObject</a> 112 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct">GstClock</a> 113 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSystemClock.html#GstSystemClock-struct">GstSystemClock</a> 114 <span class="lineart">╰──</span> GstAudioClock 115</pre> 116</div> 117<div class="refsect1"> 118<a name="GstAudioClock.includes"></a><h2>Includes</h2> 119<pre class="synopsis">#include <gst/audio/audio.h> 120</pre> 121</div> 122<div class="refsect1"> 123<a name="GstAudioClock.description"></a><h2>Description</h2> 124<p><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> makes it easy for elements to implement a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="type">GstClock</span></a>, they 125simply need to provide a function that returns the current clock time.</p> 126<p>This object is internally used to implement the clock in <a class="link" href="GstAudioBaseSink.html" title="GstAudioBaseSink"><span class="type">GstAudioBaseSink</span></a>.</p> 127</div> 128<div class="refsect1"> 129<a name="GstAudioClock.functions_details"></a><h2>Functions</h2> 130<div class="refsect2"> 131<a name="GstAudioClockGetTimeFunc"></a><h3>GstAudioClockGetTimeFunc ()</h3> 132<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a> 133<span class="c_punctuation">(</span>*GstAudioClockGetTimeFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="type">GstClock</span></a> *clock</code></em>, 134 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre> 135<p>This function will be called whenever the current clock time needs to be 136calculated. If this function returns <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GST-CLOCK-TIME-NONE:CAPS"><span class="type">GST_CLOCK_TIME_NONE</span></a>, the last reported 137time will be returned by the clock.</p> 138<div class="refsect3"> 139<a name="GstAudioClockGetTimeFunc.parameters"></a><h4>Parameters</h4> 140<div class="informaltable"><table class="informaltable" width="100%" border="0"> 141<colgroup> 142<col width="150px" class="parameters_name"> 143<col class="parameters_description"> 144<col width="200px" class="parameters_annotations"> 145</colgroup> 146<tbody> 147<tr> 148<td class="parameter_name"><p>clock</p></td> 149<td class="parameter_description"><p>the <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td> 150<td class="parameter_annotations"> </td> 151</tr> 152<tr> 153<td class="parameter_name"><p>user_data</p></td> 154<td class="parameter_description"><p>user data</p></td> 155<td class="parameter_annotations"> </td> 156</tr> 157</tbody> 158</table></div> 159</div> 160<div class="refsect3"> 161<a name="GstAudioClockGetTimeFunc.returns"></a><h4>Returns</h4> 162<p> the current time or <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GST-CLOCK-TIME-NONE:CAPS"><span class="type">GST_CLOCK_TIME_NONE</span></a> if the previous time should 163be used.</p> 164</div> 165</div> 166<hr> 167<div class="refsect2"> 168<a name="gst-audio-clock-new"></a><h3>gst_audio_clock_new ()</h3> 169<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="returnvalue">GstClock</span></a> * 170gst_audio_clock_new (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>, 171 <em class="parameter"><code><a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()"><span class="type">GstAudioClockGetTimeFunc</span></a> func</code></em>, 172 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>, 173 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy_notify</code></em>);</pre> 174<p>Create a new <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> instance. Whenever the clock time should be 175calculated it will call <em class="parameter"><code>func</code></em> 176 with <em class="parameter"><code>user_data</code></em> 177. When <em class="parameter"><code>func</code></em> 178 returns 179<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GST-CLOCK-TIME-NONE:CAPS"><span class="type">GST_CLOCK_TIME_NONE</span></a>, the clock will return the last reported time.</p> 180<div class="refsect3"> 181<a name="gst-audio-clock-new.parameters"></a><h4>Parameters</h4> 182<div class="informaltable"><table class="informaltable" width="100%" border="0"> 183<colgroup> 184<col width="150px" class="parameters_name"> 185<col class="parameters_description"> 186<col width="200px" class="parameters_annotations"> 187</colgroup> 188<tbody> 189<tr> 190<td class="parameter_name"><p>name</p></td> 191<td class="parameter_description"><p>the name of the clock</p></td> 192<td class="parameter_annotations"> </td> 193</tr> 194<tr> 195<td class="parameter_name"><p>func</p></td> 196<td class="parameter_description"><p>a function</p></td> 197<td class="parameter_annotations"> </td> 198</tr> 199<tr> 200<td class="parameter_name"><p>user_data</p></td> 201<td class="parameter_description"><p>user data</p></td> 202<td class="parameter_annotations"> </td> 203</tr> 204<tr> 205<td class="parameter_name"><p>destroy_notify</p></td> 206<td class="parameter_description"><p><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>user_data</code></em> 207</p></td> 208<td class="parameter_annotations"> </td> 209</tr> 210</tbody> 211</table></div> 212</div> 213<div class="refsect3"> 214<a name="gst-audio-clock-new.returns"></a><h4>Returns</h4> 215<p>a new <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> casted to a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="type">GstClock</span></a>. </p> 216<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p> 217</div> 218</div> 219<hr> 220<div class="refsect2"> 221<a name="gst-audio-clock-adjust"></a><h3>gst_audio_clock_adjust ()</h3> 222<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a> 223gst_audio_clock_adjust (<em class="parameter"><code><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> *clock</code></em>, 224 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> time</code></em>);</pre> 225<p>Adjust <em class="parameter"><code>time</code></em> 226 with the internal offset of the audio clock.</p> 227<div class="refsect3"> 228<a name="gst-audio-clock-adjust.parameters"></a><h4>Parameters</h4> 229<div class="informaltable"><table class="informaltable" width="100%" border="0"> 230<colgroup> 231<col width="150px" class="parameters_name"> 232<col class="parameters_description"> 233<col width="200px" class="parameters_annotations"> 234</colgroup> 235<tbody> 236<tr> 237<td class="parameter_name"><p>clock</p></td> 238<td class="parameter_description"><p>a <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td> 239<td class="parameter_annotations"> </td> 240</tr> 241<tr> 242<td class="parameter_name"><p>time</p></td> 243<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a></p></td> 244<td class="parameter_annotations"> </td> 245</tr> 246</tbody> 247</table></div> 248</div> 249<div class="refsect3"> 250<a name="gst-audio-clock-adjust.returns"></a><h4>Returns</h4> 251<p> <em class="parameter"><code>time</code></em> 252adjusted with the internal offset.</p> 253</div> 254</div> 255<hr> 256<div class="refsect2"> 257<a name="gst-audio-clock-get-time"></a><h3>gst_audio_clock_get_time ()</h3> 258<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a> 259gst_audio_clock_get_time (<em class="parameter"><code><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> *clock</code></em>);</pre> 260<p>Report the time as returned by the <a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()"><span class="type">GstAudioClockGetTimeFunc</span></a> without applying 261any offsets.</p> 262<div class="refsect3"> 263<a name="gst-audio-clock-get-time.parameters"></a><h4>Parameters</h4> 264<div class="informaltable"><table class="informaltable" width="100%" border="0"> 265<colgroup> 266<col width="150px" class="parameters_name"> 267<col class="parameters_description"> 268<col width="200px" class="parameters_annotations"> 269</colgroup> 270<tbody><tr> 271<td class="parameter_name"><p>clock</p></td> 272<td class="parameter_description"><p>a <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td> 273<td class="parameter_annotations"> </td> 274</tr></tbody> 275</table></div> 276</div> 277<div class="refsect3"> 278<a name="gst-audio-clock-get-time.returns"></a><h4>Returns</h4> 279<p> the time as reported by the time function of the audio clock</p> 280</div> 281</div> 282<hr> 283<div class="refsect2"> 284<a name="gst-audio-clock-reset"></a><h3>gst_audio_clock_reset ()</h3> 285<pre class="programlisting"><span class="returnvalue">void</span> 286gst_audio_clock_reset (<em class="parameter"><code><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> *clock</code></em>, 287 <em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> time</code></em>);</pre> 288<p>Inform <em class="parameter"><code>clock</code></em> 289 that future calls to <a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()"><span class="type">GstAudioClockGetTimeFunc</span></a> will return values 290starting from <em class="parameter"><code>time</code></em> 291. The clock will update an internal offset to make sure that 292future calls to internal_time will return an increasing result as required by 293the <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="type">GstClock</span></a> object.</p> 294<div class="refsect3"> 295<a name="gst-audio-clock-reset.parameters"></a><h4>Parameters</h4> 296<div class="informaltable"><table class="informaltable" width="100%" border="0"> 297<colgroup> 298<col width="150px" class="parameters_name"> 299<col class="parameters_description"> 300<col width="200px" class="parameters_annotations"> 301</colgroup> 302<tbody> 303<tr> 304<td class="parameter_name"><p>clock</p></td> 305<td class="parameter_description"><p>a <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td> 306<td class="parameter_annotations"> </td> 307</tr> 308<tr> 309<td class="parameter_name"><p>time</p></td> 310<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a></p></td> 311<td class="parameter_annotations"> </td> 312</tr> 313</tbody> 314</table></div> 315</div> 316</div> 317<hr> 318<div class="refsect2"> 319<a name="gst-audio-clock-invalidate"></a><h3>gst_audio_clock_invalidate ()</h3> 320<pre class="programlisting"><span class="returnvalue">void</span> 321gst_audio_clock_invalidate (<em class="parameter"><code><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> *clock</code></em>);</pre> 322<p>Invalidate the clock function. Call this function when the provided 323<a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()"><span class="type">GstAudioClockGetTimeFunc</span></a> cannot be called anymore, for example, when the 324user_data becomes invalid.</p> 325<p>After calling this function, <em class="parameter"><code>clock</code></em> 326 will return the last returned time for 327the rest of its lifetime.</p> 328<div class="refsect3"> 329<a name="gst-audio-clock-invalidate.parameters"></a><h4>Parameters</h4> 330<div class="informaltable"><table class="informaltable" width="100%" border="0"> 331<colgroup> 332<col width="150px" class="parameters_name"> 333<col class="parameters_description"> 334<col width="200px" class="parameters_annotations"> 335</colgroup> 336<tbody><tr> 337<td class="parameter_name"><p>clock</p></td> 338<td class="parameter_description"><p>a <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td> 339<td class="parameter_annotations"> </td> 340</tr></tbody> 341</table></div> 342</div> 343</div> 344</div> 345<div class="refsect1"> 346<a name="GstAudioClock.other_details"></a><h2>Types and Values</h2> 347<div class="refsect2"> 348<a name="GstAudioClock-struct"></a><h3>struct GstAudioClock</h3> 349<pre class="programlisting">struct GstAudioClock;</pre> 350<p>Opaque <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a>.</p> 351</div> 352</div> 353<div class="refsect1"> 354<a name="GstAudioClock.see-also"></a><h2>See Also</h2> 355<p><a class="link" href="GstAudioBaseSink.html" title="GstAudioBaseSink"><span class="type">GstAudioBaseSink</span></a>, <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSystemClock.html#GstSystemClock-struct"><span class="type">GstSystemClock</span></a></p> 356</div> 357</div> 358<div class="footer"> 359<hr>Generated by GTK-Doc V1.28</div> 360</body> 361</html>