2 This file is part of PulseAudio.
4 Copyright 2004-2006 Lennart Poettering
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.1 of the License,
9 or (at your option) any later version.
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.
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
26 #include <pulse/volume.h>
27 #include <pulse/xmalloc.h>
28 #include <pulse/timeval.h>
30 #include <pulsecore/module.h>
31 #include <pulsecore/client.h>
32 #include <pulsecore/sink.h>
33 #include <pulsecore/source.h>
34 #include <pulsecore/sink-input.h>
35 #include <pulsecore/source-output.h>
36 #include <pulsecore/strbuf.h>
37 #include <pulsecore/core-scache.h>
38 #include <pulsecore/macro.h>
39 #include <pulsecore/core-util.h>
40 #include <pulsecore/namereg.h>
44 char *pa_module_list_to_string(pa_core
*c
) {
47 uint32_t idx
= PA_IDXSET_INVALID
;
52 pa_strbuf_printf(s
, "%u module(s) loaded.\n", pa_idxset_size(c
->modules
));
54 PA_IDXSET_FOREACH(m
, c
->modules
, idx
) {
57 pa_strbuf_printf(s
, " index: %u\n"
64 pa_strempty(m
->argument
),
65 pa_module_get_n_used(m
),
66 pa_yes_no(m
->load_once
));
68 t
= pa_proplist_to_string_sep(m
->proplist
, "\n\t\t");
69 pa_strbuf_printf(s
, "\tproperties:\n\t\t%s\n", t
);
73 return pa_strbuf_tostring_free(s
);
76 char *pa_client_list_to_string(pa_core
*c
) {
79 uint32_t idx
= PA_IDXSET_INVALID
;
84 pa_strbuf_printf(s
, "%u client(s) logged in.\n", pa_idxset_size(c
->clients
));
86 PA_IDXSET_FOREACH(client
, c
->clients
, idx
) {
96 pa_strbuf_printf(s
, "\towner module: %u\n", client
->module
->index
);
98 t
= pa_proplist_to_string_sep(client
->proplist
, "\n\t\t");
99 pa_strbuf_printf(s
, "\tproperties:\n\t\t%s\n", t
);
103 return pa_strbuf_tostring_free(s
);
106 static const char *available_to_string(pa_available_t a
) {
108 case PA_AVAILABLE_UNKNOWN
:
110 case PA_AVAILABLE_NO
:
112 case PA_AVAILABLE_YES
:
115 return "invalid"; /* Should never happen! */
119 static void append_port_list(pa_strbuf
*s
, pa_hashmap
*ports
) {
125 if (pa_hashmap_isempty(ports
))
128 pa_strbuf_puts(s
, "\tports:\n");
129 PA_HASHMAP_FOREACH(p
, ports
, state
) {
130 char *t
= pa_proplist_to_string_sep(p
->proplist
, "\n\t\t\t\t");
131 pa_strbuf_printf(s
, "\t\t%s: %s (priority %u, latency offset %" PRId64
" usec, available: %s)\n",
132 p
->name
, p
->description
, p
->priority
, p
->latency_offset
,
133 available_to_string(p
->available
));
134 pa_strbuf_printf(s
, "\t\t\tproperties:\n\t\t\t\t%s\n", t
);
139 char *pa_card_list_to_string(pa_core
*c
) {
142 uint32_t idx
= PA_IDXSET_INVALID
;
147 pa_strbuf_printf(s
, "%u card(s) available.\n", pa_idxset_size(c
->cards
));
149 PA_IDXSET_FOREACH(card
, c
->cards
, idx
) {
154 pa_card_profile
*profile
;
167 pa_strbuf_printf(s
, "\towner module: %u\n", card
->module
->index
);
169 t
= pa_proplist_to_string_sep(card
->proplist
, "\n\t\t");
170 pa_strbuf_printf(s
, "\tproperties:\n\t\t%s\n", t
);
173 pa_strbuf_puts(s
, "\tprofiles:\n");
174 PA_HASHMAP_FOREACH(profile
, card
->profiles
, state
)
175 pa_strbuf_printf(s
, "\t\t%s: %s (priority %u, available: %s)\n", profile
->name
, profile
->description
,
176 profile
->priority
, available_to_string(profile
->available
));
180 "\tactive profile: <%s>\n",
181 card
->active_profile
->name
);
183 if (!pa_idxset_isempty(card
->sinks
)) {
184 pa_strbuf_puts(s
, "\tsinks:\n");
185 PA_IDXSET_FOREACH(sink
, card
->sinks
, sidx
)
186 pa_strbuf_printf(s
, "\t\t%s/#%u: %s\n", sink
->name
, sink
->index
, pa_strna(pa_proplist_gets(sink
->proplist
, PA_PROP_DEVICE_DESCRIPTION
)));
189 if (!pa_idxset_isempty(card
->sources
)) {
190 pa_strbuf_puts(s
, "\tsources:\n");
191 PA_IDXSET_FOREACH(source
, card
->sources
, sidx
)
192 pa_strbuf_printf(s
, "\t\t%s/#%u: %s\n", source
->name
, source
->index
, pa_strna(pa_proplist_gets(source
->proplist
, PA_PROP_DEVICE_DESCRIPTION
)));
195 append_port_list(s
, card
->ports
);
198 return pa_strbuf_tostring_free(s
);
201 static const char *sink_state_to_string(pa_sink_state_t state
) {
205 case PA_SINK_RUNNING
:
207 case PA_SINK_SUSPENDED
:
211 case PA_SINK_UNLINKED
:
218 static const char *source_state_to_string(pa_source_state_t state
) {
222 case PA_SOURCE_RUNNING
:
224 case PA_SOURCE_SUSPENDED
:
228 case PA_SOURCE_UNLINKED
:
235 char *pa_sink_list_to_string(pa_core
*c
) {
237 pa_sink
*sink
, *default_sink
;
238 uint32_t idx
= PA_IDXSET_INVALID
;
243 pa_strbuf_printf(s
, "%u sink(s) available.\n", pa_idxset_size(c
->sinks
));
245 default_sink
= pa_namereg_get_default_sink(c
);
247 PA_IDXSET_FOREACH(sink
, c
->sinks
, idx
) {
248 char ss
[PA_SAMPLE_SPEC_SNPRINT_MAX
],
249 cv
[PA_CVOLUME_SNPRINT_MAX
],
250 cvdb
[PA_SW_CVOLUME_SNPRINT_DB_MAX
],
251 v
[PA_VOLUME_SNPRINT_MAX
],
252 vdb
[PA_SW_VOLUME_SNPRINT_DB_MAX
],
253 cm
[PA_CHANNEL_MAP_SNPRINT_MAX
], *t
;
256 cmn
= pa_channel_map_to_pretty_name(&sink
->channel_map
);
263 "\tflags: %s%s%s%s%s%s%s%s\n"
265 "\tsuspend cause: %s%s%s%s\n"
269 "\tbase volume: %s%s%s\n"
270 "\tvolume steps: %u\n"
272 "\tcurrent latency: %0.2f ms\n"
273 "\tmax request: %lu KiB\n"
274 "\tmax rewind: %lu KiB\n"
275 "\tmonitor source: %u\n"
276 "\tsample spec: %s\n"
277 "\tchannel map: %s%s%s\n"
280 sink
== default_sink
? '*' : ' ',
284 sink
->flags
& PA_SINK_HARDWARE
? "HARDWARE " : "",
285 sink
->flags
& PA_SINK_NETWORK
? "NETWORK " : "",
286 sink
->flags
& PA_SINK_HW_MUTE_CTRL
? "HW_MUTE_CTRL " : "",
287 sink
->flags
& PA_SINK_HW_VOLUME_CTRL
? "HW_VOLUME_CTRL " : "",
288 sink
->flags
& PA_SINK_DECIBEL_VOLUME
? "DECIBEL_VOLUME " : "",
289 sink
->flags
& PA_SINK_LATENCY
? "LATENCY " : "",
290 sink
->flags
& PA_SINK_FLAT_VOLUME
? "FLAT_VOLUME " : "",
291 sink
->flags
& PA_SINK_DYNAMIC_LATENCY
? "DYNAMIC_LATENCY" : "",
292 sink_state_to_string(pa_sink_get_state(sink
)),
293 sink
->suspend_cause
& PA_SUSPEND_USER
? "USER " : "",
294 sink
->suspend_cause
& PA_SUSPEND_APPLICATION
? "APPLICATION " : "",
295 sink
->suspend_cause
& PA_SUSPEND_IDLE
? "IDLE " : "",
296 sink
->suspend_cause
& PA_SUSPEND_SESSION
? "SESSION" : "",
298 pa_cvolume_snprint(cv
, sizeof(cv
), pa_sink_get_volume(sink
, FALSE
)),
299 sink
->flags
& PA_SINK_DECIBEL_VOLUME
? "\n\t " : "",
300 sink
->flags
& PA_SINK_DECIBEL_VOLUME
? pa_sw_cvolume_snprint_dB(cvdb
, sizeof(cvdb
), pa_sink_get_volume(sink
, FALSE
)) : "",
301 pa_cvolume_get_balance(pa_sink_get_volume(sink
, FALSE
), &sink
->channel_map
),
302 pa_volume_snprint(v
, sizeof(v
), sink
->base_volume
),
303 sink
->flags
& PA_SINK_DECIBEL_VOLUME
? "\n\t " : "",
304 sink
->flags
& PA_SINK_DECIBEL_VOLUME
? pa_sw_volume_snprint_dB(vdb
, sizeof(vdb
), sink
->base_volume
) : "",
305 sink
->n_volume_steps
,
306 pa_yes_no(pa_sink_get_mute(sink
, FALSE
)),
307 (double) pa_sink_get_latency(sink
) / (double) PA_USEC_PER_MSEC
,
308 (unsigned long) pa_sink_get_max_request(sink
) / 1024,
309 (unsigned long) pa_sink_get_max_rewind(sink
) / 1024,
310 sink
->monitor_source
? sink
->monitor_source
->index
: PA_INVALID_INDEX
,
311 pa_sample_spec_snprint(ss
, sizeof(ss
), &sink
->sample_spec
),
312 pa_channel_map_snprint(cm
, sizeof(cm
), &sink
->channel_map
),
315 pa_sink_used_by(sink
),
316 pa_sink_linked_by(sink
));
318 if (sink
->flags
& PA_SINK_DYNAMIC_LATENCY
) {
319 pa_usec_t min_latency
, max_latency
;
320 pa_sink_get_latency_range(sink
, &min_latency
, &max_latency
);
324 "\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n",
325 (double) pa_sink_get_requested_latency(sink
) / (double) PA_USEC_PER_MSEC
,
326 (double) min_latency
/ PA_USEC_PER_MSEC
,
327 (double) max_latency
/ PA_USEC_PER_MSEC
);
331 "\tfixed latency: %0.2f ms\n",
332 (double) pa_sink_get_fixed_latency(sink
) / PA_USEC_PER_MSEC
);
335 pa_strbuf_printf(s
, "\tcard: %u <%s>\n", sink
->card
->index
, sink
->card
->name
);
337 pa_strbuf_printf(s
, "\tmodule: %u\n", sink
->module
->index
);
339 t
= pa_proplist_to_string_sep(sink
->proplist
, "\n\t\t");
340 pa_strbuf_printf(s
, "\tproperties:\n\t\t%s\n", t
);
343 append_port_list(s
, sink
->ports
);
345 if (sink
->active_port
)
348 "\tactive port: <%s>\n",
349 sink
->active_port
->name
);
352 return pa_strbuf_tostring_free(s
);
355 char *pa_source_list_to_string(pa_core
*c
) {
357 pa_source
*source
, *default_source
;
358 uint32_t idx
= PA_IDXSET_INVALID
;
363 pa_strbuf_printf(s
, "%u source(s) available.\n", pa_idxset_size(c
->sources
));
365 default_source
= pa_namereg_get_default_source(c
);
367 PA_IDXSET_FOREACH(source
, c
->sources
, idx
) {
368 char ss
[PA_SAMPLE_SPEC_SNPRINT_MAX
],
369 cv
[PA_CVOLUME_SNPRINT_MAX
],
370 cvdb
[PA_SW_CVOLUME_SNPRINT_DB_MAX
],
371 v
[PA_VOLUME_SNPRINT_MAX
],
372 vdb
[PA_SW_VOLUME_SNPRINT_DB_MAX
],
373 cm
[PA_CHANNEL_MAP_SNPRINT_MAX
], *t
;
376 cmn
= pa_channel_map_to_pretty_name(&source
->channel_map
);
383 "\tflags: %s%s%s%s%s%s%s\n"
385 "\tsuspend cause: %s%s%s%s\n"
389 "\tbase volume: %s%s%s\n"
390 "\tvolume steps: %u\n"
392 "\tcurrent latency: %0.2f ms\n"
393 "\tmax rewind: %lu KiB\n"
394 "\tsample spec: %s\n"
395 "\tchannel map: %s%s%s\n"
398 source
== default_source
? '*' : ' ',
402 source
->flags
& PA_SOURCE_HARDWARE
? "HARDWARE " : "",
403 source
->flags
& PA_SOURCE_NETWORK
? "NETWORK " : "",
404 source
->flags
& PA_SOURCE_HW_MUTE_CTRL
? "HW_MUTE_CTRL " : "",
405 source
->flags
& PA_SOURCE_HW_VOLUME_CTRL
? "HW_VOLUME_CTRL " : "",
406 source
->flags
& PA_SOURCE_DECIBEL_VOLUME
? "DECIBEL_VOLUME " : "",
407 source
->flags
& PA_SOURCE_LATENCY
? "LATENCY " : "",
408 source
->flags
& PA_SOURCE_DYNAMIC_LATENCY
? "DYNAMIC_LATENCY" : "",
409 source_state_to_string(pa_source_get_state(source
)),
410 source
->suspend_cause
& PA_SUSPEND_USER
? "USER " : "",
411 source
->suspend_cause
& PA_SUSPEND_APPLICATION
? "APPLICATION " : "",
412 source
->suspend_cause
& PA_SUSPEND_IDLE
? "IDLE " : "",
413 source
->suspend_cause
& PA_SUSPEND_SESSION
? "SESSION" : "",
415 pa_cvolume_snprint(cv
, sizeof(cv
), pa_source_get_volume(source
, FALSE
)),
416 source
->flags
& PA_SOURCE_DECIBEL_VOLUME
? "\n\t " : "",
417 source
->flags
& PA_SOURCE_DECIBEL_VOLUME
? pa_sw_cvolume_snprint_dB(cvdb
, sizeof(cvdb
), pa_source_get_volume(source
, FALSE
)) : "",
418 pa_cvolume_get_balance(pa_source_get_volume(source
, FALSE
), &source
->channel_map
),
419 pa_volume_snprint(v
, sizeof(v
), source
->base_volume
),
420 source
->flags
& PA_SOURCE_DECIBEL_VOLUME
? "\n\t " : "",
421 source
->flags
& PA_SOURCE_DECIBEL_VOLUME
? pa_sw_volume_snprint_dB(vdb
, sizeof(vdb
), source
->base_volume
) : "",
422 source
->n_volume_steps
,
423 pa_yes_no(pa_source_get_mute(source
, FALSE
)),
424 (double) pa_source_get_latency(source
) / PA_USEC_PER_MSEC
,
425 (unsigned long) pa_source_get_max_rewind(source
) / 1024,
426 pa_sample_spec_snprint(ss
, sizeof(ss
), &source
->sample_spec
),
427 pa_channel_map_snprint(cm
, sizeof(cm
), &source
->channel_map
),
430 pa_source_used_by(source
),
431 pa_source_linked_by(source
));
433 if (source
->flags
& PA_SOURCE_DYNAMIC_LATENCY
) {
434 pa_usec_t min_latency
, max_latency
;
435 pa_source_get_latency_range(source
, &min_latency
, &max_latency
);
439 "\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n",
440 (double) pa_source_get_requested_latency(source
) / PA_USEC_PER_MSEC
,
441 (double) min_latency
/ PA_USEC_PER_MSEC
,
442 (double) max_latency
/ PA_USEC_PER_MSEC
);
446 "\tfixed latency: %0.2f ms\n",
447 (double) pa_source_get_fixed_latency(source
) / PA_USEC_PER_MSEC
);
449 if (source
->monitor_of
)
450 pa_strbuf_printf(s
, "\tmonitor_of: %u\n", source
->monitor_of
->index
);
452 pa_strbuf_printf(s
, "\tcard: %u <%s>\n", source
->card
->index
, source
->card
->name
);
454 pa_strbuf_printf(s
, "\tmodule: %u\n", source
->module
->index
);
456 t
= pa_proplist_to_string_sep(source
->proplist
, "\n\t\t");
457 pa_strbuf_printf(s
, "\tproperties:\n\t\t%s\n", t
);
460 append_port_list(s
, source
->ports
);
462 if (source
->active_port
)
465 "\tactive port: <%s>\n",
466 source
->active_port
->name
);
469 return pa_strbuf_tostring_free(s
);
472 char *pa_source_output_list_to_string(pa_core
*c
) {
475 uint32_t idx
= PA_IDXSET_INVALID
;
476 static const char* const state_table
[] = {
477 [PA_SOURCE_OUTPUT_INIT
] = "INIT",
478 [PA_SOURCE_OUTPUT_RUNNING
] = "RUNNING",
479 [PA_SOURCE_OUTPUT_CORKED
] = "CORKED",
480 [PA_SOURCE_OUTPUT_UNLINKED
] = "UNLINKED"
486 pa_strbuf_printf(s
, "%u source output(s) available.\n", pa_idxset_size(c
->source_outputs
));
488 PA_IDXSET_FOREACH(o
, c
->source_outputs
, idx
) {
489 char ss
[PA_SAMPLE_SPEC_SNPRINT_MAX
], cvdb
[PA_SW_CVOLUME_SNPRINT_DB_MAX
], cv
[PA_CVOLUME_SNPRINT_MAX
], cm
[PA_CHANNEL_MAP_SNPRINT_MAX
], *t
, clt
[28];
493 char *volume_str
= NULL
;
495 cmn
= pa_channel_map_to_pretty_name(&o
->channel_map
);
497 if ((cl
= pa_source_output_get_requested_latency(o
)) == (pa_usec_t
) -1)
498 pa_snprintf(clt
, sizeof(clt
), "n/a");
500 pa_snprintf(clt
, sizeof(clt
), "%0.2f ms", (double) cl
/ PA_USEC_PER_MSEC
);
502 pa_assert(o
->source
);
504 if (pa_source_output_is_volume_readable(o
)) {
505 pa_source_output_get_volume(o
, &v
, TRUE
);
506 volume_str
= pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f",
507 pa_cvolume_snprint(cv
, sizeof(cv
), &v
),
508 pa_sw_cvolume_snprint_dB(cvdb
, sizeof(cvdb
), &v
),
509 pa_cvolume_get_balance(&v
, &o
->channel_map
));
511 volume_str
= pa_xstrdup("n/a");
517 "\tflags: %s%s%s%s%s%s%s%s%s%s%s%s\n"
519 "\tsource: %u <%s>\n"
522 "\tcurrent latency: %0.2f ms\n"
523 "\trequested latency: %s\n"
524 "\tsample spec: %s\n"
525 "\tchannel map: %s%s%s\n"
526 "\tresample method: %s\n",
529 o
->flags
& PA_SOURCE_OUTPUT_VARIABLE_RATE
? "VARIABLE_RATE " : "",
530 o
->flags
& PA_SOURCE_OUTPUT_DONT_MOVE
? "DONT_MOVE " : "",
531 o
->flags
& PA_SOURCE_OUTPUT_START_CORKED
? "START_CORKED " : "",
532 o
->flags
& PA_SOURCE_OUTPUT_NO_REMAP
? "NO_REMAP " : "",
533 o
->flags
& PA_SOURCE_OUTPUT_NO_REMIX
? "NO_REMIX " : "",
534 o
->flags
& PA_SOURCE_OUTPUT_FIX_FORMAT
? "FIX_FORMAT " : "",
535 o
->flags
& PA_SOURCE_OUTPUT_FIX_RATE
? "FIX_RATE " : "",
536 o
->flags
& PA_SOURCE_OUTPUT_FIX_CHANNELS
? "FIX_CHANNELS " : "",
537 o
->flags
& PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND
? "DONT_INHIBIT_AUTO_SUSPEND " : "",
538 o
->flags
& PA_SOURCE_OUTPUT_NO_CREATE_ON_SUSPEND
? "NO_CREATE_ON_SUSPEND " : "",
539 o
->flags
& PA_SOURCE_OUTPUT_KILL_ON_SUSPEND
? "KILL_ON_SUSPEND " : "",
540 o
->flags
& PA_SOURCE_OUTPUT_PASSTHROUGH
? "PASSTHROUGH " : "",
541 state_table
[pa_source_output_get_state(o
)],
542 o
->source
->index
, o
->source
->name
,
544 pa_yes_no(pa_source_output_get_mute(o
)),
545 (double) pa_source_output_get_latency(o
, NULL
) / PA_USEC_PER_MSEC
,
547 pa_sample_spec_snprint(ss
, sizeof(ss
), &o
->sample_spec
),
548 pa_channel_map_snprint(cm
, sizeof(cm
), &o
->channel_map
),
551 pa_resample_method_to_string(pa_source_output_get_resample_method(o
)));
553 pa_xfree(volume_str
);
556 pa_strbuf_printf(s
, "\towner module: %u\n", o
->module
->index
);
558 pa_strbuf_printf(s
, "\tclient: %u <%s>\n", o
->client
->index
, pa_strnull(pa_proplist_gets(o
->client
->proplist
, PA_PROP_APPLICATION_NAME
)));
559 if (o
->direct_on_input
)
560 pa_strbuf_printf(s
, "\tdirect on input: %u\n", o
->direct_on_input
->index
);
562 t
= pa_proplist_to_string_sep(o
->proplist
, "\n\t\t");
563 pa_strbuf_printf(s
, "\tproperties:\n\t\t%s\n", t
);
567 return pa_strbuf_tostring_free(s
);
570 char *pa_sink_input_list_to_string(pa_core
*c
) {
573 uint32_t idx
= PA_IDXSET_INVALID
;
574 static const char* const state_table
[] = {
575 [PA_SINK_INPUT_INIT
] = "INIT",
576 [PA_SINK_INPUT_RUNNING
] = "RUNNING",
577 [PA_SINK_INPUT_DRAINED
] = "DRAINED",
578 [PA_SINK_INPUT_CORKED
] = "CORKED",
579 [PA_SINK_INPUT_UNLINKED
] = "UNLINKED"
585 pa_strbuf_printf(s
, "%u sink input(s) available.\n", pa_idxset_size(c
->sink_inputs
));
587 PA_IDXSET_FOREACH(i
, c
->sink_inputs
, idx
) {
588 char ss
[PA_SAMPLE_SPEC_SNPRINT_MAX
], cvdb
[PA_SW_CVOLUME_SNPRINT_DB_MAX
], cv
[PA_CVOLUME_SNPRINT_MAX
], cm
[PA_CHANNEL_MAP_SNPRINT_MAX
], *t
, clt
[28];
592 char *volume_str
= NULL
;
594 cmn
= pa_channel_map_to_pretty_name(&i
->channel_map
);
596 if ((cl
= pa_sink_input_get_requested_latency(i
)) == (pa_usec_t
) -1)
597 pa_snprintf(clt
, sizeof(clt
), "n/a");
599 pa_snprintf(clt
, sizeof(clt
), "%0.2f ms", (double) cl
/ PA_USEC_PER_MSEC
);
603 if (pa_sink_input_is_volume_readable(i
)) {
604 pa_sink_input_get_volume(i
, &v
, TRUE
);
605 volume_str
= pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f",
606 pa_cvolume_snprint(cv
, sizeof(cv
), &v
),
607 pa_sw_cvolume_snprint_dB(cvdb
, sizeof(cvdb
), &v
),
608 pa_cvolume_get_balance(&v
, &i
->channel_map
));
610 volume_str
= pa_xstrdup("n/a");
616 "\tflags: %s%s%s%s%s%s%s%s%s%s%s%s\n"
621 "\tcurrent latency: %0.2f ms\n"
622 "\trequested latency: %s\n"
623 "\tsample spec: %s\n"
624 "\tchannel map: %s%s%s\n"
625 "\tresample method: %s\n",
628 i
->flags
& PA_SINK_INPUT_VARIABLE_RATE
? "VARIABLE_RATE " : "",
629 i
->flags
& PA_SINK_INPUT_DONT_MOVE
? "DONT_MOVE " : "",
630 i
->flags
& PA_SINK_INPUT_START_CORKED
? "START_CORKED " : "",
631 i
->flags
& PA_SINK_INPUT_NO_REMAP
? "NO_REMAP " : "",
632 i
->flags
& PA_SINK_INPUT_NO_REMIX
? "NO_REMIX " : "",
633 i
->flags
& PA_SINK_INPUT_FIX_FORMAT
? "FIX_FORMAT " : "",
634 i
->flags
& PA_SINK_INPUT_FIX_RATE
? "FIX_RATE " : "",
635 i
->flags
& PA_SINK_INPUT_FIX_CHANNELS
? "FIX_CHANNELS " : "",
636 i
->flags
& PA_SINK_INPUT_DONT_INHIBIT_AUTO_SUSPEND
? "DONT_INHIBIT_AUTO_SUSPEND " : "",
637 i
->flags
& PA_SINK_INPUT_NO_CREATE_ON_SUSPEND
? "NO_CREATE_SUSPEND " : "",
638 i
->flags
& PA_SINK_INPUT_KILL_ON_SUSPEND
? "KILL_ON_SUSPEND " : "",
639 i
->flags
& PA_SINK_INPUT_PASSTHROUGH
? "PASSTHROUGH " : "",
640 state_table
[pa_sink_input_get_state(i
)],
641 i
->sink
->index
, i
->sink
->name
,
643 pa_yes_no(pa_sink_input_get_mute(i
)),
644 (double) pa_sink_input_get_latency(i
, NULL
) / PA_USEC_PER_MSEC
,
646 pa_sample_spec_snprint(ss
, sizeof(ss
), &i
->sample_spec
),
647 pa_channel_map_snprint(cm
, sizeof(cm
), &i
->channel_map
),
650 pa_resample_method_to_string(pa_sink_input_get_resample_method(i
)));
652 pa_xfree(volume_str
);
655 pa_strbuf_printf(s
, "\tmodule: %u\n", i
->module
->index
);
657 pa_strbuf_printf(s
, "\tclient: %u <%s>\n", i
->client
->index
, pa_strnull(pa_proplist_gets(i
->client
->proplist
, PA_PROP_APPLICATION_NAME
)));
659 t
= pa_proplist_to_string_sep(i
->proplist
, "\n\t\t");
660 pa_strbuf_printf(s
, "\tproperties:\n\t\t%s\n", t
);
664 return pa_strbuf_tostring_free(s
);
667 char *pa_scache_list_to_string(pa_core
*c
) {
673 pa_strbuf_printf(s
, "%u cache entrie(s) available.\n", c
->scache
? pa_idxset_size(c
->scache
) : 0);
677 uint32_t idx
= PA_IDXSET_INVALID
;
679 PA_IDXSET_FOREACH(e
, c
->scache
, idx
) {
681 char ss
[PA_SAMPLE_SPEC_SNPRINT_MAX
] = "n/a", cv
[PA_CVOLUME_SNPRINT_MAX
], cvdb
[PA_SW_CVOLUME_SNPRINT_DB_MAX
], cm
[PA_CHANNEL_MAP_SNPRINT_MAX
] = "n/a", *t
;
684 cmn
= pa_channel_map_to_pretty_name(&e
->channel_map
);
686 if (e
->memchunk
.memblock
) {
687 pa_sample_spec_snprint(ss
, sizeof(ss
), &e
->sample_spec
);
688 pa_channel_map_snprint(cm
, sizeof(cm
), &e
->channel_map
);
689 l
= (double) e
->memchunk
.length
/ (double) pa_bytes_per_second(&e
->sample_spec
);
696 "\tsample spec: %s\n"
697 "\tchannel map: %s%s%s\n"
699 "\tduration: %0.1f s\n"
704 "\tfilename: <%s>\n",
711 (long unsigned)(e
->memchunk
.memblock
? e
->memchunk
.length
: 0),
713 e
->volume_is_set
? pa_cvolume_snprint(cv
, sizeof(cv
), &e
->volume
) : "n/a",
714 e
->volume_is_set
? pa_sw_cvolume_snprint_dB(cvdb
, sizeof(cvdb
), &e
->volume
) : "n/a",
715 (e
->memchunk
.memblock
&& e
->volume_is_set
) ? pa_cvolume_get_balance(&e
->volume
, &e
->channel_map
) : 0.0f
,
717 e
->filename
? e
->filename
: "n/a");
719 t
= pa_proplist_to_string_sep(e
->proplist
, "\n\t\t");
720 pa_strbuf_printf(s
, "\tproperties:\n\t\t%s\n", t
);
725 return pa_strbuf_tostring_free(s
);
728 char *pa_full_status_string(pa_core
*c
) {
734 for (i
= 0; i
< 8; i
++) {
739 t
= pa_sink_list_to_string(c
);
742 t
= pa_source_list_to_string(c
);
745 t
= pa_sink_input_list_to_string(c
);
748 t
= pa_source_output_list_to_string(c
);
751 t
= pa_client_list_to_string(c
);
754 t
= pa_card_list_to_string(c
);
757 t
= pa_module_list_to_string(c
);
760 t
= pa_scache_list_to_string(c
);
764 pa_strbuf_puts(s
, t
);
768 return pa_strbuf_tostring_free(s
);