1 #ifndef foointrospecthfoo
2 #define foointrospecthfoo
7 This file is part of polypaudio.
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.
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.
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
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>
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.
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. */
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.9 */
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 uint32_t monitor_source
; /**< Index of the monitor source connected to this sink */
62 const char *monitor_source_name
; /**< The name of the monitor source */
63 pa_usec_t latency
; /**< Length of filled playback buffer of this sink */
64 const char *driver
; /**< Driver name. \since 0.9 */
67 /** Callback prototype for pa_context_get_sink_info_by_name() and friends */
68 typedef void (*pa_sink_info_cb_t
)(pa_context
*c
, const pa_sink_info
*i
, int eol
, void *userdata
);
70 /** Get information about a sink by its name */
71 pa_operation
* pa_context_get_sink_info_by_name(pa_context
*c
, const char *name
, pa_sink_info_cb_t cb
, void *userdata
);
73 /** Get information about a sink by its index */
74 pa_operation
* pa_context_get_sink_info_by_index(pa_context
*c
, uint32_t id
, pa_sink_info_cb_t cb
, void *userdata
);
76 /** Get the complete sink list */
77 pa_operation
* pa_context_get_sink_info_list(pa_context
*c
, pa_sink_info_cb_t cb
, void *userdata
);
79 /** Stores information about sources */
80 typedef struct pa_source_info
{
81 const char *name
; /**< Name of the source */
82 uint32_t index
; /**< Index of the source */
83 const char *description
; /**< Description of this source */
84 pa_sample_spec sample_spec
; /**< Sample spec of this source */
85 pa_channel_map channel_map
; /**< Channel map \since 0.9 */
86 uint32_t owner_module
; /**< Owning module index, or PA_INVALID_INDEX */
87 uint32_t monitor_of_sink
; /**< If this is a monitor source the index of the owning sink, otherwise PA_INVALID_INDEX */
88 const char *monitor_of_sink_name
; /**< Name of the owning sink, or PA_INVALID_INDEX */
89 pa_usec_t latency
; /**< Length of filled record buffer of this source. \since 0.5 */
90 const char *driver
; /**< Driver name \since 0.9 */
93 /** Callback prototype for pa_context_get_source_info_by_name() and friends */
94 typedef void (*pa_source_info_cb_t
)(pa_context
*c
, const pa_source_info
*i
, int eol
, void *userdata
);
96 /** Get information about a source by its name */
97 pa_operation
* pa_context_get_source_info_by_name(pa_context
*c
, const char *name
, pa_source_info_cb_t cb
, void *userdata
);
99 /** Get information about a source by its index */
100 pa_operation
* pa_context_get_source_info_by_index(pa_context
*c
, uint32_t id
, pa_source_info_cb_t cb
, void *userdata
);
102 /** Get the complete source list */
103 pa_operation
* pa_context_get_source_info_list(pa_context
*c
, pa_source_info_cb_t cb
, void *userdata
);
105 /** Server information */
106 typedef struct pa_server_info
{
107 const char *user_name
; /**< User name of the daemon process */
108 const char *host_name
; /**< Host name the daemon is running on */
109 const char *server_version
; /**< Version string of the daemon */
110 const char *server_name
; /**< Server package name (usually "polypaudio") */
111 pa_sample_spec sample_spec
; /**< Default sample specification */
112 const char *default_sink_name
; /**< Name of default sink. \since 0.4 */
113 const char *default_source_name
; /**< Name of default sink. \since 0.4*/
114 uint32_t cookie
; /**< A random cookie for identifying this instance of polypaudio. \since 0.8 */
117 /** Callback prototype for pa_context_get_server_info() */
118 typedef void (*pa_server_info_cb_t
) (pa_context
*c
, const pa_server_info
*i
, void *userdata
);
120 /** Get some information about the server */
121 pa_operation
* pa_context_get_server_info(pa_context
*c
, pa_server_info_cb_t cb
, void *userdata
);
123 /** Stores information about modules */
124 typedef struct pa_module_info
{
125 uint32_t index
; /**< Index of the module */
126 const char*name
, /**< Name of the module */
127 *argument
; /**< Argument string of the module */
128 uint32_t n_used
; /**< Usage counter or PA_INVALID_INDEX */
129 int auto_unload
; /**< Non-zero if this is an autoloaded module */
132 /** Callback prototype for pa_context_get_module_info() and firends*/
133 typedef void (*pa_module_info_cb_t
) (pa_context
*c
, const pa_module_info
*i
, int eol
, void *userdata
);
135 /** Get some information about a module by its index */
136 pa_operation
* pa_context_get_module_info(pa_context
*c
, uint32_t idx
, pa_module_info_cb_t cb
, void *userdata
);
138 /** Get the complete list of currently loaded modules */
139 pa_operation
* pa_context_get_module_info_list(pa_context
*c
, pa_module_info_cb_t cb
, void *userdata
);
141 /** Stores information about clients */
142 typedef struct pa_client_info
{
143 uint32_t index
; /**< Index of this client */
144 const char *name
; /**< Name of this client */
145 uint32_t owner_module
; /**< Index of the owning module, or PA_INVALID_INDEX */
146 const char *driver
; /**< Driver name \since 0.9 */
149 /** Callback prototype for pa_context_get_client_info() and firends*/
150 typedef void (*pa_client_info_cb_t
) (pa_context
*c
, const pa_client_info
*i
, int eol
, void *userdata
);
152 /** Get information about a client by its index */
153 pa_operation
* pa_context_get_client_info(pa_context
*c
, uint32_t idx
, pa_client_info_cb_t cb
, void *userdata
);
155 /** Get the complete client list */
156 pa_operation
* pa_context_get_client_info_list(pa_context
*c
, pa_client_info_cb_t cb
, void *userdata
);
158 /** Stores information about sink inputs */
159 typedef struct pa_sink_input_info
{
160 uint32_t index
; /**< Index of the sink input */
161 const char *name
; /**< Name of the sink input */
162 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 */
163 uint32_t client
; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
164 uint32_t sink
; /**< Index of the connected sink */
165 pa_sample_spec sample_spec
; /**< The sample specification of the sink input */
166 pa_channel_map channel_map
; /**< Channel map */
167 pa_cvolume volume
; /**< The volume of this sink input */
168 pa_usec_t buffer_usec
; /**< Latency due to buffering in sink input, see pa_latency_info for details */
169 pa_usec_t sink_usec
; /**< Latency of the sink device, see pa_latency_info for details */
170 const char *resample_method
; /**< Thre resampling method used by this sink input. \since 0.7 */
171 const char *driver
; /**< Driver name \since 0.9 */
172 } pa_sink_input_info
;
174 /** Callback prototype for pa_context_get_sink_input_info() and firends*/
175 typedef void (*pa_sink_input_info_cb_t
) (pa_context
*c
, const pa_sink_input_info
*i
, int eol
, void *userdata
);
177 /** Get some information about a sink input by its index */
178 pa_operation
* pa_context_get_sink_input_info(pa_context
*c
, uint32_t idx
, pa_sink_input_info_cb_t cb
, void *userdata
);
180 /** Get the complete sink input list */
181 pa_operation
* pa_context_get_sink_input_info_list(pa_context
*c
, pa_sink_input_info_cb_t cb
, void *userdata
);
183 /** Stores information about source outputs */
184 typedef struct pa_source_output_info
{
185 uint32_t index
; /**< Index of the sink input */
186 const char *name
; /**< Name of the sink input */
187 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 */
188 uint32_t client
; /**< Index of the client this sink input belongs to, or PA_INVALID_INDEX when it does not belong to any client */
189 uint32_t source
; /**< Index of the connected source */
190 pa_sample_spec sample_spec
; /**< The sample specification of the source output */
191 pa_channel_map channel_map
; /**< Channel map */
192 pa_usec_t buffer_usec
; /**< Latency due to buffering in the source output, see pa_latency_info for details. \since 0.5 */
193 pa_usec_t source_usec
; /**< Latency of the source device, see pa_latency_info for details. \since 0.5 */
194 const char *resample_method
; /**< Thre resampling method used by this source output. \since 0.7 */
195 const char *driver
; /**< Driver name \since 0.9 */
196 } pa_source_output_info
;
198 /** Callback prototype for pa_context_get_source_output_info() and firends*/
199 typedef void (*pa_source_output_info_cb_t
) (pa_context
*c
, const pa_source_output_info
*i
, int eol
, void *userdata
);
201 /** Get information about a source output by its index */
202 pa_operation
* pa_context_get_source_output_info(pa_context
*c
, uint32_t idx
, pa_source_output_info_cb_t cb
, void *userdata
);
204 /** Get the complete list of source outputs */
205 pa_operation
* pa_context_get_source_output_info_list(pa_context
*c
, pa_source_output_info_cb_t cb
, void *userdata
);
207 /** Set the volume of a sink device specified by its index */
208 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
);
210 /** Set the volume of a sink device specified by its name */
211 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
);
213 /** Set the volume of a sink input stream */
214 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
);
216 /** Memory block statistics */
217 typedef struct pa_stat_info
{
218 uint32_t memblock_total
; /**< Currently allocated memory blocks */
219 uint32_t memblock_total_size
; /**< Currentl total size of allocated memory blocks */
220 uint32_t memblock_allocated
; /**< Allocated memory blocks during the whole lifetime of the daemon */
221 uint32_t memblock_allocated_size
; /**< Total size of all memory blocks allocated during the whole lifetime of the daemon */
222 uint32_t scache_size
; /**< Total size of all sample cache entries. \since 0.4 */
225 /** Callback prototype for pa_context_stat() */
226 typedef void (*pa_stat_info_cb_t
) (pa_context
*c
, const pa_stat_info
*i
, void *userdata
);
228 /** Get daemon memory block statistics */
229 pa_operation
* pa_context_stat(pa_context
*c
, pa_stat_info_cb_t cb
, void *userdata
);
231 /** Stores information about sample cache entries */
232 typedef struct pa_sample_info
{
233 uint32_t index
; /**< Index of this entry */
234 const char *name
; /**< Name of this entry */
235 pa_cvolume volume
; /**< Default volume of this entry */
236 pa_sample_spec sample_spec
; /**< Sample specification of the sample */
237 pa_channel_map channel_map
; /**< The channel map */
238 pa_usec_t duration
; /**< Duration of this entry */
239 uint32_t bytes
; /**< Length of this sample in bytes. \since 0.4 */
240 int lazy
; /**< Non-zero when this is a lazy cache entry. \since 0.5 */
241 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 */
244 /** Callback prototype for pa_context_get_sample_info_by_name() and firends */
245 typedef void (*pa_sample_info_cb_t
)(pa_context
*c
, const pa_sample_info
*i
, int eol
, void *userdata
);
247 /** Get information about a sample by its name */
248 pa_operation
* pa_context_get_sample_info_by_name(pa_context
*c
, const char *name
, pa_sample_info_cb_t cb
, void *userdata
);
250 /** Get information about a sample by its index */
251 pa_operation
* pa_context_get_sample_info_by_index(pa_context
*c
, uint32_t idx
, pa_sample_info_cb_t cb
, void *userdata
);
253 /** Get the complete list of samples stored in the daemon. */
254 pa_operation
* pa_context_get_sample_info_list(pa_context
*c
, pa_sample_info_cb_t cb
, void *userdata
);
256 /** Kill a client. \since 0.5 */
257 pa_operation
* pa_context_kill_client(pa_context
*c
, uint32_t idx
, pa_context_success_cb_t cb
, void *userdata
);
259 /** Kill a sink input. \since 0.5 */
260 pa_operation
* pa_context_kill_sink_input(pa_context
*c
, uint32_t idx
, pa_context_success_cb_t cb
, void *userdata
);
262 /** Kill a source output. \since 0.5 */
263 pa_operation
* pa_context_kill_source_output(pa_context
*c
, uint32_t idx
, pa_context_success_cb_t cb
, void *userdata
);
265 /** Callback prototype for pa_context_load_module() and pa_context_add_autoload() */
266 typedef void (*pa_context_index_cb_t
)(pa_context
*c
, uint32_t idx
, void *userdata
);
268 /** Load a module. \since 0.5 */
269 pa_operation
* pa_context_load_module(pa_context
*c
, const char*name
, const char *argument
, pa_context_index_cb_t cb
, void *userdata
);
271 /** Unload a module. \since 0.5 */
272 pa_operation
* pa_context_unload_module(pa_context
*c
, uint32_t idx
, pa_context_success_cb_t cb
, void *userdata
);
274 /** Type of an autoload entry. \since 0.5 */
275 typedef enum pa_autoload_type
{
276 PA_AUTOLOAD_SINK
= 0,
277 PA_AUTOLOAD_SOURCE
= 1
278 } pa_autoload_type_t
;
280 /** Stores information about autoload entries. \since 0.5 */
281 typedef struct pa_autoload_info
{
282 uint32_t index
; /**< Index of this autoload entry */
283 const char *name
; /**< Name of the sink or source */
284 pa_autoload_type_t type
; /**< Type of the autoload entry */
285 const char *module
; /**< Module name to load */
286 const char *argument
; /**< Argument string for module */
289 /** Callback prototype for pa_context_get_autoload_info_by_name() and firends */
290 typedef void (*pa_autoload_info_cb_t
)(pa_context
*c
, const pa_autoload_info
*i
, int eol
, void *userdata
);
292 /** Get info about a specific autoload entry. \since 0.6 */
293 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
);
295 /** Get info about a specific autoload entry. \since 0.6 */
296 pa_operation
* pa_context_get_autoload_info_by_index(pa_context
*c
, uint32_t idx
, pa_autoload_info_cb_t cb
, void *userdata
);
298 /** Get the complete list of autoload entries. \since 0.5 */
299 pa_operation
* pa_context_get_autoload_info_list(pa_context
*c
, pa_autoload_info_cb_t cb
, void *userdata
);
301 /** Add a new autoload entry. \since 0.5 */
302 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
);
304 /** Remove an autoload entry. \since 0.6 */
305 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
);
307 /** Remove an autoload entry. \since 0.6 */
308 pa_operation
* pa_context_remove_autoload_by_index(pa_context
*c
, uint32_t idx
, pa_context_success_cb_t cb
, void* userdata
);