]> code.delx.au - pulseaudio/blob - src/pulsecore/cli-text.c
Merge commit 'e0f8ffe41f99789fafac575e944acf02e940bbf7'
[pulseaudio] / src / pulsecore / cli-text.c
1 /***
2 This file is part of PulseAudio.
3
4 Copyright 2004-2006 Lennart Poettering
5
6 PulseAudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
10
11 PulseAudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with PulseAudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 USA.
20 ***/
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <string.h>
27
28 #include <pulse/volume.h>
29 #include <pulse/xmalloc.h>
30 #include <pulse/timeval.h>
31
32 #include <pulsecore/module.h>
33 #include <pulsecore/client.h>
34 #include <pulsecore/sink.h>
35 #include <pulsecore/source.h>
36 #include <pulsecore/sink-input.h>
37 #include <pulsecore/source-output.h>
38 #include <pulsecore/strbuf.h>
39 #include <pulsecore/sample-util.h>
40 #include <pulsecore/core-scache.h>
41 #include <pulsecore/autoload.h>
42 #include <pulsecore/macro.h>
43 #include <pulsecore/core-util.h>
44
45 #include "cli-text.h"
46
47 char *pa_module_list_to_string(pa_core *c) {
48 pa_strbuf *s;
49 pa_module *m;
50 uint32_t idx = PA_IDXSET_INVALID;
51 pa_assert(c);
52
53 s = pa_strbuf_new();
54
55 pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_size(c->modules));
56
57 for (m = pa_idxset_first(c->modules, &idx); m; m = pa_idxset_next(c->modules, &idx)) {
58 pa_strbuf_printf(s, " index: %u\n"
59 "\tname: <%s>\n"
60 "\targument: <%s>\n"
61 "\tused: %i\n"
62 "\tauto unload: %s\n",
63 m->index, m->name, m->argument ? m->argument : "", m->n_used,
64 pa_yes_no(m->auto_unload));
65 }
66
67 return pa_strbuf_tostring_free(s);
68 }
69
70 char *pa_client_list_to_string(pa_core *c) {
71 pa_strbuf *s;
72 pa_client *client;
73 uint32_t idx = PA_IDXSET_INVALID;
74 pa_assert(c);
75
76 s = pa_strbuf_new();
77
78 pa_strbuf_printf(s, "%u client(s) logged in.\n", pa_idxset_size(c->clients));
79
80 for (client = pa_idxset_first(c->clients, &idx); client; client = pa_idxset_next(c->clients, &idx)) {
81 char *t;
82 pa_strbuf_printf(
83 s,
84 " index: %u\n"
85 "\tdriver: <%s>\n",
86 client->index,
87 client->driver);
88
89 if (client->module)
90 pa_strbuf_printf(s, "\towner module: %u\n", client->module->index);
91
92 t = pa_proplist_to_string(client->proplist);
93 pa_strbuf_printf(s, "\tproperties:\n%s", t);
94 pa_xfree(t);
95 }
96
97 return pa_strbuf_tostring_free(s);
98 }
99
100 char *pa_card_list_to_string(pa_core *c) {
101 pa_strbuf *s;
102 pa_card *card;
103 uint32_t idx = PA_IDXSET_INVALID;
104 pa_assert(c);
105
106 s = pa_strbuf_new();
107
108 pa_strbuf_printf(s, "%u card(s) available in.\n", pa_idxset_size(c->cards));
109
110 for (card = pa_idxset_first(c->cards, &idx); card; card = pa_idxset_next(c->cards, &idx)) {
111 char *t;
112 pa_strbuf_printf(
113 s,
114 " index: %u\n"
115 "\tname: <%s>\n"
116 "\tdriver: <%s>\n",
117 card->index,
118 card->name,
119 card->driver);
120
121 if (card->module)
122 pa_strbuf_printf(s, "\towner module: %u\n", card->module->index);
123
124 t = pa_proplist_to_string(card->proplist);
125 pa_strbuf_printf(s, "\tproperties:\n%s", t);
126 pa_xfree(t);
127 }
128
129 return pa_strbuf_tostring_free(s);
130 }
131
132 char *pa_sink_list_to_string(pa_core *c) {
133 pa_strbuf *s;
134 pa_sink *sink;
135 uint32_t idx = PA_IDXSET_INVALID;
136 static const char* const state_table[] = {
137 [PA_SINK_INIT] = "INIT",
138 [PA_SINK_RUNNING] = "RUNNING",
139 [PA_SINK_SUSPENDED] = "SUSPENDED",
140 [PA_SINK_IDLE] = "IDLE",
141 [PA_SINK_UNLINKED] = "UNLINKED"
142 };
143 pa_assert(c);
144
145 s = pa_strbuf_new();
146
147 pa_strbuf_printf(s, "%u sink(s) available.\n", pa_idxset_size(c->sinks));
148
149 for (sink = pa_idxset_first(c->sinks, &idx); sink; sink = pa_idxset_next(c->sinks, &idx)) {
150 char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
151 cv[PA_CVOLUME_SNPRINT_MAX],
152 cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
153 v[PA_VOLUME_SNPRINT_MAX],
154 vdb[PA_SW_VOLUME_SNPRINT_DB_MAX],
155 cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
156 pa_usec_t min_latency, max_latency;
157
158 pa_sink_get_latency_range(sink, &min_latency, &max_latency);
159
160 pa_strbuf_printf(
161 s,
162 " %c index: %u\n"
163 "\tname: <%s>\n"
164 "\tdriver: <%s>\n"
165 "\tflags: %s%s%s%s%s%s\n"
166 "\tstate: %s\n"
167 "\tvolume: %s%s%s\n"
168 "\tbase volume: %s%s%s\n"
169 "\tmuted: %s\n"
170 "\tcurrent latency: %0.2f ms\n"
171 "\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n"
172 "\tmax request: %lu KiB\n"
173 "\tmax rewind: %lu KiB\n"
174 "\tmonitor source: %u\n"
175 "\tsample spec: %s\n"
176 "\tchannel map: %s\n"
177 "\tused by: %u\n"
178 "\tlinked by: %u\n",
179 c->default_sink_name && !strcmp(sink->name, c->default_sink_name) ? '*' : ' ',
180 sink->index,
181 sink->name,
182 sink->driver,
183 sink->flags & PA_SINK_HARDWARE ? "HARDWARE " : "",
184 sink->flags & PA_SINK_NETWORK ? "NETWORK " : "",
185 sink->flags & PA_SINK_HW_MUTE_CTRL ? "HW_MUTE_CTRL " : "",
186 sink->flags & PA_SINK_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
187 sink->flags & PA_SINK_DECIBEL_VOLUME ? "DECIBEL_VOLUME " : "",
188 sink->flags & PA_SINK_LATENCY ? "LATENCY " : "",
189 state_table[pa_sink_get_state(sink)],
190 pa_cvolume_snprint(cv, sizeof(cv), pa_sink_get_volume(sink, FALSE)),
191 sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "",
192 sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_sink_get_volume(sink, FALSE)) : "",
193 pa_volume_snprint(v, sizeof(v), sink->base_volume),
194 sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "",
195 sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), sink->base_volume) : "",
196 pa_yes_no(pa_sink_get_mute(sink, FALSE)),
197 (double) pa_sink_get_latency(sink) / (double) PA_USEC_PER_MSEC,
198 (double) pa_sink_get_requested_latency(sink) / (double) PA_USEC_PER_MSEC,
199 (double) min_latency / PA_USEC_PER_MSEC,
200 (double) max_latency / PA_USEC_PER_MSEC,
201 (unsigned long) pa_sink_get_max_request(sink) / 1024,
202 (unsigned long) pa_sink_get_max_rewind(sink) / 1024,
203 sink->monitor_source ? sink->monitor_source->index : PA_INVALID_INDEX,
204 pa_sample_spec_snprint(ss, sizeof(ss), &sink->sample_spec),
205 pa_channel_map_snprint(cm, sizeof(cm), &sink->channel_map),
206 pa_sink_used_by(sink),
207 pa_sink_linked_by(sink));
208
209 if (sink->card)
210 pa_strbuf_printf(s, "\tcard: %u <%s>\n", sink->card->index, sink->card->name);
211 if (sink->module)
212 pa_strbuf_printf(s, "\tmodule: %u\n", sink->module->index);
213
214 t = pa_proplist_to_string(sink->proplist);
215 pa_strbuf_printf(s, "\tproperties:\n%s", t);
216 pa_xfree(t);
217 }
218
219 return pa_strbuf_tostring_free(s);
220 }
221
222 char *pa_source_list_to_string(pa_core *c) {
223 pa_strbuf *s;
224 pa_source *source;
225 uint32_t idx = PA_IDXSET_INVALID;
226 static const char* const state_table[] = {
227 [PA_SOURCE_INIT] = "INIT",
228 [PA_SOURCE_RUNNING] = "RUNNING",
229 [PA_SOURCE_SUSPENDED] = "SUSPENDED",
230 [PA_SOURCE_IDLE] = "IDLE",
231 [PA_SOURCE_UNLINKED] = "UNLINKED"
232 };
233 pa_assert(c);
234
235 s = pa_strbuf_new();
236
237 pa_strbuf_printf(s, "%u source(s) available.\n", pa_idxset_size(c->sources));
238
239 for (source = pa_idxset_first(c->sources, &idx); source; source = pa_idxset_next(c->sources, &idx)) {
240 char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
241 cv[PA_CVOLUME_SNPRINT_MAX],
242 cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
243 v[PA_VOLUME_SNPRINT_MAX],
244 vdb[PA_SW_VOLUME_SNPRINT_DB_MAX],
245 cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
246 pa_usec_t min_latency, max_latency;
247
248 pa_source_get_latency_range(source, &min_latency, &max_latency);
249
250 pa_strbuf_printf(
251 s,
252 " %c index: %u\n"
253 "\tname: <%s>\n"
254 "\tdriver: <%s>\n"
255 "\tflags: %s%s%s%s%s%s\n"
256 "\tstate: %s\n"
257 "\tvolume: %s%s%s\n"
258 "\tbase volume: %s%s%s\n"
259 "\tmuted: %s\n"
260 "\tcurrent latency: %0.2f ms\n"
261 "\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n"
262 "\tmax rewind: %lu KiB\n"
263 "\tsample spec: %s\n"
264 "\tchannel map: %s\n"
265 "\tused by: %u\n"
266 "\tlinked by: %u\n",
267 c->default_source_name && !strcmp(source->name, c->default_source_name) ? '*' : ' ',
268 source->index,
269 source->name,
270 source->driver,
271 source->flags & PA_SOURCE_HARDWARE ? "HARDWARE " : "",
272 source->flags & PA_SOURCE_NETWORK ? "NETWORK " : "",
273 source->flags & PA_SOURCE_HW_MUTE_CTRL ? "HW_MUTE_CTRL " : "",
274 source->flags & PA_SOURCE_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
275 source->flags & PA_SOURCE_DECIBEL_VOLUME ? "DECIBEL_VOLUME " : "",
276 source->flags & PA_SOURCE_LATENCY ? "LATENCY " : "",
277 state_table[pa_source_get_state(source)],
278 pa_cvolume_snprint(cv, sizeof(cv), pa_source_get_volume(source, FALSE)),
279 source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "",
280 source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_source_get_volume(source, FALSE)) : "",
281 pa_volume_snprint(v, sizeof(v), source->base_volume),
282 source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "",
283 source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), source->base_volume) : "",
284 pa_yes_no(pa_source_get_mute(source, FALSE)),
285 (double) pa_source_get_latency(source) / PA_USEC_PER_MSEC,
286 (double) pa_source_get_requested_latency(source) / PA_USEC_PER_MSEC,
287 (double) min_latency / PA_USEC_PER_MSEC,
288 (double) max_latency / PA_USEC_PER_MSEC,
289 (unsigned long) pa_source_get_max_rewind(source) / 1024,
290 pa_sample_spec_snprint(ss, sizeof(ss), &source->sample_spec),
291 pa_channel_map_snprint(cm, sizeof(cm), &source->channel_map),
292 pa_source_used_by(source),
293 pa_source_linked_by(source));
294
295 if (source->monitor_of)
296 pa_strbuf_printf(s, "\tmonitor_of: %u\n", source->monitor_of->index);
297 if (source->card)
298 pa_strbuf_printf(s, "\tcard: %u <%s>\n", source->card->index, source->card->name);
299 if (source->module)
300 pa_strbuf_printf(s, "\tmodule: %u\n", source->module->index);
301
302 t = pa_proplist_to_string(source->proplist);
303 pa_strbuf_printf(s, "\tproperties:\n%s", t);
304 pa_xfree(t);
305 }
306
307 return pa_strbuf_tostring_free(s);
308 }
309
310
311 char *pa_source_output_list_to_string(pa_core *c) {
312 pa_strbuf *s;
313 pa_source_output *o;
314 uint32_t idx = PA_IDXSET_INVALID;
315 static const char* const state_table[] = {
316 [PA_SOURCE_OUTPUT_INIT] = "INIT",
317 [PA_SOURCE_OUTPUT_RUNNING] = "RUNNING",
318 [PA_SOURCE_OUTPUT_CORKED] = "CORKED",
319 [PA_SOURCE_OUTPUT_UNLINKED] = "UNLINKED"
320 };
321 pa_assert(c);
322
323 s = pa_strbuf_new();
324
325 pa_strbuf_printf(s, "%u source outputs(s) available.\n", pa_idxset_size(c->source_outputs));
326
327 for (o = pa_idxset_first(c->source_outputs, &idx); o; o = pa_idxset_next(c->source_outputs, &idx)) {
328 char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
329 pa_usec_t cl;
330
331 if ((cl = pa_source_output_get_requested_latency(o)) == (pa_usec_t) -1)
332 pa_snprintf(clt, sizeof(clt), "n/a");
333 else
334 pa_snprintf(clt, sizeof(clt), "%0.2f ms", (double) cl / PA_USEC_PER_MSEC);
335
336 pa_assert(o->source);
337
338 pa_strbuf_printf(
339 s,
340 " index: %u\n"
341 "\tdriver: <%s>\n"
342 "\tflags: %s%s%s%s%s%s%s%s\n"
343 "\tstate: %s\n"
344 "\tsource: %u <%s>\n"
345 "\tcurrent latency: %0.2f ms\n"
346 "\trequested latency: %s\n"
347 "\tsample spec: %s\n"
348 "\tchannel map: %s\n"
349 "\tresample method: %s\n",
350 o->index,
351 o->driver,
352 o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE ? "VARIABLE_RATE " : "",
353 o->flags & PA_SOURCE_OUTPUT_DONT_MOVE ? "DONT_MOVE " : "",
354 o->flags & PA_SOURCE_OUTPUT_START_CORKED ? "START_CORKED " : "",
355 o->flags & PA_SOURCE_OUTPUT_NO_REMAP ? "NO_REMAP " : "",
356 o->flags & PA_SOURCE_OUTPUT_NO_REMIX ? "NO_REMIX " : "",
357 o->flags & PA_SOURCE_OUTPUT_FIX_FORMAT ? "FIX_FORMAT " : "",
358 o->flags & PA_SOURCE_OUTPUT_FIX_RATE ? "FIX_RATE " : "",
359 o->flags & PA_SOURCE_OUTPUT_FIX_CHANNELS ? "FIX_CHANNELS " : "",
360 state_table[pa_source_output_get_state(o)],
361 o->source->index, o->source->name,
362 (double) pa_source_output_get_latency(o, NULL) / PA_USEC_PER_MSEC,
363 clt,
364 pa_sample_spec_snprint(ss, sizeof(ss), &o->sample_spec),
365 pa_channel_map_snprint(cm, sizeof(cm), &o->channel_map),
366 pa_resample_method_to_string(pa_source_output_get_resample_method(o)));
367 if (o->module)
368 pa_strbuf_printf(s, "\towner module: %u\n", o->module->index);
369 if (o->client)
370 pa_strbuf_printf(s, "\tclient: %u <%s>\n", o->client->index, pa_strnull(pa_proplist_gets(o->client->proplist, PA_PROP_APPLICATION_NAME)));
371 if (o->direct_on_input)
372 pa_strbuf_printf(s, "\tdirect on input: %u\n", o->direct_on_input->index);
373
374 t = pa_proplist_to_string(o->proplist);
375 pa_strbuf_printf(s, "\tproperties:\n%s", t);
376 pa_xfree(t);
377 }
378
379 return pa_strbuf_tostring_free(s);
380 }
381
382 char *pa_sink_input_list_to_string(pa_core *c) {
383 pa_strbuf *s;
384 pa_sink_input *i;
385 uint32_t idx = PA_IDXSET_INVALID;
386 static const char* const state_table[] = {
387 [PA_SINK_INPUT_INIT] = "INIT",
388 [PA_SINK_INPUT_RUNNING] = "RUNNING",
389 [PA_SINK_INPUT_DRAINED] = "DRAINED",
390 [PA_SINK_INPUT_CORKED] = "CORKED",
391 [PA_SINK_INPUT_UNLINKED] = "UNLINKED"
392 };
393
394 pa_assert(c);
395 s = pa_strbuf_new();
396
397 pa_strbuf_printf(s, "%u sink input(s) available.\n", pa_idxset_size(c->sink_inputs));
398
399 for (i = pa_idxset_first(c->sink_inputs, &idx); i; i = pa_idxset_next(c->sink_inputs, &idx)) {
400 char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
401 pa_usec_t cl;
402
403 if ((cl = pa_sink_input_get_requested_latency(i)) == (pa_usec_t) -1)
404 pa_snprintf(clt, sizeof(clt), "n/a");
405 else
406 pa_snprintf(clt, sizeof(clt), "%0.2f ms", (double) cl / PA_USEC_PER_MSEC);
407
408 pa_assert(i->sink);
409
410 pa_strbuf_printf(
411 s,
412 " index: %u\n"
413 "\tdriver: <%s>\n"
414 "\tflags: %s%s%s%s%s%s%s%s\n"
415 "\tstate: %s\n"
416 "\tsink: %u <%s>\n"
417 "\tvolume: %s\n"
418 "\tmuted: %s\n"
419 "\tcurrent latency: %0.2f ms\n"
420 "\trequested latency: %s\n"
421 "\tsample spec: %s\n"
422 "\tchannel map: %s\n"
423 "\tresample method: %s\n",
424 i->index,
425 i->driver,
426 i->flags & PA_SINK_INPUT_VARIABLE_RATE ? "VARIABLE_RATE " : "",
427 i->flags & PA_SINK_INPUT_DONT_MOVE ? "DONT_MOVE " : "",
428 i->flags & PA_SINK_INPUT_START_CORKED ? "START_CORKED " : "",
429 i->flags & PA_SINK_INPUT_NO_REMAP ? "NO_REMAP " : "",
430 i->flags & PA_SINK_INPUT_NO_REMIX ? "NO_REMIX " : "",
431 i->flags & PA_SINK_INPUT_FIX_FORMAT ? "FIX_FORMAT " : "",
432 i->flags & PA_SINK_INPUT_FIX_RATE ? "FIX_RATE " : "",
433 i->flags & PA_SINK_INPUT_FIX_CHANNELS ? "FIX_CHANNELS " : "",
434 state_table[pa_sink_input_get_state(i)],
435 i->sink->index, i->sink->name,
436 pa_cvolume_snprint(cv, sizeof(cv), pa_sink_input_get_volume(i)),
437 pa_yes_no(pa_sink_input_get_mute(i)),
438 (double) pa_sink_input_get_latency(i, NULL) / PA_USEC_PER_MSEC,
439 clt,
440 pa_sample_spec_snprint(ss, sizeof(ss), &i->sample_spec),
441 pa_channel_map_snprint(cm, sizeof(cm), &i->channel_map),
442 pa_resample_method_to_string(pa_sink_input_get_resample_method(i)));
443
444 if (i->module)
445 pa_strbuf_printf(s, "\tmodule: %u\n", i->module->index);
446 if (i->client)
447 pa_strbuf_printf(s, "\tclient: %u <%s>\n", i->client->index, pa_strnull(pa_proplist_gets(i->client->proplist, PA_PROP_APPLICATION_NAME)));
448
449 t = pa_proplist_to_string(i->proplist);
450 pa_strbuf_printf(s, "\tproperties:\n%s", t);
451 pa_xfree(t);
452 }
453
454 return pa_strbuf_tostring_free(s);
455 }
456
457 char *pa_scache_list_to_string(pa_core *c) {
458 pa_strbuf *s;
459 pa_assert(c);
460
461 s = pa_strbuf_new();
462
463 pa_strbuf_printf(s, "%u cache entries available.\n", c->scache ? pa_idxset_size(c->scache) : 0);
464
465 if (c->scache) {
466 pa_scache_entry *e;
467 uint32_t idx = PA_IDXSET_INVALID;
468
469 for (e = pa_idxset_first(c->scache, &idx); e; e = pa_idxset_next(c->scache, &idx)) {
470 double l = 0;
471 char ss[PA_SAMPLE_SPEC_SNPRINT_MAX] = "n/a", cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX] = "n/a", *t;
472
473 if (e->memchunk.memblock) {
474 pa_sample_spec_snprint(ss, sizeof(ss), &e->sample_spec);
475 pa_channel_map_snprint(cm, sizeof(cm), &e->channel_map);
476 l = (double) e->memchunk.length / (double) pa_bytes_per_second(&e->sample_spec);
477 }
478
479 pa_strbuf_printf(
480 s,
481 " name: <%s>\n"
482 "\tindex: %u\n"
483 "\tsample spec: %s\n"
484 "\tchannel map: %s\n"
485 "\tlength: %lu\n"
486 "\tduration: %0.1f s\n"
487 "\tvolume: %s\n"
488 "\tlazy: %s\n"
489 "\tfilename: <%s>\n",
490 e->name,
491 e->index,
492 ss,
493 cm,
494 (long unsigned)(e->memchunk.memblock ? e->memchunk.length : 0),
495 l,
496 pa_cvolume_snprint(cv, sizeof(cv), &e->volume),
497 pa_yes_no(e->lazy),
498 e->filename ? e->filename : "n/a");
499
500 t = pa_proplist_to_string(e->proplist);
501 pa_strbuf_printf(s, "\tproperties:\n%s", t);
502 pa_xfree(t);
503 }
504 }
505
506 return pa_strbuf_tostring_free(s);
507 }
508
509 char *pa_autoload_list_to_string(pa_core *c) {
510 pa_strbuf *s;
511 pa_assert(c);
512
513 s = pa_strbuf_new();
514
515 pa_strbuf_printf(s, "%u autoload entries available.\n", c->autoload_hashmap ? pa_hashmap_size(c->autoload_hashmap) : 0);
516
517 if (c->autoload_hashmap) {
518 pa_autoload_entry *e;
519 void *state = NULL;
520
521 while ((e = pa_hashmap_iterate(c->autoload_hashmap, &state, NULL))) {
522 pa_strbuf_printf(
523 s,
524 " name: <%s>\n"
525 "\ttype: %s\n"
526 "\tindex: %u\n"
527 "\tmodule_name: <%s>\n"
528 "\targuments: <%s>\n",
529 e->name,
530 e->type == PA_NAMEREG_SOURCE ? "source" : "sink",
531 e->index,
532 e->module,
533 e->argument ? e->argument : "");
534
535 }
536 }
537
538 return pa_strbuf_tostring_free(s);
539 }
540
541 char *pa_full_status_string(pa_core *c) {
542 pa_strbuf *s;
543 int i;
544
545 s = pa_strbuf_new();
546
547 for (i = 0; i < 9; i++) {
548 char *t = NULL;
549
550 switch (i) {
551 case 0:
552 t = pa_sink_list_to_string(c);
553 break;
554 case 1:
555 t = pa_source_list_to_string(c);
556 break;
557 case 2:
558 t = pa_sink_input_list_to_string(c);
559 break;
560 case 3:
561 t = pa_source_output_list_to_string(c);
562 break;
563 case 4:
564 t = pa_client_list_to_string(c);
565 break;
566 case 5:
567 t = pa_card_list_to_string(c);
568 break;
569 case 6:
570 t = pa_module_list_to_string(c);
571 break;
572 case 7:
573 t = pa_scache_list_to_string(c);
574 break;
575 case 8:
576 t = pa_autoload_list_to_string(c);
577 break;
578 }
579
580 pa_strbuf_puts(s, t);
581 pa_xfree(t);
582 }
583
584 return pa_strbuf_tostring_free(s);
585 }