source: roaraudio/libroarpulse/introspect.c @ 3466:6d461930b82b

Last change on this file since 3466:6d461930b82b was 3420:a4ccb3b17562, checked in by phi, 10 years ago

started with channel mapping stuff

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, 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 *  NOTE for everyone want's to change something and send patches:
28 *  read README and HACKING! There a addition information on
29 *  the license of this document you need to read before you send
30 *  any patches.
31 *
32 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
33 *  or libpulse*:
34 *  The libs libroaresd, libroararts and libroarpulse link this libroar
35 *  and are therefore GPL. Because of this it may be illigal to use
36 *  them with any software that uses libesd, libartsc or libpulse*.
37 */
38
39#include <libroarpulse/libroarpulse.h>
40
41/** Get information about a sink by its name */
42pa_operation* pa_context_get_sink_info_by_name(pa_context *c, const char *name, pa_sink_info_cb_t cb, void *userdata) {
43 struct roar_stream stream;
44 pa_sink_info painfo;
45
46 if ( c == NULL || cb == NULL )
47  return roar_pa_op_new_done();
48
49 memset(&painfo, 0, sizeof(painfo));
50
51 if ( !!strcasecmp(name, ROAR_PA_DEFAULT_SINK) )
52  return roar_pa_op_new_done();
53
54 if ( roar_server_oinfo(roar_pa_context_get_con(c), &stream) == -1 )
55  return roar_pa_op_new_done();
56
57 if ( roar_pa_auinfo2sspec(&(painfo.sample_spec), &(stream.info)) == -1 )
58  return roar_pa_op_new_done();
59
60 pa_channel_map_init_auto(&(painfo.channel_map), stream.info.channels, PA_CHANNEL_MAP_DEFAULT);
61// pa_cvolume_init(&(painfo.volume));
62
63 painfo.name                = ROAR_PA_DEFAULT_SINK;
64 painfo.index               = 0;
65 painfo.description         = "RoarAudio default mixer";
66 painfo.owner_module        = PA_INVALID_INDEX;
67 painfo.mute                = 0;
68 painfo.monitor_source      = 0;
69 painfo.monitor_source_name = ROAR_PA_DEFAULT_SOURCE;
70 painfo.latency             = 0;
71 painfo.driver              = "Waveform Mixer Core";
72// painfo.pa_sink_flags_t     = 0;
73
74 cb(c, &painfo, 1, userdata);
75
76 return roar_pa_op_new_done();
77}
78
79/** Get information about a sink by its index */
80pa_operation* pa_context_get_sink_info_by_index(pa_context *c, uint32_t id, pa_sink_info_cb_t cb, void *userdata);
81
82/** Get the complete sink list */
83pa_operation* pa_context_get_sink_info_list(pa_context *c, pa_sink_info_cb_t cb, void *userdata);
84
85/** Get information about a source by its name */
86pa_operation* pa_context_get_source_info_by_name(pa_context *c, const char *name, pa_source_info_cb_t cb, void *userdata);
87
88/** Get information about a source by its index */
89pa_operation* pa_context_get_source_info_by_index(pa_context *c, uint32_t id, pa_source_info_cb_t cb, void *userdata);
90
91/** Get the complete source list */
92pa_operation* pa_context_get_source_info_list(pa_context *c, pa_source_info_cb_t cb, void *userdata);
93
94/** Get some information about the server */
95pa_operation* pa_context_get_server_info(pa_context *c, pa_server_info_cb_t cb, void *userdata) {
96 struct roar_stream stream;
97 struct roar_client client;
98 pa_server_info painfo;
99
100 if ( c == NULL || cb == NULL )
101  return roar_pa_op_new_done();
102
103 if ( roar_server_oinfo(roar_pa_context_get_con(c), &stream) == -1 )
104  return roar_pa_op_new_done();
105
106 if ( roar_get_client(roar_pa_context_get_con(c), &client, 0) == -1 )
107  return roar_pa_op_new_done();
108
109 memset(&painfo, 0, sizeof(painfo));
110
111 if ( roar_pa_auinfo2sspec(&(painfo.sample_spec), &(stream.info)) == -1 )
112  return roar_pa_op_new_done();
113
114 painfo.user_name           = "(none)";
115 painfo.host_name           = pa_context_get_server(c);
116 painfo.server_version      = pa_get_library_version();
117 painfo.server_name         = "pulseaudio";
118 painfo.default_sink_name   = ROAR_PA_DEFAULT_SINK;
119 painfo.default_source_name = ROAR_PA_DEFAULT_SOURCE;
120 painfo.cookie              = 0x524F4152;
121 painfo.cookie             ^= (client.pid & 0xFF) | (client.uid & 0xFF) << 8 | (client.gid & 0xFF) << 16;
122
123 cb(c, &painfo, userdata);
124
125 return roar_pa_op_new_done();
126}
127
128/** Get some information about a module by its index */
129pa_operation* pa_context_get_module_info(pa_context *c, uint32_t idx, pa_module_info_cb_t cb, void *userdata);
130
131/** Get the complete list of currently loaded modules */
132pa_operation* pa_context_get_module_info_list(pa_context *c, pa_module_info_cb_t cb, void *userdata);
133
134/** Get information about a client by its index */
135pa_operation* pa_context_get_client_info(pa_context *c, uint32_t idx, pa_client_info_cb_t cb, void *userdata);
136
137/** Get the complete client list */
138pa_operation* pa_context_get_client_info_list(pa_context *c, pa_client_info_cb_t cb, void *userdata);
139
140/** Get some information about a sink input by its index */
141pa_operation* pa_context_get_sink_input_info(pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata);
142
143/** Get the complete sink input list */
144pa_operation* pa_context_get_sink_input_info_list(pa_context *c, pa_sink_input_info_cb_t cb, void *userdata);
145
146/** Get information about a source output by its index */
147pa_operation* pa_context_get_source_output_info(pa_context *c, uint32_t idx, pa_source_output_info_cb_t cb, void *userdata);
148
149/** Get the complete list of source outputs */
150pa_operation* pa_context_get_source_output_info_list(pa_context *c, pa_source_output_info_cb_t cb, void *userdata);
151
152/** Set the volume of a sink device specified by its index */
153pa_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);
154
155/** Set the volume of a sink device specified by its name */
156pa_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);
157
158/** Set the mute switch of a sink device specified by its index \since 0.8 */
159pa_operation* pa_context_set_sink_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
160
161/** Set the mute switch of a sink device specified by its name \since 0.8 */
162pa_operation* pa_context_set_sink_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
163
164/** Set the volume of a sink input stream */
165pa_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);
166
167/** Set the volume of a source device specified by its index \since 0.8 */
168pa_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);
169
170/** Set the volume of a source device specified by its name \since 0.8 */
171pa_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);
172
173/** Set the mute switch of a source device specified by its index \since 0.8 */
174pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, int mute, pa_context_success_cb_t cb, void *userdata);
175
176/** Set the mute switch of a source device specified by its name \since 0.8 */
177pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
178
179/** Get daemon memory block statistics */
180pa_operation* pa_context_stat(pa_context *c, pa_stat_info_cb_t cb, void *userdata);
181
182/** Get information about a sample by its name */
183pa_operation* pa_context_get_sample_info_by_name(pa_context *c, const char *name, pa_sample_info_cb_t cb, void *userdata);
184
185/** Get information about a sample by its index */
186pa_operation* pa_context_get_sample_info_by_index(pa_context *c, uint32_t idx, pa_sample_info_cb_t cb, void *userdata);
187
188/** Get the complete list of samples stored in the daemon. */
189pa_operation* pa_context_get_sample_info_list(pa_context *c, pa_sample_info_cb_t cb, void *userdata);
190
191/** Kill a client. \since 0.5 */
192pa_operation* pa_context_kill_client(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
193
194/** Kill a sink input. \since 0.5 */
195pa_operation* pa_context_kill_sink_input(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
196
197/** Kill a source output. \since 0.5 */
198pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
199
200/** Load a module. \since 0.5 */
201pa_operation* pa_context_load_module(pa_context *c, const char*name, const char *argument, pa_context_index_cb_t cb, void *userdata);
202
203/** Unload a module. \since 0.5 */
204pa_operation* pa_context_unload_module(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
205
206
207/** Get info about a specific autoload entry. \since 0.6 */
208pa_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);
209
210/** Get info about a specific autoload entry. \since 0.6 */
211pa_operation* pa_context_get_autoload_info_by_index(pa_context *c, uint32_t idx, pa_autoload_info_cb_t cb, void *userdata);
212
213/** Get the complete list of autoload entries. \since 0.5 */
214pa_operation* pa_context_get_autoload_info_list(pa_context *c, pa_autoload_info_cb_t cb, void *userdata);
215
216/** Add a new autoload entry. \since 0.5 */
217pa_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);
218
219/** Remove an autoload entry. \since 0.6 */
220pa_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);
221
222/** Remove an autoload entry. \since 0.6 */
223pa_operation* pa_context_remove_autoload_by_index(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void* userdata);
224
225/** Move the specified sink input to a different sink. \since 0.9.5 */
226pa_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);
227
228/** Move the specified sink input to a different sink. \since 0.9.5 */
229pa_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);
230
231/** Move the specified source output to a different source. \since 0.9.5 */
232pa_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);
233
234/** Move the specified source output to a different source. \since 0.9.5 */
235pa_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);
236
237//ll
Note: See TracBrowser for help on using the repository browser.