]> code.delx.au - pulseaudio/blob - src/polyp/introspect.h
* update docs for reworked latency API
[pulseaudio] / src / polyp / introspect.h
1 #ifndef foointrospecthfoo
2 #define foointrospecthfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of polypaudio.
8
9 polypaudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published
11 by the Free Software Foundation; either version 2 of the License,
12 or (at your option) any later version.
13
14 polypaudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with polypaudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 #include <inttypes.h>
26
27 #include <polyp/operation.h>
28 #include <polyp/context.h>
29 #include <polyp/cdecl.h>
30 #include <polyp/channelmap.h>
31 #include <polyp/volume.h>
32
33 /** \file
34 *
35 * Routines for daemon introspection. When enumerating all entitites
36 * of a certain kind, use the pa_context_xxx_list() functions. The
37 * specified callback function is called once for each entry. The
38 * enumeration is finished by a call to the callback function with
39 * eol=1 and i=NULL. Strings referenced in pa_xxx_info structures and
40 * the structures themselves point to internal memory that may not be
41 * modified. That memory is only valid during the call to the callback
42 * function. A deep copy is required if you need this data outside the
43 * callback functions. An error is signalled by a call to the callback
44 * function with i=NULL and eol=0.
45 *
46 * When using the routines that ask fo a single entry only, a callback
47 * with the same signature is used. However, no finishing call to the
48 * routine is issued. */
49
50 PA_C_DECL_BEGIN
51
52 /** Stores information about sinks */
53 typedef struct pa_sink_info {
54 const char *name; /**< Name of the sink */
55 uint32_t index; /**< Index of the sink */
56 const char *description; /**< Description of this sink */
57 pa_sample_spec sample_spec; /**< Sample spec of this sink */
58 pa_channel_map channel_map; /**< Channel map \since 0.8 */
59 uint32_t owner_module; /**< Index of the owning module of this sink, or PA_INVALID_INDEX */
60 pa_cvolume volume; /**< Volume of the sink */
61 int mute; /**< Mute switch of the sink \since 0.8 */
62 uint32_t monitor_source; /**< Index of the monitor source connected to this sink */
63 const char *monitor_source_name; /**< The name of the monitor source */
64 pa_usec_t latency; /**< Length of filled playback buffer of this sink */
65 const char *driver; /**< Driver name. \since 0.8 */
66 } pa_sink_info;
67
68 /** Callback prototype for pa_context_get_sink_info_by_name() and friends */
69 typedef void (*pa_sink_info_cb_t)(pa_context *c, const pa_sink_info *i, int eol, void *userdata);
70
71 /** Get information about a sink by its name */
72 pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name, pa_sink_info_cb_t cb, void *userdata);
73
74 /** Get information about a sink by its index */
75 pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t id, pa_sink_info_cb_t cb, void *userdata);
76
77 /** Get the complete sink list */
78 pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb, void *userdata);
79
80 /** Stores information about sources */
81 typedef struct pa_source_info {
82 const char *name ; /**< Name of the source */
83 uint32_t index; /**< Index of the source */
84 const char *description; /**< Description of this source */
85 pa_sample_spec sample_spec; /**< Sample spec of this source */
86 pa_channel_map channel_map; /**< Channel map \since 0.8 */
87 uint32_t owner_module; /**< Owning module index, or PA_INVALID_INDEX */
88 pa_cvolume volume; /**< Volume of the source \since 0.8 */
89 int mute; /**< Mute switch of the sink \since 0.8 */
90 uint32_t monitor_of_sink; /**< If this is a monitor source the index of the owning sink, otherwise PA_INVALID_INDEX */
91 const char *monitor_of_sink_name; /**< Name of the owning sink, or PA_INVALID_INDEX */
92 pa_usec_t latency; /**< Length of filled record buffer of this source. \since 0.5 */
93 const char *driver; /**< Driver name \since 0.8 */
94 } pa_source_info;
95
96 /** Callback prototype for pa_context_get_source_info_by_name() and friends */
97 typedef void (*pa_source_info_cb_t)(pa_context *c, const pa_source_info *i, int eol, void *userdata);
98
99 /** Get information about a source by its name */
100 pa_operation* pa_context_get_source_info_by_name(pa_context *c, const char *name, pa_source_info_cb_t cb, void *userdata);
101
102 /** Get information about a source by its index */
103 pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t id, pa_source_info_cb_t cb, void *userdata);
104
105 /** Get the complete source list */
106 pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t cb, void *userdata);
107
108 /** Server information */
109 typedef struct pa_server_info {
110 const char *user_name; /**< User name of the daemon process */
111 const char *host_name; /**< Host name the daemon is running on */
112 const char *server_version; /**< Version string of the daemon */
113 const char *server_name; /**< Server package name (usually "polypaudio") */
114 pa_sample_spec sample_spec; /**< Default sample specification */
115 const char *default_sink_name; /**< Name of default sink. \since 0.4 */
116 const char *default_source_name; /**< Name of default sink. \since 0.4*/
117 uint32_t cookie; /**< A random cookie for identifying this instance of polypaudio. \since 0.8 */
118 } pa_server_info;
119
120 /** Callback prototype for pa_context_get_server_info() */
121 typedef void (*pa_server_info_cb_t) (pa_context *c, const pa_server_info*i, void *userdata);
122
123 /** Get some information about the server */
124 pa_operation* pa_context_get_server_info(pa_context *c, pa_server_info_cb_t cb, void *userdata);
125
126 /** Stores information about modules */
127 typedef struct pa_module_info {
128 uint32_t index; /**< Index of the module */
129 const char*name, /**< Name of the module */
130 *argument; /**< Argument string of the module */
131 uint32_t n_used; /**< Usage counter or PA_INVALID_INDEX */
132 int auto_unload; /**< Non-zero if this is an autoloaded module */
133 } pa_module_info;
134
135 /** Callback prototype for pa_context_get_module_info() and firends*/
136 typedef void (*pa_module_info_cb_t) (pa_context *c, const pa_module_info*i, int eol, void *userdata);
137
138 /** Get some information about a module by its index */
139 pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_info_cb_t cb, void *userdata);
140
141 /** Get the complete list of currently loaded modules */
142 pa_operation* pa_context_get_module_info_list(pa_context *c, pa_module_info_cb_t cb, void *userdata);
143
144 /** Stores information about clients */
145 typedef struct pa_client_info {
146 uint32_t index; /**< Index of this client */
147 const char *name; /**< Name of this client */
148 uint32_t owner_module; /**< Index of the owning module, or PA_INVALID_INDEX */
149 const char *driver; /**< Driver name \since 0.8 */
150 } pa_client_info;
151
152 /** Callback prototype for pa_context_get_client_info() and firends*/
153 typedef void (*pa_client_info_cb_t) (pa_context *c, const pa_client_info*i, int eol, void *userdata);
154
155 /** Get information about a client by its index */
156 pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, pa_client_info_cb_t cb, void *userdata);
157
158 /** Get the complete client list */
159 pa_operation* pa_context_get_client_info_list(pa_context *c, pa_client_info_cb_t cb, void *userdata);
160
161 /** Stores information about sink inputs */
162 typedef struct pa_sink_input_info {
163 uint32_t index; /**< Index of the sink input */
164 const char *name; /**< Name of the sink input */
165 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 */
166 uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
167 uint32_t sink; /**< Index of the connected sink */
168 pa_sample_spec sample_spec; /**< The sample specification of the sink input */
169 pa_channel_map channel_map; /**< Channel map */
170 pa_cvolume volume; /**< The volume of this sink input */
171 pa_usec_t buffer_usec; /**< Latency due to buffering in sink input, see pa_latency_info for details */
172 pa_usec_t sink_usec; /**< Latency of the sink device, see pa_latency_info for details */
173 const char *resample_method; /**< Thre resampling method used by this sink input. \since 0.7 */
174 const char *driver; /**< Driver name \since 0.8 */
175 } pa_sink_input_info;
176
177 /** Callback prototype for pa_context_get_sink_input_info() and firends*/
178 typedef void (*pa_sink_input_info_cb_t) (pa_context *c, const pa_sink_input_info *i, int eol, void *userdata);
179
180 /** Get some information about a sink input by its index */
181 pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata);
182
183 /** Get the complete sink input list */
184 pa_operation* pa_context_get_sink_input_info_list(pa_context *c, pa_sink_input_info_cb_t cb, void *userdata);
185
186 /** Stores information about source outputs */
187 typedef struct pa_source_output_info {
188 uint32_t index; /**< Index of the sink input */
189 const char *name; /**< Name of the sink input */
190 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 */
191 uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
192 uint32_t source; /**< Index of the connected source */
193 pa_sample_spec sample_spec; /**< The sample specification of the source output */
194 pa_channel_map channel_map; /**< Channel map */
195 pa_usec_t buffer_usec; /**< Latency due to buffering in the source output, see pa_latency_info for details. \since 0.5 */
196 pa_usec_t source_usec; /**< Latency of the source device, see pa_latency_info for details. \since 0.5 */
197 const char *resample_method; /**< Thre resampling method used by this source output. \since 0.7 */
198 const char *driver; /**< Driver name \since 0.8 */
199 } pa_source_output_info;
200
201 /** Callback prototype for pa_context_get_source_output_info() and firends*/
202 typedef void (*pa_source_output_info_cb_t) (pa_context *c, const pa_source_output_info *i, int eol, void *userdata);
203
204 /** Get information about a source output by its index */
205 pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_source_output_info_cb_t cb, void *userdata);
206
207 /** Get the complete list of source outputs */
208 pa_operation* pa_context_get_source_output_info_list(pa_context *c, pa_source_output_info_cb_t cb, void *userdata);
209
210 /** Set the volume of a sink device specified by its index */
211 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);
212
213 /** Set the volume of a sink device specified by its name */
214 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);
215
216 /** Set the mute switch of a sink device specified by its index \since 0.8 */
217 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);
218
219 /** Set the mute switch of a sink device specified by its name \since 0.8 */
220 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);
221
222 /** Set the volume of a sink input stream */
223 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);
224
225 /** Set the volume of a source device specified by its index \since 0.8 */
226 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);
227
228 /** Set the volume of a source device specified by its name \since 0.8 */
229 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);
230
231 /** Set the mute switch of a source device specified by its index \since 0.8 */
232 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);
233
234 /** Set the mute switch of a source device specified by its name \since 0.8 */
235 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);
236
237 /** Memory block statistics */
238 typedef struct pa_stat_info {
239 uint32_t memblock_total; /**< Currently allocated memory blocks */
240 uint32_t memblock_total_size; /**< Currentl total size of allocated memory blocks */
241 uint32_t memblock_allocated; /**< Allocated memory blocks during the whole lifetime of the daemon */
242 uint32_t memblock_allocated_size; /**< Total size of all memory blocks allocated during the whole lifetime of the daemon */
243 uint32_t scache_size; /**< Total size of all sample cache entries. \since 0.4 */
244 } pa_stat_info;
245
246 /** Callback prototype for pa_context_stat() */
247 typedef void (*pa_stat_info_cb_t) (pa_context *c, const pa_stat_info *i, void *userdata);
248
249 /** Get daemon memory block statistics */
250 pa_operation* pa_context_stat(pa_context *c, pa_stat_info_cb_t cb, void *userdata);
251
252 /** Stores information about sample cache entries */
253 typedef struct pa_sample_info {
254 uint32_t index; /**< Index of this entry */
255 const char *name; /**< Name of this entry */
256 pa_cvolume volume; /**< Default volume of this entry */
257 pa_sample_spec sample_spec; /**< Sample specification of the sample */
258 pa_channel_map channel_map; /**< The channel map */
259 pa_usec_t duration; /**< Duration of this entry */
260 uint32_t bytes; /**< Length of this sample in bytes. \since 0.4 */
261 int lazy; /**< Non-zero when this is a lazy cache entry. \since 0.5 */
262 const char *filename; /**< In case this is a lazy cache entry, the filename for the sound file to be loaded on demand. \since 0.5 */
263 } pa_sample_info;
264
265 /** Callback prototype for pa_context_get_sample_info_by_name() and firends */
266 typedef void (*pa_sample_info_cb_t)(pa_context *c, const pa_sample_info *i, int eol, void *userdata);
267
268 /** Get information about a sample by its name */
269 pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name, pa_sample_info_cb_t cb, void *userdata);
270
271 /** Get information about a sample by its index */
272 pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, pa_sample_info_cb_t cb, void *userdata);
273
274 /** Get the complete list of samples stored in the daemon. */
275 pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t cb, void *userdata);
276
277 /** Kill a client. \since 0.5 */
278 pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
279
280 /** Kill a sink input. \since 0.5 */
281 pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
282
283 /** Kill a source output. \since 0.5 */
284 pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
285
286 /** Callback prototype for pa_context_load_module() and pa_context_add_autoload() */
287 typedef void (*pa_context_index_cb_t)(pa_context *c, uint32_t idx, void *userdata);
288
289 /** Load a module. \since 0.5 */
290 pa_operation* pa_context_load_module(pa_context *c, const char*name, const char *argument, pa_context_index_cb_t cb, void *userdata);
291
292 /** Unload a module. \since 0.5 */
293 pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
294
295 /** Type of an autoload entry. \since 0.5 */
296 typedef enum pa_autoload_type {
297 PA_AUTOLOAD_SINK = 0,
298 PA_AUTOLOAD_SOURCE = 1
299 } pa_autoload_type_t;
300
301 /** Stores information about autoload entries. \since 0.5 */
302 typedef struct pa_autoload_info {
303 uint32_t index; /**< Index of this autoload entry */
304 const char *name; /**< Name of the sink or source */
305 pa_autoload_type_t type; /**< Type of the autoload entry */
306 const char *module; /**< Module name to load */
307 const char *argument; /**< Argument string for module */
308 } pa_autoload_info;
309
310 /** Callback prototype for pa_context_get_autoload_info_by_name() and firends */
311 typedef void (*pa_autoload_info_cb_t)(pa_context *c, const pa_autoload_info *i, int eol, void *userdata);
312
313 /** Get info about a specific autoload entry. \since 0.6 */
314 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);
315
316 /** Get info about a specific autoload entry. \since 0.6 */
317 pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, pa_autoload_info_cb_t cb, void *userdata);
318
319 /** Get the complete list of autoload entries. \since 0.5 */
320 pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata);
321
322 /** Add a new autoload entry. \since 0.5 */
323 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);
324
325 /** Remove an autoload entry. \since 0.6 */
326 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);
327
328 /** Remove an autoload entry. \since 0.6 */
329 pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata);
330
331
332 PA_C_DECL_END
333
334 #endif