Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > main-testing > by-pkgid > 187676b5433787923dfa2cdd6900c6cd > files > 121

lib64pulseaudio-devel-0.9.15-2.0.7mdv2009.1.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>PulseAudio: Server Query and Control</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="main.html">main</a>&nbsp;&raquo&nbsp;<a class="el" href="async.html">Asynchronous API</a>
  </div>
</div>
<div class="contents">
<h1><a class="anchor" name="introspect">Server Query and Control </a></h1><h2><a class="anchor" name="overv_sec">
Overview</a></h2>
Sometimes it is necessary to query and modify global settings in the server. For this, PulseAudio has the introspection API. It can list sinks, sources, samples and other aspects of the server. It can also modify the attributes of the server that will affect operations on a global level, and not just the application's context.<h2><a class="anchor" name="query_sec">
Querying</a></h2>
All querying is done through callbacks. This design is necessary to maintain an asynchronous design. The client will request the information and some time later, the server will respond with the desired data.<p>
Some objects can have multiple entries at the server. When requesting all of these at once, the callback will be called multiple times, once for each object. When the list has been exhausted, the callback will be called without an information structure and the eol parameter set to a positive value.<p>
Note that even if a single object is requested, and not the entire list, the terminating call will still be made.<p>
If an error occurs, the callback will be called without and information structure and eol set to a negative value..<p>
Data members in the information structures are only valid during the duration of the callback. If they are required after the callback is finished, a deep copy must be performed.<h3><a class="anchor" name="server_subsec">
Server Information</a></h3>
The server can be queried about its name, the environment it's running on and the currently active global defaults. Calling <a class="el" href="introspect_8h.html#6f3bdd9982d9dec70ca5acf6ada3a9a2" title="Get some information about the server.">pa_context_get_server_info()</a> will get access to a <a class="el" href="structpa__server__info.html" title="Server information.">pa_server_info</a> structure containing all of these.<h3><a class="anchor" name="memstat_subsec">
Memory Usage</a></h3>
Statistics about memory usage can be fetched using <a class="el" href="introspect_8h.html#e3eab4bd418ed49d639c6d2e62535e34" title="Get daemon memory block statistics.">pa_context_stat()</a>, giving a <a class="el" href="structpa__stat__info.html" title="Memory block statistics.">pa_stat_info</a> structure.<h3><a class="anchor" name="sinksrc_subsec">
Sinks and Sources</a></h3>
The server can have an arbitrary number of sinks and sources. Each sink and source have both an index and a name associated with it. As such there are three ways to get access to them:<p>
<ul>
<li>By index - <a class="el" href="introspect_8h.html#e886cd4bdc06fa98a61d15f818c33c9f" title="Get information about a sink by its index.">pa_context_get_sink_info_by_index()</a> / <a class="el" href="introspect_8h.html#55f2fbae1ce6b964e65c82c848280c06" title="Get information about a source by its index.">pa_context_get_source_info_by_index()</a> </li>
<li>By name - <a class="el" href="introspect_8h.html#446ffde2b8adea89940adcba40be319c" title="Get information about a sink by its name.">pa_context_get_sink_info_by_name()</a> / <a class="el" href="introspect_8h.html#3904ba3fc9d83355cb84aab0d1cd3e91" title="Get information about a source by its name.">pa_context_get_source_info_by_name()</a> </li>
<li>All - <a class="el" href="introspect_8h.html#77d4044975898442e53b0686501f5713" title="Get the complete sink list.">pa_context_get_sink_info_list()</a> / <a class="el" href="introspect_8h.html#a6663de37d9548ecb057dec5bd542898" title="Get the complete source list.">pa_context_get_source_info_list()</a></li>
</ul>
All three method use the same callback and will provide a <a class="el" href="structpa__sink__info.html" title="Stores information about sinks.">pa_sink_info</a> or <a class="el" href="structpa__source__info.html" title="Stores information about sources.">pa_source_info</a> structure.<h3><a class="anchor" name="siso_subsec">
Sink Inputs and Source Outputs</a></h3>
Sink inputs and source outputs are the representations of the client ends of streams inside the server. I.e. they connect a client stream to one of the global sinks or sources.<p>
Sink inputs and source outputs only have an index to identify them. As such, there are only two ways to get information about them:<p>
<ul>
<li>By index - <a class="el" href="introspect_8h.html#eca4a368510f46dac4313f498583e340" title="Get some information about a sink input by its index.">pa_context_get_sink_input_info()</a> / <a class="el" href="introspect_8h.html#e14eaf111465ea7c8aa2a9b746832b19" title="Get information about a source output by its index.">pa_context_get_source_output_info()</a> </li>
<li>All - <a class="el" href="introspect_8h.html#c232d88f3fca17d4dc9b9af4924de687" title="Get the complete sink input list.">pa_context_get_sink_input_info_list()</a> / <a class="el" href="introspect_8h.html#d57e2d1905a15af524ecccd481abe8e6" title="Get the complete list of source outputs.">pa_context_get_source_output_info_list()</a></li>
</ul>
The structure returned is the <a class="el" href="structpa__sink__input__info.html" title="Stores information about sink inputs.">pa_sink_input_info</a> or <a class="el" href="structpa__source__output__info.html" title="Stores information about source outputs.">pa_source_output_info</a> structure.<h3><a class="anchor" name="samples_subsec">
Samples</a></h3>
The list of cached samples can be retrieved from the server. Three methods exist for querying the sample cache list:<p>
<ul>
<li>By index - <a class="el" href="introspect_8h.html#322e92056dadcf4f5abaa002d6e4034b" title="Get information about a sample by its index.">pa_context_get_sample_info_by_index()</a> </li>
<li>By name - <a class="el" href="introspect_8h.html#755c9d2c30fbd10bf18730f3ddfe1c3e" title="Get information about a sample by its name.">pa_context_get_sample_info_by_name()</a> </li>
<li>All - <a class="el" href="introspect_8h.html#c8219dea1efd6928edacad423ec6e7a6" title="Get the complete list of samples stored in the daemon.">pa_context_get_sample_info_list()</a></li>
</ul>
Note that this only retrieves information about the sample, not the sample data itself.<h3><a class="anchor" name="module_subsec">
Driver Modules</a></h3>
PulseAudio driver modules are identified by index and are retrieved using either <a class="el" href="introspect_8h.html#b911f25494051a09e2ab2b01b483f2e5" title="Get some information about a module by its index.">pa_context_get_module_info()</a> or <a class="el" href="introspect_8h.html#b4895737ae03a4b37d6d69c5fdcfb365" title="Get the complete list of currently loaded modules.">pa_context_get_module_info_list()</a>. The information structure is called <a class="el" href="structpa__module__info.html" title="Stores information about modules.">pa_module_info</a>.<h3><a class="anchor" name="client_subsec">
Clients</a></h3>
PulseAudio clients are also identified by index and are retrieved using either <a class="el" href="introspect_8h.html#824553dc1dcedf3533f0074c78fa22dc" title="Get information about a client by its index.">pa_context_get_client_info()</a> or <a class="el" href="introspect_8h.html#fe9e2194ddebb06fb46836a93cf4a1df" title="Get the complete client list.">pa_context_get_client_info_list()</a>. The information structure is called <a class="el" href="structpa__client__info.html" title="Stores information about clients.">pa_client_info</a>.<h2><a class="anchor" name="ctrl_sec">
Control</a></h2>
Some parts of the server are only possible to read, but most can also be modified in different ways. Note that these changes will affect all connected clients and not just the one issuing the request.<h3><a class="anchor" name="sinksrc_subsec">
Sinks and Sources</a></h3>
The most common change one would want to do to sinks and sources is to modify the volume of the audio. Identical to how sinks and sources can be queried, there are two ways of identifying them:<p>
<ul>
<li>By index - <a class="el" href="introspect_8h.html#22397a278f2e059521800cb94af0e60a" title="Set the volume of a sink device specified by its index.">pa_context_set_sink_volume_by_index()</a> / <a class="el" href="introspect_8h.html#3ea6e197db41f97425baffd3d1fce9a1" title="Set the volume of a source device specified by its index.">pa_context_set_source_volume_by_index()</a> </li>
<li>By name - <a class="el" href="introspect_8h.html#9f326898ea80a5a41e586e50976bbfbb" title="Set the volume of a sink device specified by its name.">pa_context_set_sink_volume_by_name()</a> / <a class="el" href="introspect_8h.html#ec3c4fdf61f019b65c710c9563f9a0e5" title="Set the volume of a source device specified by its name.">pa_context_set_source_volume_by_name()</a></li>
</ul>
It is also possible to mute a sink or source:<p>
<ul>
<li>By index - <a class="el" href="introspect_8h.html#c2b6b66776211d46e651ae9ce1c5aceb" title="Set the mute switch of a sink device specified by its index.">pa_context_set_sink_mute_by_index()</a> / <a class="el" href="introspect_8h.html#d0087f8455adc79943685e777c84af83" title="Set the mute switch of a source device specified by its index.">pa_context_set_source_mute_by_index()</a> </li>
<li>By name - <a class="el" href="introspect_8h.html#96f6f68c8db4571238ff9c5d2d243ef3" title="Set the mute switch of a sink device specified by its name.">pa_context_set_sink_mute_by_name()</a> / <a class="el" href="introspect_8h.html#94425f4fbee323edb5d143f3fccd91ce" title="Set the mute switch of a source device specified by its name.">pa_context_set_source_mute_by_name()</a></li>
</ul>
<h3><a class="anchor" name="siso_subsec">
Sink Inputs and Source Outputs</a></h3>
If an application desires to modify the volume of just a single stream (commonly one of its own streams), this can be done by setting the volume of its associated sink input, using <a class="el" href="introspect_8h.html#825ccd9e00765c0d397e2341086586ff" title="Set the volume of a sink input stream.">pa_context_set_sink_input_volume()</a>.<p>
There is no support for modifying the volume of source outputs.<p>
It is also possible to remove sink inputs and source outputs, terminating the streams associated with them:<p>
<ul>
<li>Sink input - <a class="el" href="introspect_8h.html#f832875e5c5d8a57ef044dc156db73bd" title="Kill a sink input.">pa_context_kill_sink_input()</a> </li>
<li>Source output - <a class="el" href="introspect_8h.html#fb3c80b1aaafafa846ceacd2d2bb4b39" title="Kill a source output.">pa_context_kill_source_output()</a></li>
</ul>
<h3><a class="anchor" name="module_subsec">
Driver Modules</a></h3>
Server modules can be remotely loaded and unloaded using <a class="el" href="introspect_8h.html#4956ff4408e939c2b6fae9b76a86f05c" title="Load a module.">pa_context_load_module()</a> and <a class="el" href="introspect_8h.html#14a91adee752a5bec98e4846971b4802" title="Unload a module.">pa_context_unload_module()</a>.<h3><a class="anchor" name="client_subsec">
Clients</a></h3>
The only operation supported on clients, is the possibility of kicking them off the server using <a class="el" href="introspect_8h.html#c81ed66b6bb184d1474a12cc2a5debc6" title="Kill a client.">pa_context_kill_client()</a>. </div>
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Sep 2 04:18:20 2009 for PulseAudio by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>