mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
cli: Ensure source output volumes are printed via cli interface (pacmd ls)
This commit is contained in:
parent
e8594e4b8e
commit
aed3b6f9df
1 changed files with 20 additions and 1 deletions
|
|
@ -484,9 +484,11 @@ char *pa_source_output_list_to_string(pa_core *c) {
|
||||||
pa_strbuf_printf(s, "%u source outputs(s) available.\n", pa_idxset_size(c->source_outputs));
|
pa_strbuf_printf(s, "%u source outputs(s) available.\n", pa_idxset_size(c->source_outputs));
|
||||||
|
|
||||||
for (o = pa_idxset_first(c->source_outputs, &idx); o; o = pa_idxset_next(c->source_outputs, &idx)) {
|
for (o = pa_idxset_first(c->source_outputs, &idx); o; o = pa_idxset_next(c->source_outputs, &idx)) {
|
||||||
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t, clt[28];
|
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];
|
||||||
pa_usec_t cl;
|
pa_usec_t cl;
|
||||||
const char *cmn;
|
const char *cmn;
|
||||||
|
pa_cvolume v;
|
||||||
|
char *volume_str = NULL;
|
||||||
|
|
||||||
cmn = pa_channel_map_to_pretty_name(&o->channel_map);
|
cmn = pa_channel_map_to_pretty_name(&o->channel_map);
|
||||||
|
|
||||||
|
|
@ -497,6 +499,16 @@ char *pa_source_output_list_to_string(pa_core *c) {
|
||||||
|
|
||||||
pa_assert(o->source);
|
pa_assert(o->source);
|
||||||
|
|
||||||
|
if (pa_source_output_is_volume_readable(o)) {
|
||||||
|
pa_source_output_get_volume(o, &v, TRUE);
|
||||||
|
volume_str = pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f",
|
||||||
|
pa_cvolume_snprint(cv, sizeof(cv), &v),
|
||||||
|
pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v),
|
||||||
|
pa_cvolume_get_balance(&v, &o->channel_map));
|
||||||
|
} else
|
||||||
|
volume_str = pa_xstrdup("n/a");
|
||||||
|
|
||||||
|
|
||||||
pa_strbuf_printf(
|
pa_strbuf_printf(
|
||||||
s,
|
s,
|
||||||
" index: %u\n"
|
" index: %u\n"
|
||||||
|
|
@ -504,6 +516,8 @@ char *pa_source_output_list_to_string(pa_core *c) {
|
||||||
"\tflags: %s%s%s%s%s%s%s%s%s%s%s\n"
|
"\tflags: %s%s%s%s%s%s%s%s%s%s%s\n"
|
||||||
"\tstate: %s\n"
|
"\tstate: %s\n"
|
||||||
"\tsource: %u <%s>\n"
|
"\tsource: %u <%s>\n"
|
||||||
|
"\tvolume: %s\n"
|
||||||
|
"\tmuted: %s\n"
|
||||||
"\tcurrent latency: %0.2f ms\n"
|
"\tcurrent latency: %0.2f ms\n"
|
||||||
"\trequested latency: %s\n"
|
"\trequested latency: %s\n"
|
||||||
"\tsample spec: %s\n"
|
"\tsample spec: %s\n"
|
||||||
|
|
@ -524,6 +538,8 @@ char *pa_source_output_list_to_string(pa_core *c) {
|
||||||
o->flags & PA_SOURCE_OUTPUT_KILL_ON_SUSPEND ? "KILL_ON_SUSPEND " : "",
|
o->flags & PA_SOURCE_OUTPUT_KILL_ON_SUSPEND ? "KILL_ON_SUSPEND " : "",
|
||||||
state_table[pa_source_output_get_state(o)],
|
state_table[pa_source_output_get_state(o)],
|
||||||
o->source->index, o->source->name,
|
o->source->index, o->source->name,
|
||||||
|
volume_str,
|
||||||
|
pa_yes_no(pa_source_output_get_mute(o)),
|
||||||
(double) pa_source_output_get_latency(o, NULL) / PA_USEC_PER_MSEC,
|
(double) pa_source_output_get_latency(o, NULL) / PA_USEC_PER_MSEC,
|
||||||
clt,
|
clt,
|
||||||
pa_sample_spec_snprint(ss, sizeof(ss), &o->sample_spec),
|
pa_sample_spec_snprint(ss, sizeof(ss), &o->sample_spec),
|
||||||
|
|
@ -531,6 +547,9 @@ char *pa_source_output_list_to_string(pa_core *c) {
|
||||||
cmn ? "\n\t " : "",
|
cmn ? "\n\t " : "",
|
||||||
cmn ? cmn : "",
|
cmn ? cmn : "",
|
||||||
pa_resample_method_to_string(pa_source_output_get_resample_method(o)));
|
pa_resample_method_to_string(pa_source_output_get_resample_method(o)));
|
||||||
|
|
||||||
|
pa_xfree(volume_str);
|
||||||
|
|
||||||
if (o->module)
|
if (o->module)
|
||||||
pa_strbuf_printf(s, "\towner module: %u\n", o->module->index);
|
pa_strbuf_printf(s, "\towner module: %u\n", o->module->index);
|
||||||
if (o->client)
|
if (o->client)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue