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>GstAudioSrc: 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="GstAudioSink.html" title="GstAudioSink"> 10<link rel="next" href="GstAudioBaseSink.html" title="GstAudioBaseSink"> 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="#GstAudioSrc.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 19 <a href="#GstAudioSrc.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="GstAudioSink.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> 24<td><a accesskey="n" href="GstAudioBaseSink.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="GstAudioSrc"></a><div class="titlepage"></div> 28<div class="refnamediv"><table width="100%"><tr> 29<td valign="top"> 30<h2><span class="refentrytitle"><a name="GstAudioSrc.top_of_page"></a>GstAudioSrc</span></h2> 31<p>GstAudioSrc — Simple base class for audio sources</p> 32</td> 33<td class="gallery_image" valign="top" align="right"></td> 34</tr></table></div> 35<div class="refsect1"> 36<a name="GstAudioSrc.other"></a><h2>Types and Values</h2> 37<div class="informaltable"><table class="informaltable" width="100%" border="0"> 38<colgroup> 39<col width="150px" class="name"> 40<col class="description"> 41</colgroup> 42<tbody> 43<tr> 44<td class="datatype_keyword">struct</td> 45<td class="function_name"><a class="link" href="GstAudioSrc.html#GstAudioSrc-struct" title="struct GstAudioSrc">GstAudioSrc</a></td> 46</tr> 47<tr> 48<td class="datatype_keyword">struct</td> 49<td class="function_name"><a class="link" href="GstAudioSrc.html#GstAudioSrcClass" title="struct GstAudioSrcClass">GstAudioSrcClass</a></td> 50</tr> 51</tbody> 52</table></div> 53</div> 54<div class="refsect1"> 55<a name="GstAudioSrc.object-hierarchy"></a><h2>Object Hierarchy</h2> 56<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a> 57 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a> 58 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#GstObject-struct">GstObject</a> 59 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstElement.html#GstElement-struct">GstElement</a> 60 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-libs-1.0/GstBaseSrc.html#GstBaseSrc-struct">GstBaseSrc</a> 61 <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-libs-1.0/GstPushSrc.html#GstPushSrc-struct">GstPushSrc</a> 62 <span class="lineart">╰──</span> <a class="link" href="GstAudioBaseSrc.html" title="GstAudioBaseSrc">GstAudioBaseSrc</a> 63 <span class="lineart">╰──</span> GstAudioSrc 64</pre> 65</div> 66<div class="refsect1"> 67<a name="GstAudioSrc.includes"></a><h2>Includes</h2> 68<pre class="synopsis">#include <gst/audio/audio.h> 69</pre> 70</div> 71<div class="refsect1"> 72<a name="GstAudioSrc.description"></a><h2>Description</h2> 73<p>This is the most simple base class for audio sources that only requires 74subclasses to implement a set of simple functions:</p> 75<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 76<li class="listitem"><p><code class="literal"><code class="function">open()</code></code> :Open the device.</p></li> 77<li class="listitem"><p><code class="literal"><code class="function">prepare()</code></code> :Configure the device with the specified format.</p></li> 78<li class="listitem"><p><code class="literal"><code class="function">read()</code></code> :Read samples from the device.</p></li> 79<li class="listitem"><p><code class="literal"><code class="function">reset()</code></code> :Unblock reads and flush the device.</p></li> 80<li class="listitem"><p><code class="literal"><code class="function">delay()</code></code> :Get the number of samples in the device but not yet read.</p></li> 81<li class="listitem"><p><code class="literal"><code class="function">unprepare()</code></code> :Undo operations done by prepare.</p></li> 82<li class="listitem"><p><code class="literal"><code class="function">close()</code></code> :Close the device.</p></li> 83</ul></div> 84<p>All scheduling of samples and timestamps is done in this base class 85together with <a class="link" href="GstAudioBaseSrc.html" title="GstAudioBaseSrc"><span class="type">GstAudioBaseSrc</span></a> using a default implementation of a 86<a class="link" href="GstAudioRingBuffer.html" title="GstAudioRingBuffer"><span class="type">GstAudioRingBuffer</span></a> that uses threads.</p> 87</div> 88<div class="refsect1"> 89<a name="GstAudioSrc.functions_details"></a><h2>Functions</h2> 90<p></p> 91</div> 92<div class="refsect1"> 93<a name="GstAudioSrc.other_details"></a><h2>Types and Values</h2> 94<div class="refsect2"> 95<a name="GstAudioSrc-struct"></a><h3>struct GstAudioSrc</h3> 96<pre class="programlisting">struct GstAudioSrc;</pre> 97<p>Base class for simple audio sources.</p> 98</div> 99<hr> 100<div class="refsect2"> 101<a name="GstAudioSrcClass"></a><h3>struct GstAudioSrcClass</h3> 102<pre class="programlisting">struct GstAudioSrcClass { 103 GstAudioBaseSrcClass parent_class; 104 105 /* vtable */ 106 107 /* open the device with given specs */ 108 gboolean (*open) (GstAudioSrc *src); 109 /* prepare resources and state to operate with the given specs */ 110 gboolean (*prepare) (GstAudioSrc *src, GstAudioRingBufferSpec *spec); 111 /* undo anything that was done in prepare() */ 112 gboolean (*unprepare) (GstAudioSrc *src); 113 /* close the device */ 114 gboolean (*close) (GstAudioSrc *src); 115 /* read samples from the device */ 116 guint (*read) (GstAudioSrc *src, gpointer data, guint length, 117 GstClockTime *timestamp); 118 /* get number of frames queued in the device */ 119 guint (*delay) (GstAudioSrc *src); 120 /* reset the audio device, unblock from a write */ 121 void (*reset) (GstAudioSrc *src); 122}; 123</pre> 124<p><a class="link" href="GstAudioSrc.html" title="GstAudioSrc"><span class="type">GstAudioSrc</span></a> class. Override the vmethod to implement 125functionality.</p> 126<div class="refsect3"> 127<a name="GstAudioSrcClass.members"></a><h4>Members</h4> 128<div class="informaltable"><table class="informaltable" width="100%" border="0"> 129<colgroup> 130<col width="300px" class="struct_members_name"> 131<col class="struct_members_description"> 132<col width="200px" class="struct_members_annotations"> 133</colgroup> 134<tbody> 135<tr> 136<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAudioSrcClass.open"></a>open</code></em> ()</p></td> 137<td class="struct_member_description"><p>open the device with the specified caps</p></td> 138<td class="struct_member_annotations"> </td> 139</tr> 140<tr> 141<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAudioSrcClass.prepare"></a>prepare</code></em> ()</p></td> 142<td class="struct_member_description"><p>configure device with format</p></td> 143<td class="struct_member_annotations"> </td> 144</tr> 145<tr> 146<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAudioSrcClass.unprepare"></a>unprepare</code></em> ()</p></td> 147<td class="struct_member_description"><p>undo the configuration</p></td> 148<td class="struct_member_annotations"> </td> 149</tr> 150<tr> 151<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAudioSrcClass.close"></a>close</code></em> ()</p></td> 152<td class="struct_member_description"><p>close the device</p></td> 153<td class="struct_member_annotations"> </td> 154</tr> 155<tr> 156<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAudioSrcClass.read"></a>read</code></em> ()</p></td> 157<td class="struct_member_description"><p>read samples from the audio device</p></td> 158<td class="struct_member_annotations"> </td> 159</tr> 160<tr> 161<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAudioSrcClass.delay"></a>delay</code></em> ()</p></td> 162<td class="struct_member_description"><p>the number of frames queued in the device</p></td> 163<td class="struct_member_annotations"> </td> 164</tr> 165<tr> 166<td class="struct_member_name"><p><em class="structfield"><code><a name="GstAudioSrcClass.reset"></a>reset</code></em> ()</p></td> 167<td class="struct_member_description"><p>unblock a read to the device and reset.</p></td> 168<td class="struct_member_annotations"> </td> 169</tr> 170</tbody> 171</table></div> 172</div> 173</div> 174</div> 175<div class="refsect1"> 176<a name="GstAudioSrc.see-also"></a><h2>See Also</h2> 177<p><a class="link" href="GstAudioBaseSrc.html" title="GstAudioBaseSrc"><span class="type">GstAudioBaseSrc</span></a>, <a class="link" href="GstAudioRingBuffer.html" title="GstAudioRingBuffer"><span class="type">GstAudioRingBuffer</span></a>, <a class="link" href="GstAudioSrc.html" title="GstAudioSrc"><span class="type">GstAudioSrc</span></a>.</p> 178</div> 179</div> 180<div class="footer"> 181<hr>Generated by GTK-Doc V1.28</div> 182</body> 183</html>