introspect.h 41 KB

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