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