• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
220 PA_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 */
227 typedef 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     const char *availability_group;     /**< An indentifier for the group of ports that share their availability status with
233                                          * each other. This is meant especially for handling cases where one 3.5 mm connector
234                                          * is used for headphones, headsets and microphones, and the hardware can only tell
235                                          * that something was plugged in but not what exactly. In this situation the ports for
236                                          * all those devices share their availability status, and PulseAudio can't tell which
237                                          * one is actually plugged in, and some application may ask the user what was plugged
238                                          * in. Such applications should get a list of all card ports and compare their
239                                          * `availability_group` fields. Ports that have the same group are those that need
240                                          * input from the user to determine which device was plugged in. The application should
241                                          * then activate the user-chosen port.
242                                          *
243                                          * May be NULL, in which case the port is not part of any availability group.
244                                          *
245                                          * The group identifier must be treated as an opaque identifier. The string may look
246                                          * like an ALSA control name, but applications must not assume any such relationship.
247                                          * The group naming scheme can change without a warning.
248                                          *
249                                          * Since one group can include both input and output ports, the grouping should be done
250                                          * using pa_card_port_info instead of pa_sink_port_info, but this field is duplicated
251                                          * also in pa_sink_port_info (and pa_source_port_info) in case someone finds that
252                                          * convenient.
253                                          *
254                                          * \since 14.0 */
255     uint32_t type;			/**< Port type, see #pa_device_port_type. \since 14.0 */
256 } pa_sink_port_info;
257 
258 /** Stores information about sinks. Please note that this structure
259  * can be extended as part of evolutionary API updates at any time in
260  * any new release. */
261 typedef struct pa_sink_info {
262     const char *name;                  /**< Name of the sink */
263     uint32_t index;                    /**< Index of the sink */
264     const char *description;           /**< Description of this sink */
265     pa_sample_spec sample_spec;        /**< Sample spec of this sink */
266     pa_channel_map channel_map;        /**< Channel map */
267     uint32_t owner_module;             /**< Index of the owning module of this sink, or PA_INVALID_INDEX. */
268     pa_cvolume volume;                 /**< Volume of the sink */
269     int mute;                          /**< Mute switch of the sink */
270     uint32_t monitor_source;           /**< Index of the monitor source connected to this sink. */
271     const char *monitor_source_name;   /**< The name of the monitor source. */
272     pa_usec_t latency;                 /**< Length of queued audio in the output buffer. */
273     const char *driver;                /**< Driver name */
274     pa_sink_flags_t flags;             /**< Flags */
275     pa_proplist *proplist;             /**< Property list \since 0.9.11 */
276     pa_usec_t configured_latency;      /**< The latency this device has been configured to. \since 0.9.11 */
277     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 */
278     pa_sink_state_t state;             /**< State \since 0.9.15 */
279     uint32_t n_volume_steps;           /**< Number of volume steps for sinks which do not support arbitrary volumes. \since 0.9.15 */
280     uint32_t card;                     /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
281     uint32_t n_ports;                  /**< Number of entries in port array \since 0.9.16 */
282     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 */
283     pa_sink_port_info* active_port;    /**< Pointer to active port in the array, or NULL. \since 0.9.16 */
284     uint8_t n_formats;                 /**< Number of formats supported by the sink. \since 1.0 */
285     pa_format_info **formats;          /**< Array of formats supported by the sink. \since 1.0 */
286 } pa_sink_info;
287 
288 /** Callback prototype for pa_context_get_sink_info_by_name() and friends */
289 typedef void (*pa_sink_info_cb_t)(pa_context *c, const pa_sink_info *i, int eol, void *userdata);
290 
291 /** Get information about a sink by its name */
292 pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name, pa_sink_info_cb_t cb, void *userdata);
293 
294 /** Get information about a sink by its index */
295 pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t idx, pa_sink_info_cb_t cb, void *userdata);
296 
297 /** Get the complete sink list */
298 pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb, void *userdata);
299 
300 /** Set the volume of a sink device specified by its index */
301 pa_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);
302 
303 /** Set the volume of a sink device specified by its name */
304 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);
305 
306 /** Set the mute switch of a sink device specified by its index */
307 pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
308 
309 /** Set the mute switch of a sink device specified by its name */
310 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);
311 
312 /** Suspend/Resume a sink. \since 0.9.7 */
313 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);
314 
315 /** Suspend/Resume a sink. If idx is PA_INVALID_INDEX all sinks will be suspended. \since 0.9.7 */
316 pa_operation* pa_context_suspend_sink_by_index(pa_context *c, uint32_t idx, int suspend,  pa_context_success_cb_t cb, void* userdata);
317 
318 /** Change the profile of a sink. \since 0.9.16 */
319 pa_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);
320 
321 /** Change the profile of a sink. \since 0.9.15 */
322 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);
323 
324 /** @} */
325 
326 /** @{ \name Sources */
327 
328 /** Stores information about a specific port of a source.  Please
329  * note that this structure can be extended as part of evolutionary
330  * API updates at any time in any new release. \since 0.9.16 */
331 typedef struct pa_source_port_info {
332     const char *name;                   /**< Name of this port */
333     const char *description;            /**< Description of this port */
334     uint32_t priority;                  /**< The higher this value is, the more useful this port is as a default. */
335     int available;                      /**< A flags (see #pa_port_available), indicating availability status of this port. \since 2.0 */
336     const char *availability_group;     /**< An indentifier for the group of ports that share their availability status with
337                                          * each other. This is meant especially for handling cases where one 3.5 mm connector
338                                          * is used for headphones, headsets and microphones, and the hardware can only tell
339                                          * that something was plugged in but not what exactly. In this situation the ports for
340                                          * all those devices share their availability status, and PulseAudio can't tell which
341                                          * one is actually plugged in, and some application may ask the user what was plugged
342                                          * in. Such applications should get a list of all card ports and compare their
343                                          * `availability_group` fields. Ports that have the same group are those that need
344                                          * input from the user to determine which device was plugged in. The application should
345                                          * then activate the user-chosen port.
346                                          *
347                                          * May be NULL, in which case the port is not part of any availability group (which is
348                                          * the same as having a group with only one member).
349                                          *
350                                          * The group identifier must be treated as an opaque identifier. The string may look
351                                          * like an ALSA control name, but applications must not assume any such relationship.
352                                          * The group naming scheme can change without a warning.
353                                          *
354                                          * Since one group can include both input and output ports, the grouping should be done
355                                          * using pa_card_port_info instead of pa_source_port_info, but this field is duplicated
356                                          * also in pa_source_port_info (and pa_sink_port_info) in case someone finds that
357                                          * convenient.
358                                          *
359                                          * \since 14.0 */
360     uint32_t type;		        /**< Port type, see #pa_device_port_type. \since 14.0 */
361 } pa_source_port_info;
362 
363 /** Stores information about sources. Please note that this structure
364  * can be extended as part of evolutionary API updates at any time in
365  * any new release. */
366 typedef struct pa_source_info {
367     const char *name;                   /**< Name of the source */
368     uint32_t index;                     /**< Index of the source */
369     const char *description;            /**< Description of this source */
370     pa_sample_spec sample_spec;         /**< Sample spec of this source */
371     pa_channel_map channel_map;         /**< Channel map */
372     uint32_t owner_module;              /**< Owning module index, or PA_INVALID_INDEX. */
373     pa_cvolume volume;                  /**< Volume of the source */
374     int mute;                           /**< Mute switch of the sink */
375     uint32_t monitor_of_sink;           /**< If this is a monitor source, the index of the owning sink, otherwise PA_INVALID_INDEX. */
376     const char *monitor_of_sink_name;   /**< Name of the owning sink, or NULL. */
377     pa_usec_t latency;                  /**< Length of filled record buffer of this source. */
378     const char *driver;                 /**< Driver name */
379     pa_source_flags_t flags;            /**< Flags */
380     pa_proplist *proplist;              /**< Property list \since 0.9.11 */
381     pa_usec_t configured_latency;       /**< The latency this device has been configured to. \since 0.9.11 */
382     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 */
383     pa_source_state_t state;            /**< State \since 0.9.15 */
384     uint32_t n_volume_steps;            /**< Number of volume steps for sources which do not support arbitrary volumes. \since 0.9.15 */
385     uint32_t card;                      /**< Card index, or PA_INVALID_INDEX. \since 0.9.15 */
386     uint32_t n_ports;                   /**< Number of entries in port array \since 0.9.16 */
387     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  */
388     pa_source_port_info* active_port;   /**< Pointer to active port in the array, or NULL. \since 0.9.16  */
389     uint8_t n_formats;                  /**< Number of formats supported by the source. \since 1.0 */
390     pa_format_info **formats;           /**< Array of formats supported by the source. \since 1.0 */
391 } pa_source_info;
392 
393 /** Callback prototype for pa_context_get_source_info_by_name() and friends */
394 typedef void (*pa_source_info_cb_t)(pa_context *c, const pa_source_info *i, int eol, void *userdata);
395 
396 /** Get information about a source by its name */
397 pa_operation* pa_context_get_source_info_by_name(pa_context *c, const char *name, pa_source_info_cb_t cb, void *userdata);
398 
399 /** Get information about a source by its index */
400 pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t idx, pa_source_info_cb_t cb, void *userdata);
401 
402 /** Get the complete source list */
403 pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t cb, void *userdata);
404 
405 /** Set the volume of a source device specified by its index */
406 pa_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);
407 
408 /** Set the volume of a source device specified by its name */
409 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);
410 
411 /** Set the mute switch of a source device specified by its index */
412 pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
413 
414 /** Set the mute switch of a source device specified by its name */
415 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);
416 
417 /** Suspend/Resume a source. \since 0.9.7 */
418 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);
419 
420 /** Suspend/Resume a source. If idx is PA_INVALID_INDEX, all sources will be suspended. \since 0.9.7 */
421 pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
422 
423 /** Change the profile of a source. \since 0.9.16 */
424 pa_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);
425 
426 /** Change the profile of a source. \since 0.9.15 */
427 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);
428 
429 /** @} */
430 
431 /** @{ \name Server */
432 
433 /** Server information. Please note that this structure can be
434  * extended as part of evolutionary API updates at any time in any new
435  * release. */
436 typedef struct pa_server_info {
437     const char *user_name;              /**< User name of the daemon process */
438     const char *host_name;              /**< Host name the daemon is running on */
439     const char *server_version;         /**< Version string of the daemon */
440     const char *server_name;            /**< Server package name (usually "pulseaudio") */
441     pa_sample_spec sample_spec;         /**< Default sample specification */
442     const char *default_sink_name;      /**< Name of default sink. */
443     const char *default_source_name;    /**< Name of default source. */
444     uint32_t cookie;                    /**< A random cookie for identifying this instance of PulseAudio. */
445     pa_channel_map channel_map;         /**< Default channel map. \since 0.9.15 */
446 } pa_server_info;
447 
448 /** Callback prototype for pa_context_get_server_info() */
449 typedef void (*pa_server_info_cb_t) (pa_context *c, const pa_server_info*i, void *userdata);
450 
451 /** Get some information about the server */
452 pa_operation* pa_context_get_server_info(pa_context *c, pa_server_info_cb_t cb, void *userdata);
453 
454 /** @} */
455 
456 /** @{ \name Modules */
457 
458 /** Stores information about modules. Please note that this structure
459  * can be extended as part of evolutionary API updates at any time in
460  * any new release. */
461 typedef struct pa_module_info {
462     uint32_t index;                     /**< Index of the module */
463     const char*name,                    /**< Name of the module */
464         *argument;                      /**< Argument string of the module */
465     uint32_t n_used;                    /**< Usage counter or PA_INVALID_INDEX */
466 /** \cond fulldocs */
467     int auto_unload;                    /**< \deprecated Non-zero if this is an autoloaded module. */
468 /** \endcond */
469     pa_proplist *proplist;              /**< Property list \since 0.9.15 */
470 } pa_module_info;
471 
472 /** Callback prototype for pa_context_get_module_info() and friends */
473 typedef void (*pa_module_info_cb_t) (pa_context *c, const pa_module_info*i, int eol, void *userdata);
474 
475 /** Get some information about a module by its index */
476 pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_info_cb_t cb, void *userdata);
477 
478 /** Get the complete list of currently loaded modules */
479 pa_operation* pa_context_get_module_info_list(pa_context *c, pa_module_info_cb_t cb, void *userdata);
480 
481 /** Callback prototype for pa_context_load_module() */
482 typedef void (*pa_context_index_cb_t)(pa_context *c, uint32_t idx, void *userdata);
483 
484 /** Load a module. */
485 pa_operation* pa_context_load_module(pa_context *c, const char*name, const char *argument, pa_context_index_cb_t cb, void *userdata);
486 
487 /** Unload a module. */
488 pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
489 
490 /** @} */
491 
492 /** @{ \name Clients */
493 
494 /** Stores information about clients. Please note that this structure
495  * can be extended as part of evolutionary API updates at any time in
496  * any new release. */
497 typedef struct pa_client_info {
498     uint32_t index;                      /**< Index of this client */
499     const char *name;                    /**< Name of this client */
500     uint32_t owner_module;               /**< Index of the owning module, or PA_INVALID_INDEX. */
501     const char *driver;                  /**< Driver name */
502     pa_proplist *proplist;               /**< Property list \since 0.9.11 */
503 } pa_client_info;
504 
505 /** Callback prototype for pa_context_get_client_info() and friends */
506 typedef void (*pa_client_info_cb_t) (pa_context *c, const pa_client_info*i, int eol, void *userdata);
507 
508 /** Get information about a client by its index */
509 pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, pa_client_info_cb_t cb, void *userdata);
510 
511 /** Get the complete client list */
512 pa_operation* pa_context_get_client_info_list(pa_context *c, pa_client_info_cb_t cb, void *userdata);
513 
514 /** Kill a client. */
515 pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
516 
517 /** @} */
518 
519 /** @{ \name Cards */
520 
521 /** \deprecated Superseded by pa_card_profile_info2 \since 0.9.15 */
522 typedef struct pa_card_profile_info {
523     const char *name;                   /**< Name of this profile */
524     const char *description;            /**< Description of this profile */
525     uint32_t n_sinks;                   /**< Number of sinks this profile would create */
526     uint32_t n_sources;                 /**< Number of sources this profile would create */
527     uint32_t priority;                  /**< The higher this value is, the more useful this profile is as a default. */
528 } pa_card_profile_info;
529 
530 /** Stores information about a specific profile of a card. Please
531  * note that this structure can be extended as part of evolutionary
532  * API updates at any time in any new release. \since 5.0 */
533 typedef struct pa_card_profile_info2 {
534     const char *name;                   /**< Name of this profile */
535     const char *description;            /**< Description of this profile */
536     uint32_t n_sinks;                   /**< Number of sinks this profile would create */
537     uint32_t n_sources;                 /**< Number of sources this profile would create */
538     uint32_t priority;                  /**< The higher this value is, the more useful this profile is as a default. */
539     int available;
540     /**< Is this profile available? If this is zero, meaning "unavailable",
541      * then it makes no sense to try to activate this profile. If this is
542      * non-zero, it's still not a guarantee that activating the profile will
543      * result in anything useful, it just means that the server isn't aware of
544      * any reason why the profile would definitely be useless. \since 5.0 */
545 } pa_card_profile_info2;
546 
547 /** Stores information about a specific port of a card.  Please
548  * note that this structure can be extended as part of evolutionary
549  * API updates at any time in any new release. \since 2.0 */
550 typedef struct pa_card_port_info {
551     const char *name;                   /**< Name of this port */
552     const char *description;            /**< Description of this port */
553     uint32_t priority;                  /**< The higher this value is, the more useful this port is as a default. */
554     int available;                      /**< A #pa_port_available enum, indicating availability status of this port. */
555     int direction;                      /**< A #pa_direction enum, indicating the direction of this port. */
556     uint32_t n_profiles;                /**< Number of entries in profile array */
557     pa_card_profile_info** profiles;    /**< \deprecated Superseded by profiles2 */
558     pa_proplist *proplist;              /**< Property list */
559     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 */
560     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 */
561     const char *availability_group;     /**< An indentifier for the group of ports that share their availability status with
562                                          * each other. This is meant especially for handling cases where one 3.5 mm connector
563                                          * is used for headphones, headsets and microphones, and the hardware can only tell
564                                          * that something was plugged in but not what exactly. In this situation the ports for
565                                          * all those devices share their availability status, and PulseAudio can't tell which
566                                          * one is actually plugged in, and some application may ask the user what was plugged
567                                          * in. Such applications should get a list of all card ports and compare their
568                                          * `availability_group` fields. Ports that have the same group are those that need
569                                          * input from the user to determine which device was plugged in. The application should
570                                          * then activate the user-chosen port.
571                                          *
572                                          * May be NULL, in which case the port is not part of any availability group (which is
573                                          * the same as having a group with only one member).
574                                          *
575                                          * The group identifier must be treated as an opaque identifier. The string may look
576                                          * like an ALSA control name, but applications must not assume any such relationship.
577                                          * The group naming scheme can change without a warning.
578                                          *
579                                          * \since 14.0 */
580     uint32_t type;			/**< Port type, see #pa_device_port_type. \since 14.0 */
581 } pa_card_port_info;
582 
583 /** Stores information about cards. Please note that this structure
584  * can be extended as part of evolutionary API updates at any time in
585  * any new release.  \since 0.9.15 */
586 typedef struct pa_card_info {
587     uint32_t index;                      /**< Index of this card */
588     const char *name;                    /**< Name of this card */
589     uint32_t owner_module;               /**< Index of the owning module, or PA_INVALID_INDEX. */
590     const char *driver;                  /**< Driver name */
591     uint32_t n_profiles;                 /**< Number of entries in profile array */
592     pa_card_profile_info* profiles;      /**< \deprecated Superseded by profiles2 */
593     pa_card_profile_info* active_profile; /**< \deprecated Superseded by active_profile2 */
594     pa_proplist *proplist;               /**< Property list */
595     uint32_t n_ports;                    /**< Number of entries in port array */
596     pa_card_port_info **ports;           /**< Array of pointers to ports, or NULL. Array is terminated by an entry set to NULL. */
597     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 */
598     pa_card_profile_info2* active_profile2; /**< Pointer to active profile in the array, or NULL. \since 5.0 */
599 } pa_card_info;
600 
601 /** Callback prototype for pa_context_get_card_info_...() \since 0.9.15 */
602 typedef void (*pa_card_info_cb_t) (pa_context *c, const pa_card_info*i, int eol, void *userdata);
603 
604 /** Get information about a card by its index \since 0.9.15 */
605 pa_operation* pa_context_get_card_info_by_index(pa_context *c, uint32_t idx, pa_card_info_cb_t cb, void *userdata);
606 
607 /** Get information about a card by its name \since 0.9.15 */
608 pa_operation* pa_context_get_card_info_by_name(pa_context *c, const char *name, pa_card_info_cb_t cb, void *userdata);
609 
610 /** Get the complete card list \since 0.9.15 */
611 pa_operation* pa_context_get_card_info_list(pa_context *c, pa_card_info_cb_t cb, void *userdata);
612 
613 /** Change the profile of a card. \since 0.9.15 */
614 pa_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);
615 
616 /** Change the profile of a card. \since 0.9.15 */
617 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);
618 
619 /** Set the latency offset of a port. \since 3.0 */
620 pa_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);
621 
622 /** @} */
623 
624 /** @{ \name Sink Inputs */
625 
626 /** Stores information about sink inputs. Please note that this structure
627  * can be extended as part of evolutionary API updates at any time in
628  * any new release. */
629 typedef struct pa_sink_input_info {
630     uint32_t index;                      /**< Index of the sink input */
631     const char *name;                    /**< Name of the sink input */
632     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. */
633     uint32_t client;                     /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client. */
634     uint32_t sink;                       /**< Index of the connected sink */
635     pa_sample_spec sample_spec;          /**< The sample specification of the sink input. */
636     pa_channel_map channel_map;          /**< Channel map */
637     pa_cvolume volume;                   /**< The volume of this sink input. */
638     pa_usec_t buffer_usec;               /**< Latency due to buffering in sink input, see pa_timing_info for details. */
639     pa_usec_t sink_usec;                 /**< Latency of the sink device, see pa_timing_info for details. */
640     const char *resample_method;         /**< The resampling method used by this sink input. */
641     const char *driver;                  /**< Driver name */
642     int mute;                            /**< Stream muted \since 0.9.7 */
643     pa_proplist *proplist;               /**< Property list \since 0.9.11 */
644     int corked;                          /**< Stream corked \since 1.0 */
645     int has_volume;                      /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */
646     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 */
647     pa_format_info *format;              /**< Stream format information. \since 1.0 */
648 } pa_sink_input_info;
649 
650 /** Callback prototype for pa_context_get_sink_input_info() and friends */
651 typedef void (*pa_sink_input_info_cb_t) (pa_context *c, const pa_sink_input_info *i, int eol, void *userdata);
652 
653 /** Get some information about a sink input by its index */
654 pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata);
655 
656 /** Get the complete sink input list */
657 pa_operation* pa_context_get_sink_input_info_list(pa_context *c, pa_sink_input_info_cb_t cb, void *userdata);
658 
659 /** Move the specified sink input to a different sink. \since 0.9.5 */
660 pa_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);
661 
662 /** Move the specified sink input to a different sink. \since 0.9.5 */
663 pa_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);
664 
665 /** Set the volume of a sink input stream */
666 pa_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);
667 
668 /** Set the mute switch of a sink input stream \since 0.9.7 */
669 pa_operation* pa_context_set_sink_input_mute(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
670 
671 /** Kill a sink input. */
672 pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
673 
674 /** @} */
675 
676 /** @{ \name Source Outputs */
677 
678 /** Stores information about source outputs. Please note that this structure
679  * can be extended as part of evolutionary API updates at any time in
680  * any new release. */
681 typedef struct pa_source_output_info {
682     uint32_t index;                      /**< Index of the source output */
683     const char *name;                    /**< Name of the source output */
684     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. */
685     uint32_t client;                     /**< Index of the client this source output belongs to, or PA_INVALID_INDEX when it does not belong to any client. */
686     uint32_t source;                     /**< Index of the connected source */
687     pa_sample_spec sample_spec;          /**< The sample specification of the source output */
688     pa_channel_map channel_map;          /**< Channel map */
689     pa_usec_t buffer_usec;               /**< Latency due to buffering in the source output, see pa_timing_info for details. */
690     pa_usec_t source_usec;               /**< Latency of the source device, see pa_timing_info for details. */
691     const char *resample_method;         /**< The resampling method used by this source output. */
692     const char *driver;                  /**< Driver name */
693     pa_proplist *proplist;               /**< Property list \since 0.9.11 */
694     int corked;                          /**< Stream corked \since 1.0 */
695     pa_cvolume volume;                   /**< The volume of this source output \since 1.0 */
696     int mute;                            /**< Stream muted \since 1.0 */
697     int has_volume;                      /**< Stream has volume. If not set, then the meaning of this struct's volume member is unspecified. \since 1.0 */
698     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 */
699     pa_format_info *format;              /**< Stream format information. \since 1.0 */
700 } pa_source_output_info;
701 
702 /** Callback prototype for pa_context_get_source_output_info() and friends */
703 typedef void (*pa_source_output_info_cb_t) (pa_context *c, const pa_source_output_info *i, int eol, void *userdata);
704 
705 /** Get information about a source output by its index */
706 pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_source_output_info_cb_t cb, void *userdata);
707 
708 /** Get the complete list of source outputs */
709 pa_operation* pa_context_get_source_output_info_list(pa_context *c, pa_source_output_info_cb_t cb, void *userdata);
710 
711 /** Move the specified source output to a different source. \since 0.9.5 */
712 pa_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);
713 
714 /** Move the specified source output to a different source. \since 0.9.5 */
715 pa_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);
716 
717 /** Set the volume of a source output stream \since 1.0 */
718 pa_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);
719 
720 /** Set the mute switch of a source output stream \since 1.0 */
721 pa_operation* pa_context_set_source_output_mute(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
722 
723 /** Kill a source output. */
724 pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
725 
726 /** @} */
727 
728 /** @{ \name Statistics */
729 
730 /** Memory block statistics. Please note that this structure
731  * can be extended as part of evolutionary API updates at any time in
732  * any new release. */
733 typedef struct pa_stat_info {
734     uint32_t memblock_total;           /**< Currently allocated memory blocks */
735     uint32_t memblock_total_size;      /**< Current total size of allocated memory blocks */
736     uint32_t memblock_allocated;       /**< Allocated memory blocks during the whole lifetime of the daemon. */
737     uint32_t memblock_allocated_size;  /**< Total size of all memory blocks allocated during the whole lifetime of the daemon. */
738     uint32_t scache_size;              /**< Total size of all sample cache entries. */
739 } pa_stat_info;
740 
741 /** Callback prototype for pa_context_stat() */
742 typedef void (*pa_stat_info_cb_t) (pa_context *c, const pa_stat_info *i, void *userdata);
743 
744 /** Get daemon memory block statistics */
745 pa_operation* pa_context_stat(pa_context *c, pa_stat_info_cb_t cb, void *userdata);
746 
747 /** @} */
748 
749 /** @{ \name Cached Samples */
750 
751 /** Stores information about sample cache entries. Please note that this structure
752  * can be extended as part of evolutionary API updates at any time in
753  * any new release. */
754 typedef struct pa_sample_info {
755     uint32_t index;                       /**< Index of this entry */
756     const char *name;                     /**< Name of this entry */
757     pa_cvolume volume;                    /**< Default volume of this entry */
758     pa_sample_spec sample_spec;           /**< Sample specification of the sample */
759     pa_channel_map channel_map;           /**< The channel map */
760     pa_usec_t duration;                   /**< Duration of this entry */
761     uint32_t bytes;                       /**< Length of this sample in bytes. */
762     int lazy;                             /**< Non-zero when this is a lazy cache entry. */
763     const char *filename;                 /**< In case this is a lazy cache entry, the filename for the sound file to be loaded on demand. */
764     pa_proplist *proplist;                /**< Property list for this sample. \since 0.9.11 */
765 } pa_sample_info;
766 
767 /** Callback prototype for pa_context_get_sample_info_by_name() and friends */
768 typedef void (*pa_sample_info_cb_t)(pa_context *c, const pa_sample_info *i, int eol, void *userdata);
769 
770 /** Get information about a sample by its name */
771 pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name, pa_sample_info_cb_t cb, void *userdata);
772 
773 /** Get information about a sample by its index */
774 pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, pa_sample_info_cb_t cb, void *userdata);
775 
776 /** Get the complete list of samples stored in the daemon. */
777 pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t cb, void *userdata);
778 
779 /** @} */
780 
781 /** \cond fulldocs */
782 
783 /** @{ \name Autoload Entries */
784 
785 /** \deprecated Type of an autoload entry. */
786 typedef enum pa_autoload_type {
787     PA_AUTOLOAD_SINK = 0,
788     PA_AUTOLOAD_SOURCE = 1
789 } pa_autoload_type_t;
790 
791 /** \deprecated Stores information about autoload entries. Please note that this structure
792  * can be extended as part of evolutionary API updates at any time in
793  * any new release. */
794 typedef struct pa_autoload_info {
795     uint32_t index;               /**< Index of this autoload entry */
796     const char *name;             /**< Name of the sink or source */
797     pa_autoload_type_t type;      /**< Type of the autoload entry */
798     const char *module;           /**< Module name to load */
799     const char *argument;         /**< Argument string for module */
800 } pa_autoload_info;
801 
802 /** \deprecated Callback prototype for pa_context_get_autoload_info_by_name() and friends */
803 typedef void (*pa_autoload_info_cb_t)(pa_context *c, const pa_autoload_info *i, int eol, void *userdata);
804 
805 /** \deprecated Get info about a specific autoload entry. */
806 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) PA_GCC_DEPRECATED;
807 
808 /** \deprecated Get info about a specific autoload entry. */
809 pa_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;
810 
811 /** \deprecated Get the complete list of autoload entries. */
812 pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata) PA_GCC_DEPRECATED;
813 
814 /** \deprecated Add a new autoload entry. */
815 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) PA_GCC_DEPRECATED;
816 
817 /** \deprecated Remove an autoload entry. */
818 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) PA_GCC_DEPRECATED;
819 
820 /** \deprecated Remove an autoload entry. */
821 pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata) PA_GCC_DEPRECATED;
822 
823 /** @} */
824 
825 /** \endcond */
826 
827 PA_C_DECL_END
828 
829 #endif
830