| 
									
										
										
										
											2004-07-16 19:56:36 +00:00
										 |  |  | /* $Id$ */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /***
 | 
					
						
							|  |  |  |   This file is part of polypaudio. | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  |   polypaudio is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |   it under the terms of the GNU General Public License as published | 
					
						
							|  |  |  |   by the Free Software Foundation; either version 2 of the License, | 
					
						
							|  |  |  |   or (at your option) any later version. | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  |   polypaudio is distributed in the hope that it will be useful, but | 
					
						
							|  |  |  |   WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 
					
						
							|  |  |  |   General Public License for more details. | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  |   You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |   along with polypaudio; if not, write to the Free Software | 
					
						
							|  |  |  |   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | 
					
						
							|  |  |  |   USA. | 
					
						
							|  |  |  | ***/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-16 19:16:42 +00:00
										 |  |  | #ifdef HAVE_CONFIG_H
 | 
					
						
							|  |  |  | #include <config.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  | #include <assert.h>
 | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  | #include <string.h>
 | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-08-17 13:00:01 +00:00
										 |  |  | #include "cli-text.h"
 | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  | #include "module.h"
 | 
					
						
							|  |  |  | #include "client.h"
 | 
					
						
							|  |  |  | #include "sink.h"
 | 
					
						
							|  |  |  | #include "source.h"
 | 
					
						
							| 
									
										
										
										
											2004-07-16 18:58:23 +00:00
										 |  |  | #include "sink-input.h"
 | 
					
						
							|  |  |  | #include "source-output.h"
 | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  | #include "strbuf.h"
 | 
					
						
							|  |  |  | #include "sample-util.h"
 | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  | #include "scache.h"
 | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  | #include "autoload.h"
 | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | char *pa_module_list_to_string(struct pa_core *c) { | 
					
						
							|  |  |  |     struct pa_strbuf *s; | 
					
						
							|  |  |  |     struct pa_module *m; | 
					
						
							|  |  |  |     uint32_t index = PA_IDXSET_INVALID; | 
					
						
							|  |  |  |     assert(c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = pa_strbuf_new(); | 
					
						
							|  |  |  |     assert(s); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_ncontents(c->modules)); | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     for (m = pa_idxset_first(c->modules, &index); m; m = pa_idxset_next(c->modules, &index)) | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |         pa_strbuf_printf(s, "    index: %u\n\tname: <%s>\n\targument: <%s>\n\tused: %i\n\tauto unload: %s\n", m->index, m->name, m->argument, m->n_used, m->auto_unload ? "yes" : "no"); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |      | 
					
						
							|  |  |  |     return pa_strbuf_tostring_free(s); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *pa_client_list_to_string(struct pa_core *c) { | 
					
						
							|  |  |  |     struct pa_strbuf *s; | 
					
						
							|  |  |  |     struct pa_client *client; | 
					
						
							|  |  |  |     uint32_t index = PA_IDXSET_INVALID; | 
					
						
							|  |  |  |     assert(c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = pa_strbuf_new(); | 
					
						
							|  |  |  |     assert(s); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |     pa_strbuf_printf(s, "%u client(s) logged in.\n", pa_idxset_ncontents(c->clients)); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |      | 
					
						
							|  |  |  |     for (client = pa_idxset_first(c->clients, &index); client; client = pa_idxset_next(c->clients, &index)) { | 
					
						
							|  |  |  |         pa_strbuf_printf(s, "    index: %u\n\tname: <%s>\n\tprotocol_name: <%s>\n", client->index, client->name, client->protocol_name); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (client->owner) | 
					
						
							|  |  |  |             pa_strbuf_printf(s, "\towner module: <%u>\n", client->owner->index); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |     return pa_strbuf_tostring_free(s); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *pa_sink_list_to_string(struct pa_core *c) { | 
					
						
							|  |  |  |     struct pa_strbuf *s; | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |     struct pa_sink *sink; | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |     uint32_t index = PA_IDXSET_INVALID; | 
					
						
							|  |  |  |     assert(c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = pa_strbuf_new(); | 
					
						
							|  |  |  |     assert(s); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pa_strbuf_printf(s, "%u sink(s) available.\n", pa_idxset_ncontents(c->sinks)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (sink = pa_idxset_first(c->sinks, &index); sink; sink = pa_idxset_next(c->sinks, &index)) { | 
					
						
							| 
									
										
										
										
											2004-09-19 23:12:41 +00:00
										 |  |  |         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; | 
					
						
							| 
									
										
										
										
											2004-08-17 17:56:09 +00:00
										 |  |  |         pa_sample_spec_snprint(ss, sizeof(ss), &sink->sample_spec); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |         assert(sink->monitor_source); | 
					
						
							|  |  |  |         pa_strbuf_printf( | 
					
						
							|  |  |  |             s, | 
					
						
							| 
									
										
										
										
											2004-09-12 19:37:04 +00:00
										 |  |  |             "  %c index: %u\n\tname: <%s>\n\tvolume: <0x%04x> (%0.2fdB)\n\tlatency: <%0.0f usec>\n\tmonitor_source: <%u>\n\tsample_spec: <%s>\n", | 
					
						
							| 
									
										
										
										
											2004-08-10 13:00:12 +00:00
										 |  |  |             c->default_sink_name && !strcmp(sink->name, c->default_sink_name) ? '*' : ' ', | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |             sink->index, sink->name, | 
					
						
							|  |  |  |             (unsigned) sink->volume, | 
					
						
							| 
									
										
										
										
											2004-09-01 12:48:47 +00:00
										 |  |  |             pa_volume_to_dB(sink->volume), | 
					
						
							| 
									
										
										
										
											2004-09-12 13:14:49 +00:00
										 |  |  |             (float) pa_sink_get_latency(sink), | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |             sink->monitor_source->index, | 
					
						
							|  |  |  |             ss); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (sink->owner) | 
					
						
							|  |  |  |             pa_strbuf_printf(s, "\towner module: <%u>\n", sink->owner->index); | 
					
						
							|  |  |  |         if (sink->description) | 
					
						
							|  |  |  |             pa_strbuf_printf(s, "\tdescription: <%s>\n", sink->description); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     return pa_strbuf_tostring_free(s); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *pa_source_list_to_string(struct pa_core *c) { | 
					
						
							|  |  |  |     struct pa_strbuf *s; | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |     struct pa_source *source; | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |     uint32_t index = PA_IDXSET_INVALID; | 
					
						
							|  |  |  |     assert(c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = pa_strbuf_new(); | 
					
						
							|  |  |  |     assert(s); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pa_strbuf_printf(s, "%u source(s) available.\n", pa_idxset_ncontents(c->sources)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (source = pa_idxset_first(c->sources, &index); source; source = pa_idxset_next(c->sources, &index)) { | 
					
						
							| 
									
										
										
										
											2004-09-19 23:12:41 +00:00
										 |  |  |         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; | 
					
						
							| 
									
										
										
										
											2004-08-17 17:56:09 +00:00
										 |  |  |         pa_sample_spec_snprint(ss, sizeof(ss), &source->sample_spec); | 
					
						
							| 
									
										
										
										
											2004-09-16 00:05:56 +00:00
										 |  |  |         pa_strbuf_printf(s, "  %c index: %u\n\tname: <%s>\n\tlatency: <%0.0f usec>\n\tsample_spec: <%s>\n", | 
					
						
							| 
									
										
										
										
											2004-08-10 13:00:12 +00:00
										 |  |  |                          c->default_source_name && !strcmp(source->name, c->default_source_name) ? '*' : ' ', | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |                          source->index, | 
					
						
							|  |  |  |                          source->name, | 
					
						
							| 
									
										
										
										
											2004-09-16 00:05:56 +00:00
										 |  |  |                          (float) pa_source_get_latency(source), | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |                          ss); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if (source->monitor_of)  | 
					
						
							|  |  |  |             pa_strbuf_printf(s, "\tmonitor_of: <%u>\n", source->monitor_of->index); | 
					
						
							|  |  |  |         if (source->owner) | 
					
						
							|  |  |  |             pa_strbuf_printf(s, "\towner module: <%u>\n", source->owner->index); | 
					
						
							|  |  |  |         if (source->description) | 
					
						
							|  |  |  |             pa_strbuf_printf(s, "\tdescription: <%s>\n", source->description); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     return pa_strbuf_tostring_free(s); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *pa_source_output_list_to_string(struct pa_core *c) { | 
					
						
							|  |  |  |     struct pa_strbuf *s; | 
					
						
							|  |  |  |     struct pa_source_output *o; | 
					
						
							|  |  |  |     uint32_t index = PA_IDXSET_INVALID; | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |     static const char* const state_table[] = { | 
					
						
							|  |  |  |         "RUNNING", | 
					
						
							|  |  |  |         "CORKED", | 
					
						
							|  |  |  |         "DISCONNECTED" | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |     assert(c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = pa_strbuf_new(); | 
					
						
							|  |  |  |     assert(s); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pa_strbuf_printf(s, "%u source outputs(s) available.\n", pa_idxset_ncontents(c->source_outputs)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (o = pa_idxset_first(c->source_outputs, &index); o; o = pa_idxset_next(c->source_outputs, &index)) { | 
					
						
							| 
									
										
										
										
											2004-09-19 23:12:41 +00:00
										 |  |  |         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; | 
					
						
							| 
									
										
										
										
											2004-08-17 17:56:09 +00:00
										 |  |  |         pa_sample_spec_snprint(ss, sizeof(ss), &o->sample_spec); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |         assert(o->source); | 
					
						
							|  |  |  |         pa_strbuf_printf( | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |             s, "  index: %u\n\tname: '%s'\n\tstate: %s\n\tsource: <%u> '%s'\n\tsample_spec: <%s>\n", | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |             o->index, | 
					
						
							|  |  |  |             o->name, | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |             state_table[o->state], | 
					
						
							|  |  |  |             o->source->index, o->source->name, | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |             ss); | 
					
						
							|  |  |  |         if (o->owner) | 
					
						
							|  |  |  |             pa_strbuf_printf(s, "\towner module: <%u>\n", o->owner->index); | 
					
						
							|  |  |  |         if (o->client) | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |             pa_strbuf_printf(s, "\tclient: <%u> '%s'\n", o->client->index, o->client->name); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     return pa_strbuf_tostring_free(s); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | char *pa_sink_input_list_to_string(struct pa_core *c) { | 
					
						
							|  |  |  |     struct pa_strbuf *s; | 
					
						
							|  |  |  |     struct pa_sink_input *i; | 
					
						
							|  |  |  |     uint32_t index = PA_IDXSET_INVALID; | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |     static const char* const state_table[] = { | 
					
						
							|  |  |  |         "RUNNING", | 
					
						
							|  |  |  |         "CORKED", | 
					
						
							|  |  |  |         "DISCONNECTED" | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |     assert(c); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |     s = pa_strbuf_new(); | 
					
						
							|  |  |  |     assert(s); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pa_strbuf_printf(s, "%u sink input(s) available.\n", pa_idxset_ncontents(c->sink_inputs)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (i = pa_idxset_first(c->sink_inputs, &index); i; i = pa_idxset_next(c->sink_inputs, &index)) { | 
					
						
							| 
									
										
										
										
											2004-09-19 23:12:41 +00:00
										 |  |  |         char ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; | 
					
						
							| 
									
										
										
										
											2004-08-17 17:56:09 +00:00
										 |  |  |         pa_sample_spec_snprint(ss, sizeof(ss), &i->sample_spec); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |         assert(i->sink); | 
					
						
							|  |  |  |         pa_strbuf_printf( | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |             s, "    index: %u\n\tname: <%s>\n\tstate: %s\n\tsink: <%u> '%s'\n\tvolume: <0x%04x> (%0.2fdB)\n\tlatency: <%0.0f usec>\n\tsample_spec: <%s>\n", | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |             i->index, | 
					
						
							|  |  |  |             i->name, | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |             state_table[i->state], | 
					
						
							|  |  |  |             i->sink->index, i->sink->name, | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |             (unsigned) i->volume, | 
					
						
							| 
									
										
										
										
											2004-09-01 12:48:47 +00:00
										 |  |  |             pa_volume_to_dB(i->volume), | 
					
						
							| 
									
										
										
										
											2004-09-12 13:14:49 +00:00
										 |  |  |             (float) pa_sink_input_get_latency(i), | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |             ss); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (i->owner) | 
					
						
							|  |  |  |             pa_strbuf_printf(s, "\towner module: <%u>\n", i->owner->index); | 
					
						
							|  |  |  |         if (i->client) | 
					
						
							| 
									
										
										
										
											2004-09-26 17:02:26 +00:00
										 |  |  |             pa_strbuf_printf(s, "\tclient: <%u> '%s'\n", i->client->index, i->client->name); | 
					
						
							| 
									
										
										
										
											2004-07-11 01:09:46 +00:00
										 |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     return pa_strbuf_tostring_free(s); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | char *pa_scache_list_to_string(struct pa_core *c) { | 
					
						
							|  |  |  |     struct pa_strbuf *s; | 
					
						
							|  |  |  |     assert(c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = pa_strbuf_new(); | 
					
						
							|  |  |  |     assert(s); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-08-19 23:14:59 +00:00
										 |  |  |     pa_strbuf_printf(s, "%u cache entries available.\n", c->scache ? pa_idxset_ncontents(c->scache) : 0); | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-08-19 23:14:59 +00:00
										 |  |  |     if (c->scache) { | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |         struct pa_scache_entry *e; | 
					
						
							| 
									
										
										
										
											2004-08-19 23:14:59 +00:00
										 |  |  |         uint32_t index = PA_IDXSET_INVALID; | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-08-19 23:14:59 +00:00
										 |  |  |         for (e = pa_idxset_first(c->scache, &index); e; e = pa_idxset_next(c->scache, &index)) { | 
					
						
							| 
									
										
										
										
											2004-09-15 14:05:28 +00:00
										 |  |  |             double l = 0; | 
					
						
							| 
									
										
										
										
											2004-09-19 23:12:41 +00:00
										 |  |  |             char ss[PA_SAMPLE_SPEC_SNPRINT_MAX] = "n/a"; | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  |              | 
					
						
							| 
									
										
										
										
											2004-09-15 14:05:28 +00:00
										 |  |  |             if (e->memchunk.memblock) { | 
					
						
							|  |  |  |                 pa_sample_spec_snprint(ss, sizeof(ss), &e->sample_spec); | 
					
						
							|  |  |  |                 l = (double) e->memchunk.length / pa_bytes_per_second(&e->sample_spec); | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  |              | 
					
						
							|  |  |  |             pa_strbuf_printf( | 
					
						
							| 
									
										
										
										
											2004-10-27 16:23:23 +00:00
										 |  |  |                 s, "    name: <%s>\n\tindex: <%u>\n\tsample_spec: <%s>\n\tlength: <%u>\n\tduration: <%0.1fs>\n\tvolume: <0x%04x>\n\tlazy: %s\n\tfilename: %s\n", | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  |                 e->name, | 
					
						
							|  |  |  |                 e->index, | 
					
						
							|  |  |  |                 ss, | 
					
						
							| 
									
										
										
										
											2004-09-15 14:05:28 +00:00
										 |  |  |                 e->memchunk.memblock ? e->memchunk.length : 0, | 
					
						
							| 
									
										
										
										
											2004-08-03 19:26:56 +00:00
										 |  |  |                 l, | 
					
						
							| 
									
										
										
										
											2004-09-14 23:08:39 +00:00
										 |  |  |                 e->volume, | 
					
						
							| 
									
										
										
										
											2004-09-15 14:05:28 +00:00
										 |  |  |                 e->lazy ? "yes" : "no", | 
					
						
							|  |  |  |                 e->filename ? e->filename : "n/a"); | 
					
						
							| 
									
										
										
										
											2004-07-20 01:07:06 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return pa_strbuf_tostring_free(s); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | char *pa_autoload_list_to_string(struct pa_core *c) { | 
					
						
							|  |  |  |     struct pa_strbuf *s; | 
					
						
							|  |  |  |     assert(c); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     s = pa_strbuf_new(); | 
					
						
							|  |  |  |     assert(s); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pa_strbuf_printf(s, "%u autoload entries available.\n", c->autoload_hashmap ? pa_hashmap_ncontents(c->autoload_hashmap) : 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (c->autoload_hashmap) { | 
					
						
							|  |  |  |         struct pa_autoload_entry *e; | 
					
						
							|  |  |  |         void *state = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-10-30 01:55:16 +00:00
										 |  |  |         while ((e = pa_hashmap_iterate(c->autoload_hashmap, &state, NULL))) { | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |             pa_strbuf_printf( | 
					
						
							| 
									
										
										
										
											2004-10-27 16:23:23 +00:00
										 |  |  |                 s, "    name: <%s>\n\ttype: <%s>\n\tindex: <%u>\n\tmodule_name: <%s>\n\targuments: <%s>\n", | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |                 e->name, | 
					
						
							| 
									
										
										
										
											2004-09-15 14:05:28 +00:00
										 |  |  |                 e->type == PA_NAMEREG_SOURCE ? "source" : "sink", | 
					
						
							| 
									
										
										
										
											2004-10-27 16:23:23 +00:00
										 |  |  |                 e->index, | 
					
						
							| 
									
										
										
										
											2004-09-15 14:05:28 +00:00
										 |  |  |                 e->module, | 
					
						
							|  |  |  |                 e->argument); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-08-04 16:39:30 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return pa_strbuf_tostring_free(s); | 
					
						
							|  |  |  | } |