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