source: roaraudio/libroarpulse/introspect.c @ 3519:2662df894209

Last change on this file since 3519:2662df894209 was 3517:1a3218a3fc5b, checked in by phi, 14 years ago

updated license headers, FSF moved office

File size: 11.3 KB
Line 
1//introspect.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
5 *  The code (may) include prototypes and comments (and maybe
6 *  other code fragements) from libpulse*. They are mostly copyrighted by:
7 *  Lennart Poettering <poettering@users.sourceforge.net> and
8 *  Pierre Ossman <drzeus@drzeus.cx>
9 *
10 *  This file is part of libroarpulse a part of RoarAudio,
11 *  a cross-platform sound system for both, home and professional use.
12 *  See README for details.
13 *
14 *  This file is free software; you can redistribute it and/or modify
15 *  it under the terms of the GNU General Public License version 3
16 *  as published by the Free Software Foundation.
17 *
18 *  RoarAudio is distributed in the hope that it will be useful,
19 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *  GNU General Public License for more details.
22 *
23 *  You should have received a copy of the GNU General Public License
24 *  along with this software; see the file COPYING.  If not, write to
25 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
26 *  Boston, MA 02110-1301, USA.
27 *
28 *  NOTE for everyone want's to change something and send patches:
29 *  read README and HACKING! There a addition information on
30 *  the license of this document you need to read before you send
31 *  any patches.
32 *
33 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
34 *  or libpulse*:
35 *  The libs libroaresd, libroararts and libroarpulse link this libroar
36 *  and are therefore GPL. Because of this it may be illigal to use
37 *  them with any software that uses libesd, libartsc or libpulse*.
38 */
39
40#include <libroarpulse/libroarpulse.h>
41
42/** Get information about a sink by its name */
43pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name, pa_sink_info_cb_t cb, void *userdata) {
44 struct roar_stream stream;
45 pa_sink_info painfo;
46
47 if ( c == NULL || cb == NULL )
48  return roar_pa_op_new_done();
49
50 memset(&painfo, 0, sizeof(painfo));
51
52 if ( !!strcasecmp(name, ROAR_PA_DEFAULT_SINK) )
53  return roar_pa_op_new_done();
54
55 if ( roar_server_oinfo(roar_pa_context_get_con(c), &stream) == -1 )
56  return roar_pa_op_new_done();
57
58 if ( roar_pa_auinfo2sspec(&(painfo.sample_spec), &(stream.info)) == -1 )
59  return roar_pa_op_new_done();
60
61 pa_channel_map_init_auto(&(painfo.channel_map), stream.info.channels, PA_CHANNEL_MAP_DEFAULT);
62// pa_cvolume_init(&(painfo.volume));
63
64 painfo.name                = ROAR_PA_DEFAULT_SINK;
65 painfo.index               = 0;
66 painfo.description         = "RoarAudio default mixer";
67 painfo.owner_module        = PA_INVALID_INDEX;
68 painfo.mute                = 0;
69 painfo.monitor_source      = 0;
70 painfo.monitor_source_name = ROAR_PA_DEFAULT_SOURCE;
71 painfo.latency             = 0;
72 painfo.driver              = "Waveform Mixer Core";
73// painfo.pa_sink_flags_t     = 0;
74
75 cb(c, &painfo, 1, userdata);
76
77 return roar_pa_op_new_done();
78}
79
80/** Get information about a sink by its index */
81pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t id, pa_sink_info_cb_t cb, void *userdata);
82
83/** Get the complete sink list */
84pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb, void *userdata);
85
86/** Get information about a source by its name */
87pa_operation* pa_context_get_source_info_by_name(pa_context *c, const char *name, pa_source_info_cb_t cb, void *userdata);
88
89/** Get information about a source by its index */
90pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t id, pa_source_info_cb_t cb, void *userdata);
91
92/** Get the complete source list */
93pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t cb, void *userdata);
94
95/** Get some information about the server */
96pa_operation* pa_context_get_server_info(pa_context *c, pa_server_info_cb_t cb, void *userdata) {
97 struct roar_stream stream;
98 struct roar_client client;
99 pa_server_info painfo;
100
101 if ( c == NULL || cb == NULL )
102  return roar_pa_op_new_done();
103
104 if ( roar_server_oinfo(roar_pa_context_get_con(c), &stream) == -1 )
105  return roar_pa_op_new_done();
106
107 if ( roar_get_client(roar_pa_context_get_con(c), &client, 0) == -1 )
108  return roar_pa_op_new_done();
109
110 memset(&painfo, 0, sizeof(painfo));
111
112 if ( roar_pa_auinfo2sspec(&(painfo.sample_spec), &(stream.info)) == -1 )
113  return roar_pa_op_new_done();
114
115 painfo.user_name           = "(none)";
116 painfo.host_name           = pa_context_get_server(c);
117 painfo.server_version      = pa_get_library_version();
118 painfo.server_name         = "pulseaudio";
119 painfo.default_sink_name   = ROAR_PA_DEFAULT_SINK;
120 painfo.default_source_name = ROAR_PA_DEFAULT_SOURCE;
121 painfo.cookie              = 0x524F4152;
122 painfo.cookie             ^= (client.pid & 0xFF) | (client.uid & 0xFF) << 8 | (client.gid & 0xFF) << 16;
123
124 cb(c, &painfo, userdata);
125
126 return roar_pa_op_new_done();
127}
128
129/** Get some information about a module by its index */
130pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_info_cb_t cb, void *userdata);
131
132/** Get the complete list of currently loaded modules */
133pa_operation* pa_context_get_module_info_list(pa_context *c, pa_module_info_cb_t cb, void *userdata);
134
135/** Get information about a client by its index */
136pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, pa_client_info_cb_t cb, void *userdata);
137
138/** Get the complete client list */
139pa_operation* pa_context_get_client_info_list(pa_context *c, pa_client_info_cb_t cb, void *userdata);
140
141/** Get some information about a sink input by its index */
142pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata);
143
144/** Get the complete sink input list */
145pa_operation* pa_context_get_sink_input_info_list(pa_context *c, pa_sink_input_info_cb_t cb, void *userdata);
146
147/** Get information about a source output by its index */
148pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_source_output_info_cb_t cb, void *userdata);
149
150/** Get the complete list of source outputs */
151pa_operation* pa_context_get_source_output_info_list(pa_context *c, pa_source_output_info_cb_t cb, void *userdata);
152
153/** Set the volume of a sink device specified by its index */
154pa_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);
155
156/** Set the volume of a sink device specified by its name */
157pa_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);
158
159/** Set the mute switch of a sink device specified by its index \since 0.8 */
160pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
161
162/** Set the mute switch of a sink device specified by its name \since 0.8 */
163pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
164
165/** Set the volume of a sink input stream */
166pa_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);
167
168/** Set the volume of a source device specified by its index \since 0.8 */
169pa_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);
170
171/** Set the volume of a source device specified by its name \since 0.8 */
172pa_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);
173
174/** Set the mute switch of a source device specified by its index \since 0.8 */
175pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
176
177/** Set the mute switch of a source device specified by its name \since 0.8 */
178pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
179
180/** Get daemon memory block statistics */
181pa_operation* pa_context_stat(pa_context *c, pa_stat_info_cb_t cb, void *userdata);
182
183/** Get information about a sample by its name */
184pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name, pa_sample_info_cb_t cb, void *userdata);
185
186/** Get information about a sample by its index */
187pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, pa_sample_info_cb_t cb, void *userdata);
188
189/** Get the complete list of samples stored in the daemon. */
190pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t cb, void *userdata);
191
192/** Kill a client. \since 0.5 */
193pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
194
195/** Kill a sink input. \since 0.5 */
196pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
197
198/** Kill a source output. \since 0.5 */
199pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
200
201/** Load a module. \since 0.5 */
202pa_operation* pa_context_load_module(pa_context *c, const char*name, const char *argument, pa_context_index_cb_t cb, void *userdata);
203
204/** Unload a module. \since 0.5 */
205pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
206
207
208/** Get info about a specific autoload entry. \since 0.6 */
209pa_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);
210
211/** Get info about a specific autoload entry. \since 0.6 */
212pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, pa_autoload_info_cb_t cb, void *userdata);
213
214/** Get the complete list of autoload entries. \since 0.5 */
215pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata);
216
217/** Add a new autoload entry. \since 0.5 */
218pa_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);
219
220/** Remove an autoload entry. \since 0.6 */
221pa_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);
222
223/** Remove an autoload entry. \since 0.6 */
224pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata);
225
226/** Move the specified sink input to a different sink. \since 0.9.5 */
227pa_operation* pa_context_move_sink_input_by_name(pa_context *c, uint32_t idx, char *sink_name, pa_context_success_cb_t cb, void* userdata);
228
229/** Move the specified sink input to a different sink. \since 0.9.5 */
230pa_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);
231
232/** Move the specified source output to a different source. \since 0.9.5 */
233pa_operation* pa_context_move_source_output_by_name(pa_context *c, uint32_t idx, char *source_name, pa_context_success_cb_t cb, void* userdata);
234
235/** Move the specified source output to a different source. \since 0.9.5 */
236pa_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);
237
238//ll
Note: See TracBrowser for help on using the repository browser.