]> code.delx.au - pulseaudio/blob - src/polyp/introspect.h
0abb54cf2f202b867342c7e0ea86dadbc2ae45e3
[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 * is_last=1 and i=NULL. Strings referenced in pa_xxx_info structures
40 * and the structures themselves point to internal memory that may not
41 * be modified. That memory is only valid during the call to the
42 * callback function. A deep copy is required if you need this data
43 * outside the callback functions. An error is signalled by a call to * the callback function with i=NULL and is_last=0.
44 *
45 * When using the routines that ask fo a single entry only, a callback
46 * with the same signature is used. However, no finishing call to the
47 * routine is issued. */
48
49 PA_C_DECL_BEGIN
50
51 /** Stores information about sinks */
52 typedef struct pa_sink_info {
53 const char *name; /**< Name of the sink */
54 uint32_t index; /**< Index of the sink */
55 const char *description; /**< Description of this sink */
56 pa_sample_spec sample_spec; /**< Sample spec of this sink */
57 pa_channel_map channel_map; /**< Channel map \since 0.9 */
58 uint32_t owner_module; /**< Index of the owning module of this sink, or PA_INVALID_INDEX */
59 pa_cvolume volume; /**< Volume of the sink */
60 uint32_t monitor_source; /**< Index of the monitor source connected to this sink */
61 const char *monitor_source_name; /**< The name of the monitor source */
62 pa_usec_t latency; /**< Length of filled playback buffer of this sink */
63 const char *driver; /**< Driver name. \since 0.9 */
64 } pa_sink_info;
65
66 /** Get information about a sink by its name */
67 pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name, void (*cb)(pa_context *c, const pa_sink_info *i, int is_last, void *userdata), void *userdata);
68
69 /** Get information about a sink by its index */
70 pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t id, void (*cb)(pa_context *c, const pa_sink_info *i, int is_last, void *userdata), void *userdata);
71
72 /** Get the complete sink list */
73 pa_operation* pa_context_get_sink_info_list(pa_context *c, void (*cb)(pa_context *c, const pa_sink_info *i, int is_last, void *userdata), void *userdata);
74
75 /** Stores information about sources */
76 typedef struct pa_source_info {
77 const char *name ; /**< Name of the source */
78 uint32_t index; /**< Index of the source */
79 const char *description; /**< Description of this source */
80 pa_sample_spec sample_spec; /**< Sample spec of this source */
81 pa_channel_map channel_map; /**< Channel map \since 0.9 */
82 uint32_t owner_module; /**< Owning module index, or PA_INVALID_INDEX */
83 uint32_t monitor_of_sink; /**< If this is a monitor source the index of the owning sink, otherwise PA_INVALID_INDEX */
84 const char *monitor_of_sink_name; /**< Name of the owning sink, or PA_INVALID_INDEX */
85 pa_usec_t latency; /**< Length of filled record buffer of this source. \since 0.5 */
86 const char *driver; /**< Driver name \since 0.9 */
87 } pa_source_info;
88
89 /** Get information about a source by its name */
90 pa_operation* pa_context_get_source_info_by_name(pa_context *c, const char *name, void (*cb)(pa_context *c, const pa_source_info *i, int is_last, void *userdata), void *userdata);
91
92 /** Get information about a source by its index */
93 pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t id, void (*cb)(pa_context *c, const pa_source_info *i, int is_last, void *userdata), void *userdata);
94
95 /** Get the complete source list */
96 pa_operation* pa_context_get_source_info_list(pa_context *c, void (*cb)(pa_context *c, const pa_source_info *i, int is_last, void *userdata), void *userdata);
97
98 /** Server information */
99 typedef struct pa_server_info {
100 const char *user_name; /**< User name of the daemon process */
101 const char *host_name; /**< Host name the daemon is running on */
102 const char *server_version; /**< Version string of the daemon */
103 const char *server_name; /**< Server package name (usually "polypaudio") */
104 pa_sample_spec sample_spec; /**< Default sample specification */
105 const char *default_sink_name; /**< Name of default sink. \since 0.4 */
106 const char *default_source_name; /**< Name of default sink. \since 0.4*/
107 uint32_t cookie; /**< A random cookie for identifying this instance of polypaudio. \since 0.8 */
108 } pa_server_info;
109
110 /** Get some information about the server */
111 pa_operation* pa_context_get_server_info(pa_context *c, void (*cb)(pa_context *c, const pa_server_info*i, void *userdata), void *userdata);
112
113 /** Stores information about modules */
114 typedef struct pa_module_info {
115 uint32_t index; /**< Index of the module */
116 const char*name, /**< Name of the module */
117 *argument; /**< Argument string of the module */
118 uint32_t n_used; /**< Usage counter or PA_INVALID_INDEX */
119 int auto_unload; /**< Non-zero if this is an autoloaded module */
120 } pa_module_info;
121
122 /** Get some information about a module by its index */
123 pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, const pa_module_info*i, int is_last, void *userdata), void *userdata);
124
125 /** Get the complete list of currently loaded modules */
126 pa_operation* pa_context_get_module_info_list(pa_context *c, void (*cb)(pa_context *c, const pa_module_info*i, int is_last, void *userdata), void *userdata);
127
128 /** Stores information about clients */
129 typedef struct pa_client_info {
130 uint32_t index; /**< Index of this client */
131 const char *name; /**< Name of this client */
132 uint32_t owner_module; /**< Index of the owning module, or PA_INVALID_INDEX */
133 const char *driver; /**< Driver name \since 0.9 */
134 } pa_client_info;
135
136 /** Get information about a client by its index */
137 pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, const pa_client_info*i, int is_last, void *userdata), void *userdata);
138
139 /** Get the complete client list */
140 pa_operation* pa_context_get_client_info_list(pa_context *c, void (*cb)(pa_context *c, const pa_client_info*i, int is_last, void *userdata), void *userdata);
141
142 /** Stores information about sink inputs */
143 typedef struct pa_sink_input_info {
144 uint32_t index; /**< Index of the sink input */
145 const char *name; /**< Name of the sink input */
146 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 */
147 uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
148 uint32_t sink; /**< Index of the connected sink */
149 pa_sample_spec sample_spec; /**< The sample specification of the sink input */
150 pa_channel_map channel_map; /**< Channel map */
151 pa_cvolume volume; /**< The volume of this sink input */
152 pa_usec_t buffer_usec; /**< Latency due to buffering in sink input, see pa_latency_info for details */
153 pa_usec_t sink_usec; /**< Latency of the sink device, see pa_latency_info for details */
154 const char *resample_method; /**< Thre resampling method used by this sink input. \since 0.7 */
155 const char *driver; /**< Driver name \since 0.9 */
156 } pa_sink_input_info;
157
158 /** Get some information about a sink input by its index */
159 pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, const pa_sink_input_info*i, int is_last, void *userdata), void *userdata);
160
161 /** Get the complete sink input list */
162 pa_operation* pa_context_get_sink_input_info_list(pa_context *c, void (*cb)(pa_context *c, const pa_sink_input_info*i, int is_last, void *userdata), void *userdata);
163
164 /** Stores information about source outputs */
165 typedef struct pa_source_output_info {
166 uint32_t index; /**< Index of the sink input */
167 const char *name; /**< Name of the sink input */
168 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 */
169 uint32_t client; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
170 uint32_t source; /**< Index of the connected source */
171 pa_sample_spec sample_spec; /**< The sample specification of the source output */
172 pa_channel_map channel_map; /**< Channel map */
173 pa_usec_t buffer_usec; /**< Latency due to buffering in the source output, see pa_latency_info for details. \since 0.5 */
174 pa_usec_t source_usec; /**< Latency of the source device, see pa_latency_info for details. \since 0.5 */
175 const char *resample_method; /**< Thre resampling method used by this source output. \since 0.7 */
176 const char *driver; /**< Driver name \since 0.9 */
177 } pa_source_output_info;
178
179 /** Get information about a source output by its index */
180 pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, const pa_source_output_info*i, int is_last, void *userdata), void *userdata);
181
182 /** Get the complete list of source outputs */
183 pa_operation* pa_context_get_source_output_info_list(pa_context *c, void (*cb)(pa_context *c, const pa_source_output_info*i, int is_last, void *userdata), void *userdata);
184
185 /** Set the volume of a sink device specified by its index */
186 pa_operation* pa_context_set_sink_volume_by_index(pa_context *c, uint32_t idx, const pa_cvolume *volume, void (*cb)(pa_context *c, int success, void *userdata), void *userdata);
187
188 /** Set the volume of a sink device specified by its name */
189 pa_operation* pa_context_set_sink_volume_by_name(pa_context *c, const char *name, const pa_cvolume *volume, void (*cb)(pa_context *c, int success, void *userdata), void *userdata);
190
191 /** Set the volume of a sink input stream */
192 pa_operation* pa_context_set_sink_input_volume(pa_context *c, uint32_t idx, const pa_cvolume *volume, void (*cb)(pa_context *c, int success, void *userdata), void *userdata);
193
194 /** Memory block statistics */
195 typedef struct pa_stat_info {
196 uint32_t memblock_total; /**< Currently allocated memory blocks */
197 uint32_t memblock_total_size; /**< Currentl total size of allocated memory blocks */
198 uint32_t memblock_allocated; /**< Allocated memory blocks during the whole lifetime of the daemon */
199 uint32_t memblock_allocated_size; /**< Total size of all memory blocks allocated during the whole lifetime of the daemon */
200 uint32_t scache_size; /**< Total size of all sample cache entries. \since 0.4 */
201 } pa_stat_info;
202
203 /** Get daemon memory block statistics */
204 pa_operation* pa_context_stat(pa_context *c, void (*cb)(pa_context *c, const pa_stat_info *i, void *userdata), void *userdata);
205
206 /** Stores information about sample cache entries */
207 typedef struct pa_sample_info {
208 uint32_t index; /**< Index of this entry */
209 const char *name; /**< Name of this entry */
210 pa_cvolume volume; /**< Default volume of this entry */
211 pa_sample_spec sample_spec; /**< Sample specification of the sample */
212 pa_channel_map channel_map; /**< The channel map */
213 pa_usec_t duration; /**< Duration of this entry */
214 uint32_t bytes; /**< Length of this sample in bytes. \since 0.4 */
215 int lazy; /**< Non-zero when this is a lazy cache entry. \since 0.5 */
216 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 */
217 } pa_sample_info;
218
219 /** Get information about a sample by its name */
220 pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name, void (*cb)(pa_context *c, const pa_sample_info *i, int is_last, void *userdata), void *userdata);
221
222 /** Get information about a sample by its index */
223 pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, const pa_sample_info *i, int is_last, void *userdata), void *userdata);
224
225 /** Get the complete list of samples stored in the daemon. */
226 pa_operation* pa_context_get_sample_info_list(pa_context *c, void (*cb)(pa_context *c, const pa_sample_info *i, int is_last, void *userdata), void *userdata);
227
228 /** Kill a client. \since 0.5 */
229 pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, int success, void *userdata), void *userdata);
230
231 /** Kill a sink input. \since 0.5 */
232 pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, int success, void *userdata), void *userdata);
233
234 /** Kill a source output. \since 0.5 */
235 pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, int success, void *userdata), void *userdata);
236
237 /** Load a module. \since 0.5 */
238 pa_operation* pa_context_load_module(pa_context *c, const char*name, const char *argument, void (*cb)(pa_context *c, uint32_t idx, void *userdata), void *userdata);
239
240 /** Unload a module. \since 0.5 */
241 pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, int success, void *userdata), void *userdata);
242
243 /** Type of an autoload entry. \since 0.5 */
244 typedef enum pa_autoload_type {
245 PA_AUTOLOAD_SINK = 0,
246 PA_AUTOLOAD_SOURCE = 1
247 } pa_autoload_type_t;
248
249 /** Stores information about autoload entries. \since 0.5 */
250 typedef struct pa_autoload_info {
251 uint32_t index; /**< Index of this autoload entry */
252 const char *name; /**< Name of the sink or source */
253 pa_autoload_type_t type; /**< Type of the autoload entry */
254 const char *module; /**< Module name to load */
255 const char *argument; /**< Argument string for module */
256 } pa_autoload_info;
257
258 /** Get info about a specific autoload entry. \since 0.6 */
259 pa_operation* pa_context_get_autoload_info_by_name(pa_context *c, const char *name, pa_autoload_type_t type, void (*cb)(pa_context *c, const pa_autoload_info *i, int is_last, void *userdata), void *userdata);
260
261 /** Get info about a specific autoload entry. \since 0.6 */
262 pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, const pa_autoload_info *i, int is_last, void *userdata), void *userdata);
263
264 /** Get the complete list of autoload entries. \since 0.5 */
265 pa_operation* pa_context_get_autoload_info_list(pa_context *c, void (*cb)(pa_context *c, const pa_autoload_info *i, int is_last, void *userdata), void *userdata);
266
267 /** Add a new autoload entry. \since 0.5 */
268 pa_operation* pa_context_add_autoload(pa_context *c, const char *name, pa_autoload_type_t type, const char *module, const char*argument, void (*cb)(pa_context *c, int idx, void *userdata), void* userdata);
269
270 /** Remove an autoload entry. \since 0.6 */
271 pa_operation* pa_context_remove_autoload_by_name(pa_context *c, const char *name, pa_autoload_type_t type, void (*cb)(pa_context *c, int success, void *userdata), void* userdata);
272
273 /** Remove an autoload entry. \since 0.6 */
274 pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, void (*cb)(pa_context *c, int success, void *userdata), void* userdata);
275
276
277 PA_C_DECL_END
278
279 #endif