blob: 5d0509cddb247547b103ab07c5edc08ac7220bb7 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libguac: guacamole/audio.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libguac
&#160;<span id="projectnumber">0.9.14</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_6bb9fad85c98b48a11165f494b9f53ce.html">guacamole</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">audio.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Provides functions and structures used for providing simple streaming audio.
<a href="#details">More...</a></p>
<p><a href="audio_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structguac__audio__encoder.html">guac_audio_encoder</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Arbitrary audio codec encoder. <a href="structguac__audio__encoder.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structguac__audio__stream.html">guac_audio_stream</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Basic audio stream. <a href="structguac__audio__stream.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:afc1fc0133504e718edf4756fac5e9c30"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="audio_8h.html#afc1fc0133504e718edf4756fac5e9c30">guac_audio_stream_alloc</a> (<a class="el" href="structguac__client.html">guac_client</a> *client, <a class="el" href="structguac__audio__encoder.html">guac_audio_encoder</a> *encoder, int rate, int channels, int bps)</td></tr>
<tr class="memdesc:afc1fc0133504e718edf4756fac5e9c30"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allocates a new audio stream at the client level which encodes audio data using the given encoder. <a href="#afc1fc0133504e718edf4756fac5e9c30">More...</a><br /></td></tr>
<tr class="separator:afc1fc0133504e718edf4756fac5e9c30"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0bbd483b1bfe5eede15539a0aacfedad"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="audio_8h.html#a0bbd483b1bfe5eede15539a0aacfedad">guac_audio_stream_reset</a> (<a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *audio, <a class="el" href="structguac__audio__encoder.html">guac_audio_encoder</a> *encoder, int rate, int channels, int bps)</td></tr>
<tr class="memdesc:a0bbd483b1bfe5eede15539a0aacfedad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Resets the given audio stream, switching to the given encoder, rate, channels, and bits per sample. <a href="#a0bbd483b1bfe5eede15539a0aacfedad">More...</a><br /></td></tr>
<tr class="separator:a0bbd483b1bfe5eede15539a0aacfedad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2b8e2f05a19b137454832a5dbc6c3864"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="audio_8h.html#a2b8e2f05a19b137454832a5dbc6c3864">guac_audio_stream_add_user</a> (<a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *audio, <a class="el" href="structguac__user.html">guac_user</a> *user)</td></tr>
<tr class="memdesc:a2b8e2f05a19b137454832a5dbc6c3864"><td class="mdescLeft">&#160;</td><td class="mdescRight">Notifies the given audio stream that a user has joined the connection. <a href="#a2b8e2f05a19b137454832a5dbc6c3864">More...</a><br /></td></tr>
<tr class="separator:a2b8e2f05a19b137454832a5dbc6c3864"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adcc872292b5ba6c39905610b2bccbf31"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="audio_8h.html#adcc872292b5ba6c39905610b2bccbf31">guac_audio_stream_free</a> (<a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *stream)</td></tr>
<tr class="memdesc:adcc872292b5ba6c39905610b2bccbf31"><td class="mdescLeft">&#160;</td><td class="mdescRight">Closes and frees the given audio stream. <a href="#adcc872292b5ba6c39905610b2bccbf31">More...</a><br /></td></tr>
<tr class="separator:adcc872292b5ba6c39905610b2bccbf31"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11bdfee60584106ba85d97a3f8273cc2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="audio_8h.html#a11bdfee60584106ba85d97a3f8273cc2">guac_audio_stream_write_pcm</a> (<a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *stream, const unsigned char *data, int length)</td></tr>
<tr class="memdesc:a11bdfee60584106ba85d97a3f8273cc2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes PCM data to the given audio stream. <a href="#a11bdfee60584106ba85d97a3f8273cc2">More...</a><br /></td></tr>
<tr class="separator:a11bdfee60584106ba85d97a3f8273cc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af75feccacea2b14ee946064cf623f143"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="audio_8h.html#af75feccacea2b14ee946064cf623f143">guac_audio_stream_flush</a> (<a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *stream)</td></tr>
<tr class="memdesc:af75feccacea2b14ee946064cf623f143"><td class="mdescLeft">&#160;</td><td class="mdescRight">Flushes the underlying audio buffer, if any, ensuring that all audio previously written via <a class="el" href="audio_8h.html#a11bdfee60584106ba85d97a3f8273cc2" title="Writes PCM data to the given audio stream. ">guac_audio_stream_write_pcm()</a> has been encoded and sent to the client. <a href="#af75feccacea2b14ee946064cf623f143">More...</a><br /></td></tr>
<tr class="separator:af75feccacea2b14ee946064cf623f143"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Provides functions and structures used for providing simple streaming audio. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a2b8e2f05a19b137454832a5dbc6c3864"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2b8e2f05a19b137454832a5dbc6c3864">&#9670;&nbsp;</a></span>guac_audio_stream_add_user()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void guac_audio_stream_add_user </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *&#160;</td>
<td class="paramname"><em>audio</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structguac__user.html">guac_user</a> *&#160;</td>
<td class="paramname"><em>user</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Notifies the given audio stream that a user has joined the connection. </p>
<p>The audio stream itself may need to be restarted. and the audio stream will need to be created for the new user to ensure they can properly handle future data received along the stream.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">audio</td><td>The <a class="el" href="structguac__audio__stream.html" title="Basic audio stream. ">guac_audio_stream</a> associated with the Guacamole connection being joined.</td></tr>
<tr><td class="paramname">user</td><td>The user that has joined the Guacamole connection. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="afc1fc0133504e718edf4756fac5e9c30"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afc1fc0133504e718edf4756fac5e9c30">&#9670;&nbsp;</a></span>guac_audio_stream_alloc()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="structguac__audio__stream.html">guac_audio_stream</a>* guac_audio_stream_alloc </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structguac__client.html">guac_client</a> *&#160;</td>
<td class="paramname"><em>client</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structguac__audio__encoder.html">guac_audio_encoder</a> *&#160;</td>
<td class="paramname"><em>encoder</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>rate</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>channels</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>bps</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocates a new audio stream at the client level which encodes audio data using the given encoder. </p>
<p>If NULL is specified for the encoder, an appropriate encoder will be selected based on the encoders built into libguac and the level of support declared by users associated with the given <a class="el" href="structguac__client.html" title="Guacamole proxy client. ">guac_client</a>. The PCM format specified here (via rate, channels, and bps) must be the format used for all PCM data provided to the audio stream. The format may only be changed using <a class="el" href="audio_8h.html#a0bbd483b1bfe5eede15539a0aacfedad" title="Resets the given audio stream, switching to the given encoder, rate, channels, and bits per sample...">guac_audio_stream_reset()</a>.</p>
<p>If a new user joins the connection after the audio stream is created, that user will not be aware of the existence of the audio stream, and <a class="el" href="audio_8h.html#a2b8e2f05a19b137454832a5dbc6c3864" title="Notifies the given audio stream that a user has joined the connection. ">guac_audio_stream_add_user()</a> will need to be invoked to recreate the stream for the new user.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">client</td><td>The <a class="el" href="structguac__client.html" title="Guacamole proxy client. ">guac_client</a> for which this audio stream is being allocated. The connection owner is given priority when determining the level of audio support. It is currently assumed that all other joining users on the connection will have the same level of audio support.</td></tr>
<tr><td class="paramname">encoder</td><td>The <a class="el" href="structguac__audio__encoder.html" title="Arbitrary audio codec encoder. ">guac_audio_encoder</a> to use when encoding audio, or NULL if libguac should select an appropriate built-in encoder on its own.</td></tr>
<tr><td class="paramname">rate</td><td>The number of samples per second of PCM data sent to this stream.</td></tr>
<tr><td class="paramname">channels</td><td>The number of audio channels per sample of PCM data. Legal values are 1 or 2.</td></tr>
<tr><td class="paramname">bps</td><td>The number of bits per sample per channel for PCM data. Legal values are 8 or 16.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The newly allocated <a class="el" href="structguac__audio__stream.html" title="Basic audio stream. ">guac_audio_stream</a>, or NULL if no audio stream could be allocated due to lack of support on the part of the connecting Guacamole client. </dd></dl>
</div>
</div>
<a id="af75feccacea2b14ee946064cf623f143"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af75feccacea2b14ee946064cf623f143">&#9670;&nbsp;</a></span>guac_audio_stream_flush()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void guac_audio_stream_flush </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *&#160;</td>
<td class="paramname"><em>stream</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Flushes the underlying audio buffer, if any, ensuring that all audio previously written via <a class="el" href="audio_8h.html#a11bdfee60584106ba85d97a3f8273cc2" title="Writes PCM data to the given audio stream. ">guac_audio_stream_write_pcm()</a> has been encoded and sent to the client. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">stream</td><td>The <a class="el" href="structguac__audio__stream.html" title="Basic audio stream. ">guac_audio_stream</a> whose audio buffers should be flushed. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="adcc872292b5ba6c39905610b2bccbf31"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adcc872292b5ba6c39905610b2bccbf31">&#9670;&nbsp;</a></span>guac_audio_stream_free()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void guac_audio_stream_free </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *&#160;</td>
<td class="paramname"><em>stream</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Closes and frees the given audio stream. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">stream</td><td>The <a class="el" href="structguac__audio__stream.html" title="Basic audio stream. ">guac_audio_stream</a> to free. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a0bbd483b1bfe5eede15539a0aacfedad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0bbd483b1bfe5eede15539a0aacfedad">&#9670;&nbsp;</a></span>guac_audio_stream_reset()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void guac_audio_stream_reset </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *&#160;</td>
<td class="paramname"><em>audio</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structguac__audio__encoder.html">guac_audio_encoder</a> *&#160;</td>
<td class="paramname"><em>encoder</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>rate</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>channels</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>bps</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Resets the given audio stream, switching to the given encoder, rate, channels, and bits per sample. </p>
<p>If NULL is specified for the encoder, the encoder is left unchanged. If the encoder, rate, channels, and bits per sample are all identical to the current settings, this function has no effect.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">audio</td><td>The <a class="el" href="structguac__audio__stream.html" title="Basic audio stream. ">guac_audio_stream</a> to reset.</td></tr>
<tr><td class="paramname">encoder</td><td>The <a class="el" href="structguac__audio__encoder.html" title="Arbitrary audio codec encoder. ">guac_audio_encoder</a> to use when encoding audio, or NULL to leave this unchanged.</td></tr>
<tr><td class="paramname">rate</td><td>The number of samples per second of PCM data sent to this stream.</td></tr>
<tr><td class="paramname">channels</td><td>The number of audio channels per sample of PCM data. Legal values are 1 or 2.</td></tr>
<tr><td class="paramname">bps</td><td>The number of bits per sample per channel for PCM data. Legal values are 8 or 16. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a11bdfee60584106ba85d97a3f8273cc2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a11bdfee60584106ba85d97a3f8273cc2">&#9670;&nbsp;</a></span>guac_audio_stream_write_pcm()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void guac_audio_stream_write_pcm </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structguac__audio__stream.html">guac_audio_stream</a> *&#160;</td>
<td class="paramname"><em>stream</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const unsigned char *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>length</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Writes PCM data to the given audio stream. </p>
<p>This PCM data will be automatically encoded by the audio encoder associated with this stream. The PCM data must be 2-channel, 44100 Hz, with signed 16-bit samples.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">stream</td><td>The <a class="el" href="structguac__audio__stream.html" title="Basic audio stream. ">guac_audio_stream</a> to write PCM data through.</td></tr>
<tr><td class="paramname">data</td><td>The PCM data to write.</td></tr>
<tr><td class="paramname">length</td><td>The number of bytes of PCM data provided. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>