4 This file is part of polypaudio.
6 polypaudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU 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.
11 polypaudio 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.
16 You should have received a copy of the GNU General Public License
17 along with polypaudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
33 #include "sink-input.h"
34 #include "source-output.h"
36 #include "sample-util.h"
38 char *pa_module_list_to_string(struct pa_core
*c
) {
41 uint32_t index
= PA_IDXSET_INVALID
;
47 pa_strbuf_printf(s
, "%u module(s) loaded.\n", pa_idxset_ncontents(c
->modules
));
49 for (m
= pa_idxset_first(c
->modules
, &index
); m
; m
= pa_idxset_next(c
->modules
, &index
))
50 pa_strbuf_printf(s
, " index: %u\n\tname: <%s>\n\targument: <%s>\n", m
->index
, m
->name
, m
->argument
);
52 return pa_strbuf_tostring_free(s
);
55 char *pa_client_list_to_string(struct pa_core
*c
) {
57 struct pa_client
*client
;
58 uint32_t index
= PA_IDXSET_INVALID
;
64 pa_strbuf_printf(s
, "%u client(s).\n", pa_idxset_ncontents(c
->clients
));
66 for (client
= pa_idxset_first(c
->clients
, &index
); client
; client
= pa_idxset_next(c
->clients
, &index
)) {
67 pa_strbuf_printf(s
, " index: %u\n\tname: <%s>\n\tprotocol_name: <%s>\n", client
->index
, client
->name
, client
->protocol_name
);
70 pa_strbuf_printf(s
, "\towner module: <%u>\n", client
->owner
->index
);
73 return pa_strbuf_tostring_free(s
);
76 char *pa_sink_list_to_string(struct pa_core
*c
) {
78 struct pa_sink
*sink
, *default_sink
;
79 uint32_t index
= PA_IDXSET_INVALID
;
85 pa_strbuf_printf(s
, "%u sink(s) available.\n", pa_idxset_ncontents(c
->sinks
));
87 default_sink
= pa_sink_get_default(c
);
89 for (sink
= pa_idxset_first(c
->sinks
, &index
); sink
; sink
= pa_idxset_next(c
->sinks
, &index
)) {
90 char ss
[PA_SAMPLE_SNPRINT_MAX_LENGTH
];
91 pa_sample_snprint(ss
, sizeof(ss
), &sink
->sample_spec
);
92 assert(sink
->monitor_source
);
95 " %c index: %u\n\tname: <%s>\n\tvolume: <0x%04x>\n\tlatency: <%u usec>\n\tmonitor_source: <%u>\n\tsample_spec: <%s>\n",
96 sink
== default_sink
? '*' : ' ',
97 sink
->index
, sink
->name
,
98 (unsigned) sink
->volume
,
99 pa_sink_get_latency(sink
),
100 sink
->monitor_source
->index
,
104 pa_strbuf_printf(s
, "\towner module: <%u>\n", sink
->owner
->index
);
105 if (sink
->description
)
106 pa_strbuf_printf(s
, "\tdescription: <%s>\n", sink
->description
);
109 return pa_strbuf_tostring_free(s
);
112 char *pa_source_list_to_string(struct pa_core
*c
) {
114 struct pa_source
*source
, *default_source
;
115 uint32_t index
= PA_IDXSET_INVALID
;
121 pa_strbuf_printf(s
, "%u source(s) available.\n", pa_idxset_ncontents(c
->sources
));
123 default_source
= pa_source_get_default(c
);
125 for (source
= pa_idxset_first(c
->sources
, &index
); source
; source
= pa_idxset_next(c
->sources
, &index
)) {
126 char ss
[PA_SAMPLE_SNPRINT_MAX_LENGTH
];
127 pa_sample_snprint(ss
, sizeof(ss
), &source
->sample_spec
);
128 pa_strbuf_printf(s
, " %c index: %u\n\tname: <%s>\n\tsample_spec: <%s>\n", source
== default_source
? '*' : ' ', source
->index
, source
->name
, ss
);
130 if (source
->monitor_of
)
131 pa_strbuf_printf(s
, "\tmonitor_of: <%u>\n", source
->monitor_of
->index
);
133 pa_strbuf_printf(s
, "\towner module: <%u>\n", source
->owner
->index
);
134 if (source
->description
)
135 pa_strbuf_printf(s
, "\tdescription: <%s>\n", source
->description
);
138 return pa_strbuf_tostring_free(s
);
142 char *pa_source_output_list_to_string(struct pa_core
*c
) {
144 struct pa_source_output
*o
;
145 uint32_t index
= PA_IDXSET_INVALID
;
151 pa_strbuf_printf(s
, "%u source outputs(s) available.\n", pa_idxset_ncontents(c
->source_outputs
));
153 for (o
= pa_idxset_first(c
->source_outputs
, &index
); o
; o
= pa_idxset_next(c
->source_outputs
, &index
)) {
154 char ss
[PA_SAMPLE_SNPRINT_MAX_LENGTH
];
155 pa_sample_snprint(ss
, sizeof(ss
), &o
->sample_spec
);
158 s
, " index: %u\n\tname: <%s>\n\tsource: <%u>\n\tsample_spec: <%s>\n",
164 pa_strbuf_printf(s
, "\towner module: <%u>\n", o
->owner
->index
);
166 pa_strbuf_printf(s
, "\tclient: <%u>\n", o
->client
->index
);
169 return pa_strbuf_tostring_free(s
);
172 char *pa_sink_input_list_to_string(struct pa_core
*c
) {
174 struct pa_sink_input
*i
;
175 uint32_t index
= PA_IDXSET_INVALID
;
181 pa_strbuf_printf(s
, "%u sink input(s) available.\n", pa_idxset_ncontents(c
->sink_inputs
));
183 for (i
= pa_idxset_first(c
->sink_inputs
, &index
); i
; i
= pa_idxset_next(c
->sink_inputs
, &index
)) {
184 char ss
[PA_SAMPLE_SNPRINT_MAX_LENGTH
];
185 pa_sample_snprint(ss
, sizeof(ss
), &i
->sample_spec
);
188 s
, " index: %u\n\tname: <%s>\n\tsink: <%u>\n\tvolume: <0x%04x>\n\tlatency: <%u usec>\n\tsample_spec: <%s>\n",
192 (unsigned) i
->volume
,
193 pa_sink_input_get_latency(i
),
197 pa_strbuf_printf(s
, "\towner module: <%u>\n", i
->owner
->index
);
199 pa_strbuf_printf(s
, "\tclient: <%u>\n", i
->client
->index
);
202 return pa_strbuf_tostring_free(s
);