1 module pulse.introspect;
2 
3 version(linux):
4 
5 import pulse.def;
6 import pulse.sample;
7 import pulse.channelmap;
8 import pulse.volume;
9 import pulse.operation;
10 import pulse.context;
11 import pulse.proplist;
12 import pulse.format;
13 
14 
15 extern (C):
16 
17 /***
18   This file is part of PulseAudio.
19 
20   Copyright 2004-2006 Lennart Poettering
21   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
22 
23   PulseAudio is free software; you can redistribute it and/or modify
24   it under the terms of the GNU Lesser General Public License as published
25   by the Free Software Foundation; either version 2.1 of the License,
26   or (at your option) any later version.
27 
28   PulseAudio is distributed in the hope that it will be useful, but
29   WITHOUT ANY WARRANTY; without even the implied warranty of
30   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31   General Public License for more details.
32 
33   You should have received a copy of the GNU Lesser General Public License
34   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
35 ***/
36 
37 /** \page introspect Server Query and Control
38  *
39  * \section overv_sec Overview
40  *
41  * Sometimes it is necessary to query and modify global settings in the
42  * server. For this, PulseAudio has the introspection API. It can list sinks,
43  * sources, samples and other aspects of the server. It can also modify the
44  * attributes of the server that will affect operations on a global level,
45  * and not just the application's context.
46  *
47  * \section query_sec Querying
48  *
49  * All querying is done through callbacks. This approach is necessary to
50  * maintain an asynchronous design. The client will request the information
51  * and some time later, the server will respond with the desired data.
52  *
53  * Some objects can have multiple instances on the server. When requesting all
54  * of these at once, the callback will be called multiple times, once for
55  * each object. When the list has been exhausted, the callback will be called
56  * without an information structure and the eol parameter set to a positive
57  * value.
58  *
59  * Note that even if a single object is requested, and not the entire list,
60  * the terminating call will still be made.
61  *
62  * If an error occurs, the callback will be invoked without an information
63  * structure and eol set to a negative value..
64  *
65  * Data members in the information structures are only valid during the
66  * duration of the callback. If they are required after the callback is
67  * finished, a deep copy of the information structure must be performed.
68  *
69  * \subsection server_subsec Server Information
70  *
71  * The server can be queried about its name, the environment it's running on
72  * and the currently active global defaults. Calling
73  * pa_context_get_server_info() provides access to a pa_server_info structure
74  * containing all of these.
75  *
76  * \subsection memstat_subsec Memory Usage
77  *
78  * Statistics about memory usage can be fetched using pa_context_stat(),
79  * giving a pa_stat_info structure.
80  *
81  * \subsection sinksrc_subsec Sinks and Sources
82  *
83  * The server can have an arbitrary number of sinks and sources. Each sink
84  * and source have both an index and a name associated with it. As such,
85  * there are three ways to get access to them:
86  *
87  * \li By index - pa_context_get_sink_info_by_index() /
88  *                pa_context_get_source_info_by_index()
89  * \li By name - pa_context_get_sink_info_by_name() /
90  *               pa_context_get_source_info_by_name()
91  * \li All - pa_context_get_sink_info_list() /
92  *           pa_context_get_source_info_list()
93  *
94  * All three method use the same callback and will provide a pa_sink_info or
95  * pa_source_info structure.
96  *
97  * \subsection siso_subsec Sink Inputs and Source Outputs
98  *
99  * Sink inputs and source outputs are the representations of the client ends
100  * of streams inside the server. I.e. they connect a client stream to one of
101  * the global sinks or sources.
102  *
103  * Sink inputs and source outputs only have an index to identify them. As
104  * such, there are only two ways to get information about them:
105  *
106  * \li By index - pa_context_get_sink_input_info() /
107  *                pa_context_get_source_output_info()
108  * \li All - pa_context_get_sink_input_info_list() /
109  *           pa_context_get_source_output_info_list()
110  *
111  * The structure returned is the pa_sink_input_info or pa_source_output_info
112  * structure.
113  *
114  * \subsection samples_subsec Samples
115  *
116  * The list of cached samples can be retrieved from the server. Three methods
117  * exist for querying the sample cache list:
118  *
119  * \li By index - pa_context_get_sample_info_by_index()
120  * \li By name - pa_context_get_sample_info_by_name()
121  * \li All - pa_context_get_sample_info_list()
122  *
123  * Note that this only retrieves information about the sample, not the sample
124  * data itself.
125  *
126  * \subsection module_subsec Driver Modules
127  *
128  * PulseAudio driver modules are identified by index and are retrieved using either
129  * pa_context_get_module_info() or pa_context_get_module_info_list(). The
130  * information structure is called pa_module_info.
131  *
132  * \subsection client_subsec Clients
133  *
134  * PulseAudio clients are also identified by index and are retrieved using
135  * either pa_context_get_client_info() or pa_context_get_client_info_list().
136  * The information structure is called pa_client_info.
137  *
138  * \section ctrl_sec Control
139  *
140  * Some parts of the server are only possible to read, but most can also be
141  * modified in different ways. Note that these changes will affect all
142  * connected clients and not just the one issuing the request.
143  *
144  * \subsection sinksrc_subsec Sinks and Sources
145  *
146  * The most common change one would want to apply to sinks and sources is to
147  * modify the volume of the audio. Identically to how sinks and sources can
148  * be queried, there are two ways of identifying them:
149  *
150  * \li By index - pa_context_set_sink_volume_by_index() /
151  *                pa_context_set_source_volume_by_index()
152  * \li By name - pa_context_set_sink_volume_by_name() /
153  *               pa_context_set_source_volume_by_name()
154  *
155  * It is also possible to mute a sink or source:
156  *
157  * \li By index - pa_context_set_sink_mute_by_index() /
158  *                pa_context_set_source_mute_by_index()
159  * \li By name - pa_context_set_sink_mute_by_name() /
160  *               pa_context_set_source_mute_by_name()
161  *
162  * \subsection siso_subsec Sink Inputs and Source Outputs
163  *
164  * If an application desires to modify the volume of just a single stream
165  * (commonly one of its own streams), this can be done by setting the volume
166  * of its associated sink input or source output, using
167  * pa_context_set_sink_input_volume() or pa_context_set_source_output_volume().
168  *
169  * It is also possible to remove sink inputs and source outputs, terminating
170  * the streams associated with them:
171  *
172  * \li Sink input - pa_context_kill_sink_input()
173  * \li Source output - pa_context_kill_source_output()
174  *
175  * It is strongly recommended that all volume changes are done as a direct
176  * result of user input. With automated requests, such as those resulting
177  * from misguided attempts of crossfading, PulseAudio can store the stream
178  * volume at an inappropriate moment and restore it later. Besides, such
179  * attempts lead to OSD popups in some desktop environments.
180  *
181  * As a special case of the general rule above, it is recommended that your
182  * application leaves the task of saving and restoring the volume of its
183  * streams to PulseAudio and does not attempt to do it by itself. PulseAudio
184  * really knows better about events such as stream moving or headphone
185  * plugging that would make the volume stored by the application inapplicable
186  * to the new configuration.
187  *
188  * Another important case where setting a sink input volume may be a bad idea
189  * is related to interpreters that interpret potentially untrusted scripts.
190  * PulseAudio relies on your application not making malicious requests (such
191  * as repeatedly setting the volume to 100%). Thus, script interpreters that
192  * represent a security boundary must sandbox volume-changing requests coming
193  * from their scripts. In the worst case, it may be necessary to apply the
194  * script-requested volume to the script-produced sounds by altering the
195  * samples in the script interpreter and not touching the sink or sink input
196  * volume as seen by PulseAudio.
197  *
198  * If an application changes any volume, it should also listen to changes of
199  * the same volume originating from outside the application (e.g., from the
200  * system mixer application) and update its user interface accordingly. Use
201  * \ref subscribe to get such notifications.
202  *
203  * \subsection module_subsec Modules
204  *
205  * Server modules can be remotely loaded and unloaded using
206  * pa_context_load_module() and pa_context_unload_module().
207  *
208  * \subsection message_subsec Messages
209  *
210  * Server objects like sinks, sink inputs or modules can register a message
211  * handler to communicate with clients. A message can be sent to a named
212  * message handler using pa_context_send_message_to_object().
213  *
214  * \subsection client_subsec Clients
215  *
216  * The only operation supported on clients is the possibility of kicking
217  * them off the server using pa_context_kill_client().
218  */
219 
220 /** \file
221  *
222  * Routines for daemon introspection.
223  *
224  * See also \subpage introspect
225  */
226 
227 /** @{ \name Sinks */
228 
229 /** Stores information about a specific port of a sink.  Please
230  * note that this structure can be extended as part of evolutionary
231  * API updates at any time in any new release. \since 0.9.16 */
232 struct pa_sink_port_info
233 {
234     const(char)* name; /**< Name of this port */
235     const(char)* description; /**< Description of this port */
236     uint priority; /**< The higher this value is, the more useful this port is as a default. */
237     int available; /**< A flags (see #pa_port_available), indicating availability status of this port. \since 2.0 */
238     const(char)* availability_group; /**< An indentifier for the group of ports that share their availability status with
239      * each other. This is meant especially for handling cases where one 3.5 mm connector
240      * is used for headphones, headsets and microphones, and the hardware can only tell
241      * that something was plugged in but not what exactly. In this situation the ports for
242      * all those devices share their availability status, and PulseAudio can't tell which
243      * one is actually plugged in, and some application may ask the user what was plugged
244      * in. Such applications should get a list of all card ports and compare their
245      * `availability_group` fields. Ports that have the same group are those that need
246      * input from the user to determine which device was plugged in. The application should
247      * then activate the user-chosen port.
248      *
249      * May be NULL, in which case the port is not part of any availability group.
250      *
251      * The group identifier must be treated as an opaque identifier. The string may look
252      * like an ALSA control name, but applications must not assume any such relationship.
253      * The group naming scheme can change without a warning.
254      *
255      * Since one group can include both input and output ports, the grouping should be done
256      * using pa_card_port_info instead of pa_sink_port_info, but this field is duplicated
257      * also in pa_sink_port_info (and pa_source_port_info) in case someone finds that
258      * convenient.
259      *
260      * \since 14.0 */
261     uint type; /**< Port type, see #pa_device_port_type. \since 14.0 */
262 }
263 
264 /** Stores information about sinks. Please note that this structure
265  * can be extended as part of evolutionary API updates at any time in
266  * any new release. */
267 struct pa_sink_info
268 {
269     const(char)* name; /**< Name of the sink */
270     uint index; /**< Index of the sink */
271     const(char)* description; /**< Description of this sink */
272     pa_sample_spec sample_spec; /**< Sample spec of this sink */
273     pa_channel_map channel_map; /**< Channel map */
274     uint owner_module; /**< Index of the owning module of this sink, or PA_INVALID_INDEX. */
275     pa_cvolume volume; /**< Volume of the sink */
276     int mute; /**< Mute switch of the sink */
277     uint monitor_source; /**< Index of the monitor source connected to this sink. */
278     const(char)* monitor_source_name; /**< The name of the monitor source. */
279     pa_usec_t latency; /**< Length of queued audio in the output buffer. */
280     const(char)* driver; /**< Driver name */
281     pa_sink_flags_t flags; /**< Flags */
282     pa_proplist* proplist; /**< Property list \since 0.9.11 */
283     pa_usec_t configured_latency; /**< The latency this device has been configured to. \since 0.9.11 */
284     pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the output device. \since 0.9.15 */
285     pa_sink_state_t state; /**< State \since 0.9.15 */
286     uint n_volume_steps; /**< Number of volume steps for sinks which do not support arbitrary volumes. \since 0.9.15 */
287     uint card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
288     uint n_ports; /**< Number of entries in port array \since 0.9.16 */
289     pa_sink_port_info** ports; /**< Array of available ports, or NULL. Array is terminated by an entry set to NULL. The number of entries is stored in n_ports. \since 0.9.16 */
290     pa_sink_port_info* active_port; /**< Pointer to active port in the array, or NULL. \since 0.9.16 */
291     ubyte n_formats; /**< Number of formats supported by the sink. \since 1.0 */
292     pa_format_info** formats; /**< Array of formats supported by the sink. \since 1.0 */
293 }
294 
295 /** Callback prototype for pa_context_get_sink_info_by_name() and friends */
296 alias pa_sink_info_cb_t = void function (pa_context* c, const(pa_sink_info)* i, int eol, void* userdata);
297 
298 /** Get information about a sink by its name */
299 pa_operation* pa_context_get_sink_info_by_name (pa_context* c, const(char)* name, pa_sink_info_cb_t cb, void* userdata);
300 
301 /** Get information about a sink by its index */
302 pa_operation* pa_context_get_sink_info_by_index (pa_context* c, uint idx, pa_sink_info_cb_t cb, void* userdata);
303 
304 /** Get the complete sink list */
305 pa_operation* pa_context_get_sink_info_list (pa_context* c, pa_sink_info_cb_t cb, void* userdata);
306 
307 /** Set the volume of a sink device specified by its index */
308 pa_operation* pa_context_set_sink_volume_by_index (pa_context* c, uint idx, const(pa_cvolume)* volume, pa_context_success_cb_t cb, void* userdata);
309 
310 /** Set the volume of a sink device specified by its name */
311 pa_operation* pa_context_set_sink_volume_by_name (pa_context* c, const(char)* name, const(pa_cvolume)* volume, pa_context_success_cb_t cb, void* userdata);
312 
313 /** Set the mute switch of a sink device specified by its index */
314 pa_operation* pa_context_set_sink_mute_by_index (pa_context* c, uint idx, int mute, pa_context_success_cb_t cb, void* userdata);
315 
316 /** Set the mute switch of a sink device specified by its name */
317 pa_operation* pa_context_set_sink_mute_by_name (pa_context* c, const(char)* name, int mute, pa_context_success_cb_t cb, void* userdata);
318 
319 /** Suspend/Resume a sink. \since 0.9.7 */
320 pa_operation* pa_context_suspend_sink_by_name (pa_context* c, const(char)* sink_name, int suspend, pa_context_success_cb_t cb, void* userdata);
321 
322 /** Suspend/Resume a sink. If idx is PA_INVALID_INDEX all sinks will be suspended. \since 0.9.7 */
323 pa_operation* pa_context_suspend_sink_by_index (pa_context* c, uint idx, int suspend, pa_context_success_cb_t cb, void* userdata);
324 
325 /** Change the profile of a sink. \since 0.9.16 */
326 pa_operation* pa_context_set_sink_port_by_index (pa_context* c, uint idx, const(char)* port, pa_context_success_cb_t cb, void* userdata);
327 
328 /** Change the profile of a sink. \since 0.9.15 */
329 pa_operation* pa_context_set_sink_port_by_name (pa_context* c, const(char)* name, const(char)* port, pa_context_success_cb_t cb, void* userdata);
330 
331 /** @} */
332 
333 /** @{ \name Sources */
334 
335 /** Stores information about a specific port of a source.  Please
336  * note that this structure can be extended as part of evolutionary
337  * API updates at any time in any new release. \since 0.9.16 */
338 struct pa_source_port_info
339 {
340     const(char)* name; /**< Name of this port */
341     const(char)* description; /**< Description of this port */
342     uint priority; /**< The higher this value is, the more useful this port is as a default. */
343     int available; /**< A flags (see #pa_port_available), indicating availability status of this port. \since 2.0 */
344     const(char)* availability_group; /**< An indentifier for the group of ports that share their availability status with
345      * each other. This is meant especially for handling cases where one 3.5 mm connector
346      * is used for headphones, headsets and microphones, and the hardware can only tell
347      * that something was plugged in but not what exactly. In this situation the ports for
348      * all those devices share their availability status, and PulseAudio can't tell which
349      * one is actually plugged in, and some application may ask the user what was plugged
350      * in. Such applications should get a list of all card ports and compare their
351      * `availability_group` fields. Ports that have the same group are those that need
352      * input from the user to determine which device was plugged in. The application should
353      * then activate the user-chosen port.
354      *
355      * May be NULL, in which case the port is not part of any availability group (which is
356      * the same as having a group with only one member).
357      *
358      * The group identifier must be treated as an opaque identifier. The string may look
359      * like an ALSA control name, but applications must not assume any such relationship.
360      * The group naming scheme can change without a warning.
361      *
362      * Since one group can include both input and output ports, the grouping should be done
363      * using pa_card_port_info instead of pa_source_port_info, but this field is duplicated
364      * also in pa_source_port_info (and pa_sink_port_info) in case someone finds that
365      * convenient.
366      *
367      * \since 14.0 */
368     uint type; /**< Port type, see #pa_device_port_type. \since 14.0 */
369 }
370 
371 /** Stores information about sources. Please note that this structure
372  * can be extended as part of evolutionary API updates at any time in
373  * any new release. */
374 struct pa_source_info
375 {
376     const(char)* name; /**< Name of the source */
377     uint index; /**< Index of the source */
378     const(char)* description; /**< Description of this source */
379     pa_sample_spec sample_spec; /**< Sample spec of this source */
380     pa_channel_map channel_map; /**< Channel map */
381     uint owner_module; /**< Owning module index, or PA_INVALID_INDEX. */
382     pa_cvolume volume; /**< Volume of the source */
383     int mute; /**< Mute switch of the sink */
384     uint monitor_of_sink; /**< If this is a monitor source, the index of the owning sink, otherwise PA_INVALID_INDEX. */
385     const(char)* monitor_of_sink_name; /**< Name of the owning sink, or NULL. */
386     pa_usec_t latency; /**< Length of filled record buffer of this source. */
387     const(char)* driver; /**< Driver name */
388     pa_source_flags_t flags; /**< Flags */
389     pa_proplist* proplist; /**< Property list \since 0.9.11 */
390     pa_usec_t configured_latency; /**< The latency this device has been configured to. \since 0.9.11 */
391     pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the input device. \since 0.9.15 */
392     pa_source_state_t state; /**< State \since 0.9.15 */
393     uint n_volume_steps; /**< Number of volume steps for sources which do not support arbitrary volumes. \since 0.9.15 */
394     uint card; /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
395     uint n_ports; /**< Number of entries in port array \since 0.9.16 */
396     pa_source_port_info** ports; /**< Array of available ports, or NULL. Array is terminated by an entry set to NULL. The number of entries is stored in n_ports. \since 0.9.16  */
397     pa_source_port_info* active_port; /**< Pointer to active port in the array, or NULL. \since 0.9.16  */
398     ubyte n_formats; /**< Number of formats supported by the source. \since 1.0 */
399     pa_format_info** formats; /**< Array of formats supported by the source. \since 1.0 */
400 }
401 
402 /** Callback prototype for pa_context_get_source_info_by_name() and friends */
403 alias pa_source_info_cb_t = void function (pa_context* c, const(pa_source_info)* i, int eol, void* userdata);
404 
405 /** Get information about a source by its name */
406 pa_operation* pa_context_get_source_info_by_name (pa_context* c, const(char)* name, pa_source_info_cb_t cb, void* userdata);
407 
408 /** Get information about a source by its index */
409 pa_operation* pa_context_get_source_info_by_index (pa_context* c, uint idx, pa_source_info_cb_t cb, void* userdata);
410 
411 /** Get the complete source list */
412 pa_operation* pa_context_get_source_info_list (pa_context* c, pa_source_info_cb_t cb, void* userdata);
413 
414 /** Set the volume of a source device specified by its index */
415 pa_operation* pa_context_set_source_volume_by_index (pa_context* c, uint idx, const(pa_cvolume)* volume, pa_context_success_cb_t cb, void* userdata);
416 
417 /** Set the volume of a source device specified by its name */
418 pa_operation* pa_context_set_source_volume_by_name (pa_context* c, const(char)* name, const(pa_cvolume)* volume, pa_context_success_cb_t cb, void* userdata);
419 
420 /** Set the mute switch of a source device specified by its index */
421 pa_operation* pa_context_set_source_mute_by_index (pa_context* c, uint idx, int mute, pa_context_success_cb_t cb, void* userdata);
422 
423 /** Set the mute switch of a source device specified by its name */
424 pa_operation* pa_context_set_source_mute_by_name (pa_context* c, const(char)* name, int mute, pa_context_success_cb_t cb, void* userdata);
425 
426 /** Suspend/Resume a source. \since 0.9.7 */
427 pa_operation* pa_context_suspend_source_by_name (pa_context* c, const(char)* source_name, int suspend, pa_context_success_cb_t cb, void* userdata);
428 
429 /** Suspend/Resume a source. If idx is PA_INVALID_INDEX, all sources will be suspended. \since 0.9.7 */
430 pa_operation* pa_context_suspend_source_by_index (pa_context* c, uint idx, int suspend, pa_context_success_cb_t cb, void* userdata);
431 
432 /** Change the profile of a source. \since 0.9.16 */
433 pa_operation* pa_context_set_source_port_by_index (pa_context* c, uint idx, const(char)* port, pa_context_success_cb_t cb, void* userdata);
434 
435 /** Change the profile of a source. \since 0.9.15 */
436 pa_operation* pa_context_set_source_port_by_name (pa_context* c, const(char)* name, const(char)* port, pa_context_success_cb_t cb, void* userdata);
437 
438 /** @} */
439 
440 /** @{ \name Server */
441 
442 /** Server information. Please note that this structure can be
443  * extended as part of evolutionary API updates at any time in any new
444  * release. */
445 struct pa_server_info
446 {
447     const(char)* user_name; /**< User name of the daemon process */
448     const(char)* host_name; /**< Host name the daemon is running on */
449     const(char)* server_version; /**< Version string of the daemon */
450     const(char)* server_name; /**< Server package name (usually "pulseaudio") */
451     pa_sample_spec sample_spec; /**< Default sample specification */
452     const(char)* default_sink_name; /**< Name of default sink. */
453     const(char)* default_source_name; /**< Name of default source. */
454     uint cookie; /**< A random cookie for identifying this instance of PulseAudio. */
455     pa_channel_map channel_map; /**< Default channel map. \since 0.9.15 */
456 }
457 
458 /** Callback prototype for pa_context_get_server_info() */
459 alias pa_server_info_cb_t = void function (pa_context* c, const(pa_server_info)* i, void* userdata);
460 
461 /** Get some information about the server */
462 pa_operation* pa_context_get_server_info (pa_context* c, pa_server_info_cb_t cb, void* userdata);
463 
464 /** @} */
465 
466 /** @{ \name Modules */
467 
468 /** Stores information about modules. Please note that this structure
469  * can be extended as part of evolutionary API updates at any time in
470  * any new release. */
471 struct pa_module_info
472 {
473     uint index; /**< Index of the module */
474     const(char)* name; /**< Name of the module */
475     const(char)* argument; /**< Argument string of the module */
476     uint n_used; /**< Usage counter or PA_INVALID_INDEX */
477     /** \cond fulldocs */
478     int auto_unload; /**< \deprecated Non-zero if this is an autoloaded module. */
479     /** \endcond */
480     pa_proplist* proplist; /**< Property list \since 0.9.15 */
481 }
482 
483 /** Callback prototype for pa_context_get_module_info() and friends */
484 alias pa_module_info_cb_t = void function (pa_context* c, const(pa_module_info)* i, int eol, void* userdata);
485 
486 /** Get some information about a module by its index */
487 pa_operation* pa_context_get_module_info (pa_context* c, uint idx, pa_module_info_cb_t cb, void* userdata);
488 
489 /** Get the complete list of currently loaded modules */
490 pa_operation* pa_context_get_module_info_list (pa_context* c, pa_module_info_cb_t cb, void* userdata);
491 
492 /** Callback prototype for pa_context_load_module() */
493 alias pa_context_index_cb_t = void function (pa_context* c, uint idx, void* userdata);
494 
495 /** Load a module. */
496 pa_operation* pa_context_load_module (pa_context* c, const(char)* name, const(char)* argument, pa_context_index_cb_t cb, void* userdata);
497 
498 /** Unload a module. */
499 pa_operation* pa_context_unload_module (pa_context* c, uint idx, pa_context_success_cb_t cb, void* userdata);
500 
501 /** @} */
502 
503 /** @{ \name Messages */
504 
505 /** Callback prototype for pa_context_send_message_to_object() \since 15.0 */
506 alias pa_context_string_cb_t = void function (pa_context* c, int success, char* response, void* userdata);
507 
508 /** Send a message to an object that registered a message handler. For more information
509  * see https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/doc/messaging_api.txt. \since 15.0 */
510 pa_operation* pa_context_send_message_to_object (pa_context* c, const(char)* recipient_name, const(char)* message, const(char)* message_parameters, pa_context_string_cb_t cb, void* userdata);
511 
512 /** @} */
513 
514 /** @{ \name Clients */
515 
516 /** Stores information about clients. Please note that this structure
517  * can be extended as part of evolutionary API updates at any time in
518  * any new release. */
519 struct pa_client_info
520 {
521     uint index; /**< Index of this client */
522     const(char)* name; /**< Name of this client */
523     uint owner_module; /**< Index of the owning module, or PA_INVALID_INDEX. */
524     const(char)* driver; /**< Driver name */
525     pa_proplist* proplist; /**< Property list \since 0.9.11 */
526 }
527 
528 /** Callback prototype for pa_context_get_client_info() and friends */
529 alias pa_client_info_cb_t = void function (pa_context* c, const(pa_client_info)* i, int eol, void* userdata);
530 
531 /** Get information about a client by its index */
532 pa_operation* pa_context_get_client_info (pa_context* c, uint idx, pa_client_info_cb_t cb, void* userdata);
533 
534 /** Get the complete client list */
535 pa_operation* pa_context_get_client_info_list (pa_context* c, pa_client_info_cb_t cb, void* userdata);
536 
537 /** Kill a client. */
538 pa_operation* pa_context_kill_client (pa_context* c, uint idx, pa_context_success_cb_t cb, void* userdata);
539 
540 /** @} */
541 
542 /** @{ \name Cards */
543 
544 /** \deprecated Superseded by pa_card_profile_info2 \since 0.9.15 */
545 struct pa_card_profile_info
546 {
547     const(char)* name; /**< Name of this profile */
548     const(char)* description; /**< Description of this profile */
549     uint n_sinks; /**< Number of sinks this profile would create */
550     uint n_sources; /**< Number of sources this profile would create */
551     uint priority; /**< The higher this value is, the more useful this profile is as a default. */
552 }
553 
554 /** Stores information about a specific profile of a card. Please
555  * note that this structure can be extended as part of evolutionary
556  * API updates at any time in any new release. \since 5.0 */
557 struct pa_card_profile_info2
558 {
559     const(char)* name; /**< Name of this profile */
560     const(char)* description; /**< Description of this profile */
561     uint n_sinks; /**< Number of sinks this profile would create */
562     uint n_sources; /**< Number of sources this profile would create */
563     uint priority; /**< The higher this value is, the more useful this profile is as a default. */
564     int available;
565     /**< Is this profile available? If this is zero, meaning "unavailable",
566      * then it makes no sense to try to activate this profile. If this is
567      * non-zero, it's still not a guarantee that activating the profile will
568      * result in anything useful, it just means that the server isn't aware of
569      * any reason why the profile would definitely be useless. \since 5.0 */
570 }
571 
572 /** Stores information about a specific port of a card.  Please
573  * note that this structure can be extended as part of evolutionary
574  * API updates at any time in any new release. \since 2.0 */
575 struct pa_card_port_info
576 {
577     const(char)* name; /**< Name of this port */
578     const(char)* description; /**< Description of this port */
579     uint priority; /**< The higher this value is, the more useful this port is as a default. */
580     int available; /**< A #pa_port_available enum, indicating availability status of this port. */
581     int direction; /**< A #pa_direction enum, indicating the direction of this port. */
582     uint n_profiles; /**< Number of entries in profile array */
583     pa_card_profile_info** profiles; /**< \deprecated Superseded by profiles2 */
584     pa_proplist* proplist; /**< Property list */
585     long latency_offset; /**< Latency offset of the port that gets added to the sink/source latency when the port is active. \since 3.0 */
586     pa_card_profile_info2** profiles2; /**< Array of pointers to available profiles, or NULL. Array is terminated by an entry set to NULL. \since 5.0 */
587     const(char)* availability_group; /**< An indentifier for the group of ports that share their availability status with
588      * each other. This is meant especially for handling cases where one 3.5 mm connector
589      * is used for headphones, headsets and microphones, and the hardware can only tell
590      * that something was plugged in but not what exactly. In this situation the ports for
591      * all those devices share their availability status, and PulseAudio can't tell which
592      * one is actually plugged in, and some application may ask the user what was plugged
593      * in. Such applications should get a list of all card ports and compare their
594      * `availability_group` fields. Ports that have the same group are those that need
595      * input from the user to determine which device was plugged in. The application should
596      * then activate the user-chosen port.
597      *
598      * May be NULL, in which case the port is not part of any availability group (which is
599      * the same as having a group with only one member).
600      *
601      * The group identifier must be treated as an opaque identifier. The string may look
602      * like an ALSA control name, but applications must not assume any such relationship.
603      * The group naming scheme can change without a warning.
604      *
605      * \since 14.0 */
606     uint type; /**< Port type, see #pa_device_port_type. \since 14.0 */
607 }
608 
609 /** Stores information about cards. Please note that this structure
610  * can be extended as part of evolutionary API updates at any time in
611  * any new release.  \since 0.9.15 */
612 struct pa_card_info
613 {
614     uint index; /**< Index of this card */
615     const(char)* name; /**< Name of this card */
616     uint owner_module; /**< Index of the owning module, or PA_INVALID_INDEX. */
617     const(char)* driver; /**< Driver name */
618     uint n_profiles; /**< Number of entries in profile array */
619     pa_card_profile_info* profiles; /**< \deprecated Superseded by profiles2 */
620     pa_card_profile_info* active_profile; /**< \deprecated Superseded by active_profile2 */
621     pa_proplist* proplist; /**< Property list */
622     uint n_ports; /**< Number of entries in port array */
623     pa_card_port_info** ports; /**< Array of pointers to ports, or NULL. Array is terminated by an entry set to NULL. */
624     pa_card_profile_info2** profiles2; /**< Array of pointers to available profiles, or NULL. Array is terminated by an entry set to NULL. \since 5.0 */
625     pa_card_profile_info2* active_profile2; /**< Pointer to active profile in the array, or NULL. \since 5.0 */
626 }
627 
628 /** Callback prototype for pa_context_get_card_info_...() \since 0.9.15 */
629 alias pa_card_info_cb_t = void function (pa_context* c, const(pa_card_info)* i, int eol, void* userdata);
630 
631 /** Get information about a card by its index \since 0.9.15 */
632 pa_operation* pa_context_get_card_info_by_index (pa_context* c, uint idx, pa_card_info_cb_t cb, void* userdata);
633 
634 /** Get information about a card by its name \since 0.9.15 */
635 pa_operation* pa_context_get_card_info_by_name (pa_context* c, const(char)* name, pa_card_info_cb_t cb, void* userdata);
636 
637 /** Get the complete card list \since 0.9.15 */
638 pa_operation* pa_context_get_card_info_list (pa_context* c, pa_card_info_cb_t cb, void* userdata);
639 
640 /** Change the profile of a card. \since 0.9.15 */
641 pa_operation* pa_context_set_card_profile_by_index (pa_context* c, uint idx, const(char)* profile, pa_context_success_cb_t cb, void* userdata);
642 
643 /** Change the profile of a card. \since 0.9.15 */
644 pa_operation* pa_context_set_card_profile_by_name (pa_context* c, const(char)* name, const(char)* profile, pa_context_success_cb_t cb, void* userdata);
645 
646 /** Set the latency offset of a port. \since 3.0 */
647 pa_operation* pa_context_set_port_latency_offset (pa_context* c, const(char)* card_name, const(char)* port_name, long offset, pa_context_success_cb_t cb, void* userdata);
648 
649 /** @} */
650 
651 /** @{ \name Sink Inputs */
652 
653 /** Stores information about sink inputs. Please note that this structure
654  * can be extended as part of evolutionary API updates at any time in
655  * any new release. */
656 struct pa_sink_input_info
657 {
658     uint index; /**< Index of the sink input */
659     const(char)* name; /**< Name of the sink input */
660     uint owner_module; /**< Index of the module this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any module. */
661     uint client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client. */
662     uint sink; /**< Index of the connected sink */
663     pa_sample_spec sample_spec; /**< The sample specification of the sink input. */
664     pa_channel_map channel_map; /**< Channel map */
665     pa_cvolume volume; /**< The volume of this sink input. */
666     pa_usec_t buffer_usec; /**< Latency due to buffering in sink input, see pa_timing_info for details. */
667     pa_usec_t sink_usec; /**< Latency of the sink device, see pa_timing_info for details. */
668     const(char)* resample_method; /**< The resampling method used by this sink input. */
669     const(char)* driver; /**< Driver name */
670     int mute; /**< Stream muted \since 0.9.7 */
671     pa_proplist* proplist; /**< Property list \since 0.9.11 */
672     int corked; /**< Stream corked \since 1.0 */
673     int has_volume; /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */
674     int volume_writable; /**< The volume can be set. If not set, the volume can still change even though clients can't control the volume. \since 1.0 */
675     pa_format_info* format; /**< Stream format information. \since 1.0 */
676 }
677 
678 /** Callback prototype for pa_context_get_sink_input_info() and friends */
679 alias pa_sink_input_info_cb_t = void function (pa_context* c, const(pa_sink_input_info)* i, int eol, void* userdata);
680 
681 /** Get some information about a sink input by its index */
682 pa_operation* pa_context_get_sink_input_info (pa_context* c, uint idx, pa_sink_input_info_cb_t cb, void* userdata);
683 
684 /** Get the complete sink input list */
685 pa_operation* pa_context_get_sink_input_info_list (pa_context* c, pa_sink_input_info_cb_t cb, void* userdata);
686 
687 /** Move the specified sink input to a different sink. \since 0.9.5 */
688 pa_operation* pa_context_move_sink_input_by_name (pa_context* c, uint idx, const(char)* sink_name, pa_context_success_cb_t cb, void* userdata);
689 
690 /** Move the specified sink input to a different sink. \since 0.9.5 */
691 pa_operation* pa_context_move_sink_input_by_index (pa_context* c, uint idx, uint sink_idx, pa_context_success_cb_t cb, void* userdata);
692 
693 /** Set the volume of a sink input stream */
694 pa_operation* pa_context_set_sink_input_volume (pa_context* c, uint idx, const(pa_cvolume)* volume, pa_context_success_cb_t cb, void* userdata);
695 
696 /** Set the mute switch of a sink input stream \since 0.9.7 */
697 pa_operation* pa_context_set_sink_input_mute (pa_context* c, uint idx, int mute, pa_context_success_cb_t cb, void* userdata);
698 
699 /** Kill a sink input. */
700 pa_operation* pa_context_kill_sink_input (pa_context* c, uint idx, pa_context_success_cb_t cb, void* userdata);
701 
702 /** @} */
703 
704 /** @{ \name Source Outputs */
705 
706 /** Stores information about source outputs. Please note that this structure
707  * can be extended as part of evolutionary API updates at any time in
708  * any new release. */
709 struct pa_source_output_info
710 {
711     uint index; /**< Index of the source output */
712     const(char)* name; /**< Name of the source output */
713     uint owner_module; /**< Index of the module this source output belongs to, or PA_INVALID_INDEX when it does not belong to any module. */
714     uint client; /**< Index of the client this source output belongs to, or PA_INVALID_INDEX when it does not belong to any client. */
715     uint source; /**< Index of the connected source */
716     pa_sample_spec sample_spec; /**< The sample specification of the source output */
717     pa_channel_map channel_map; /**< Channel map */
718     pa_usec_t buffer_usec; /**< Latency due to buffering in the source output, see pa_timing_info for details. */
719     pa_usec_t source_usec; /**< Latency of the source device, see pa_timing_info for details. */
720     const(char)* resample_method; /**< The resampling method used by this source output. */
721     const(char)* driver; /**< Driver name */
722     pa_proplist* proplist; /**< Property list \since 0.9.11 */
723     int corked; /**< Stream corked \since 1.0 */
724     pa_cvolume volume; /**< The volume of this source output \since 1.0 */
725     int mute; /**< Stream muted \since 1.0 */
726     int has_volume; /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */
727     int volume_writable; /**< The volume can be set. If not set, the volume can still change even though clients can't control the volume. \since 1.0 */
728     pa_format_info* format; /**< Stream format information. \since 1.0 */
729 }
730 
731 /** Callback prototype for pa_context_get_source_output_info() and friends */
732 alias pa_source_output_info_cb_t = void function (pa_context* c, const(pa_source_output_info)* i, int eol, void* userdata);
733 
734 /** Get information about a source output by its index */
735 pa_operation* pa_context_get_source_output_info (pa_context* c, uint idx, pa_source_output_info_cb_t cb, void* userdata);
736 
737 /** Get the complete list of source outputs */
738 pa_operation* pa_context_get_source_output_info_list (pa_context* c, pa_source_output_info_cb_t cb, void* userdata);
739 
740 /** Move the specified source output to a different source. \since 0.9.5 */
741 pa_operation* pa_context_move_source_output_by_name (pa_context* c, uint idx, const(char)* source_name, pa_context_success_cb_t cb, void* userdata);
742 
743 /** Move the specified source output to a different source. \since 0.9.5 */
744 pa_operation* pa_context_move_source_output_by_index (pa_context* c, uint idx, uint source_idx, pa_context_success_cb_t cb, void* userdata);
745 
746 /** Set the volume of a source output stream \since 1.0 */
747 pa_operation* pa_context_set_source_output_volume (pa_context* c, uint idx, const(pa_cvolume)* volume, pa_context_success_cb_t cb, void* userdata);
748 
749 /** Set the mute switch of a source output stream \since 1.0 */
750 pa_operation* pa_context_set_source_output_mute (pa_context* c, uint idx, int mute, pa_context_success_cb_t cb, void* userdata);
751 
752 /** Kill a source output. */
753 pa_operation* pa_context_kill_source_output (pa_context* c, uint idx, pa_context_success_cb_t cb, void* userdata);
754 
755 /** @} */
756 
757 /** @{ \name Statistics */
758 
759 /** Memory block statistics. Please note that this structure
760  * can be extended as part of evolutionary API updates at any time in
761  * any new release. */
762 struct pa_stat_info
763 {
764     uint memblock_total; /**< Currently allocated memory blocks */
765     uint memblock_total_size; /**< Current total size of allocated memory blocks */
766     uint memblock_allocated; /**< Allocated memory blocks during the whole lifetime of the daemon. */
767     uint memblock_allocated_size; /**< Total size of all memory blocks allocated during the whole lifetime of the daemon. */
768     uint scache_size; /**< Total size of all sample cache entries. */
769 }
770 
771 /** Callback prototype for pa_context_stat() */
772 alias pa_stat_info_cb_t = void function (pa_context* c, const(pa_stat_info)* i, void* userdata);
773 
774 /** Get daemon memory block statistics */
775 pa_operation* pa_context_stat (pa_context* c, pa_stat_info_cb_t cb, void* userdata);
776 
777 /** @} */
778 
779 /** @{ \name Cached Samples */
780 
781 /** Stores information about sample cache entries. Please note that this structure
782  * can be extended as part of evolutionary API updates at any time in
783  * any new release. */
784 struct pa_sample_info
785 {
786     uint index; /**< Index of this entry */
787     const(char)* name; /**< Name of this entry */
788     pa_cvolume volume; /**< Default volume of this entry */
789     pa_sample_spec sample_spec; /**< Sample specification of the sample */
790     pa_channel_map channel_map; /**< The channel map */
791     pa_usec_t duration; /**< Duration of this entry */
792     uint bytes; /**< Length of this sample in bytes. */
793     int lazy_; /**< Non-zero when this is a lazy cache entry. */
794     const(char)* filename; /**< In case this is a lazy cache entry, the filename for the sound file to be loaded on demand. */
795     pa_proplist* proplist; /**< Property list for this sample. \since 0.9.11 */
796 }
797 
798 /** Callback prototype for pa_context_get_sample_info_by_name() and friends */
799 alias pa_sample_info_cb_t = void function (pa_context* c, const(pa_sample_info)* i, int eol, void* userdata);
800 
801 /** Get information about a sample by its name */
802 pa_operation* pa_context_get_sample_info_by_name (pa_context* c, const(char)* name, pa_sample_info_cb_t cb, void* userdata);
803 
804 /** Get information about a sample by its index */
805 pa_operation* pa_context_get_sample_info_by_index (pa_context* c, uint idx, pa_sample_info_cb_t cb, void* userdata);
806 
807 /** Get the complete list of samples stored in the daemon. */
808 pa_operation* pa_context_get_sample_info_list (pa_context* c, pa_sample_info_cb_t cb, void* userdata);
809 
810 /** @} */
811 
812 /** \cond fulldocs */
813 
814 /** @{ \name Autoload Entries */
815 
816 /** \deprecated Type of an autoload entry. */
817 enum pa_autoload_type
818 {
819     PA_AUTOLOAD_SINK = 0,
820     PA_AUTOLOAD_SOURCE = 1
821 }
822 
823 alias pa_autoload_type_t = pa_autoload_type;
824 
825 /** \deprecated Stores information about autoload entries. Please note that this structure
826  * can be extended as part of evolutionary API updates at any time in
827  * any new release. */
828 struct pa_autoload_info
829 {
830     uint index; /**< Index of this autoload entry */
831     const(char)* name; /**< Name of the sink or source */
832     pa_autoload_type_t type; /**< Type of the autoload entry */
833     const(char)* module_; /**< Module name to load */
834     const(char)* argument; /**< Argument string for module */
835 }
836 
837 /** \deprecated Callback prototype for pa_context_get_autoload_info_by_name() and friends */
838 alias pa_autoload_info_cb_t = void function (pa_context* c, const(pa_autoload_info)* i, int eol, void* userdata);
839 
840 /** \deprecated Get info about a specific autoload entry. */
841 pa_operation* pa_context_get_autoload_info_by_name (pa_context* c, const(char)* name, pa_autoload_type_t type, pa_autoload_info_cb_t cb, void* userdata);
842 
843 /** \deprecated Get info about a specific autoload entry. */
844 pa_operation* pa_context_get_autoload_info_by_index (pa_context* c, uint idx, pa_autoload_info_cb_t cb, void* userdata);
845 
846 /** \deprecated Get the complete list of autoload entries. */
847 pa_operation* pa_context_get_autoload_info_list (pa_context* c, pa_autoload_info_cb_t cb, void* userdata);
848 
849 /** \deprecated Add a new autoload entry. */
850 pa_operation* pa_context_add_autoload (pa_context* c, const(char)* name, pa_autoload_type_t type, const(char)* module_, const(char)* argument, pa_context_index_cb_t, void* userdata);
851 
852 /** \deprecated Remove an autoload entry. */
853 pa_operation* pa_context_remove_autoload_by_name (pa_context* c, const(char)* name, pa_autoload_type_t type, pa_context_success_cb_t cb, void* userdata);
854 
855 /** \deprecated Remove an autoload entry. */
856 pa_operation* pa_context_remove_autoload_by_index (pa_context* c, uint idx, pa_context_success_cb_t cb, void* userdata);
857 
858 /** @} */
859 
860 /** \endcond */
861