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