Current File : //proc/self/root/kunden/kunden/usr/share/doc/pulseaudio-libs-devel/html/scache.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PulseAudio: Sample Cache</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="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.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">PulseAudio
 <span id="projectnumber">15.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('scache.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">Sample Cache </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="overv_sec"></a>
Overview</h1>
<p>The sample cache provides a simple way of overcoming high network latencies and reducing bandwidth. Instead of streaming a sound precisely when it should be played, it is stored on the server and only the command to start playing it needs to be sent.</p>
<h1><a class="anchor" id="create_sec"></a>
Creation</h1>
<p>To create a sample, the normal stream API is used (see <a class="el" href="streams.html">Audio Streams</a>). The function <a class="el" href="scache_8h.html#a4725d83c96ddb3a4c67954bf5ec3a8c1" title="Make this stream a sample upload stream.">pa_stream_connect_upload()</a> will make sure the stream is stored as a sample on the server.</p>
<p>To complete the upload, <a class="el" href="scache_8h.html#a892d5d35de5ec726b8fa151abd87b92b" title="Finish the sample upload, the stream name will become the sample name.">pa_stream_finish_upload()</a> is called and the sample will receive the same name as the stream. If the upload should be aborted, simply call <a class="el" href="stream_8h.html#aa4e0c83264f3935911e6b30e6f8ef2b1" title="Disconnect a stream from a source/sink.">pa_stream_disconnect()</a>.</p>
<h1><a class="anchor" id="play_sec"></a>
Playing samples</h1>
<p>To play back a sample, simply call <a class="el" href="scache_8h.html#adb1bf81ecef03f8bae77e5e3ab30464f" title="Play a sample from the sample cache to the specified device.">pa_context_play_sample()</a>:</p>
<div class="fragment"><div class="line"><a class="code" href="operation_8h.html#a5614a07f2e7a129e4cb16596ed452a0c">pa_operation</a> *o;</div>
<div class="line"> </div>
<div class="line">o = <a class="code" href="scache_8h.html#adb1bf81ecef03f8bae77e5e3ab30464f">pa_context_play_sample</a>(my_context,</div>
<div class="line"> <span class="stringliteral">"sample2"</span>, <span class="comment">// Name of my sample</span></div>
<div class="line"> NULL, <span class="comment">// Use default sink</span></div>
<div class="line"> <a class="code" href="volume_8h.html#aded56902e68e0f8ab576339bde55960e">PA_VOLUME_NORM</a>, <span class="comment">// Full volume</span></div>
<div class="line"> NULL, <span class="comment">// Don't need a callback</span></div>
<div class="line"> NULL</div>
<div class="line"> );</div>
<div class="line"><span class="keywordflow">if</span> (o)</div>
<div class="line"> <a class="code" href="operation_8h.html#a8d2ef9bb2ff961ee31675882bf125227">pa_operation_unref</a>(o);</div>
<div class="ttc" id="aoperation_8h_html_a5614a07f2e7a129e4cb16596ed452a0c"><div class="ttname"><a href="operation_8h.html#a5614a07f2e7a129e4cb16596ed452a0c">pa_operation</a></div><div class="ttdeci">struct pa_operation pa_operation</div><div class="ttdoc">An asynchronous operation object.</div><div class="ttdef"><b>Definition:</b> operation.h:33</div></div>
<div class="ttc" id="aoperation_8h_html_a8d2ef9bb2ff961ee31675882bf125227"><div class="ttname"><a href="operation_8h.html#a8d2ef9bb2ff961ee31675882bf125227">pa_operation_unref</a></div><div class="ttdeci">void pa_operation_unref(pa_operation *o)</div><div class="ttdoc">Decrease the reference count by one.</div></div>
<div class="ttc" id="ascache_8h_html_adb1bf81ecef03f8bae77e5e3ab30464f"><div class="ttname"><a href="scache_8h.html#adb1bf81ecef03f8bae77e5e3ab30464f">pa_context_play_sample</a></div><div class="ttdeci">pa_operation * pa_context_play_sample(pa_context *c, const char *name, const char *dev, pa_volume_t volume, pa_context_success_cb_t cb, void *userdata)</div><div class="ttdoc">Play a sample from the sample cache to the specified device.</div></div>
<div class="ttc" id="avolume_8h_html_aded56902e68e0f8ab576339bde55960e"><div class="ttname"><a href="volume_8h.html#aded56902e68e0f8ab576339bde55960e">PA_VOLUME_NORM</a></div><div class="ttdeci">#define PA_VOLUME_NORM</div><div class="ttdoc">Normal volume (100%, 0 dB)</div><div class="ttdef"><b>Definition:</b> volume.h:120</div></div>
</div><!-- fragment --><h1><a class="anchor" id="rem_sec"></a>
Removing samples</h1>
<p>When a sample is no longer needed, it should be removed on the server to save resources. The sample is deleted using <a class="el" href="scache_8h.html#a8c5e594fd912cd5badab7804eae22ba9" title="Remove a sample from the sample cache.">pa_context_remove_sample()</a>. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="index.html">index</a></li><li class="navelem"><a class="el" href="async.html">Asynchronous API</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>