]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/cli-text.c
Remove unnecessary #includes
[pulseaudio] / src / pulsecore / cli-text.c
index c7a178d6c2ffe2cd6d528ace5664c6ac6a6b37ed..5498744cd842002de4352a26f87727f7823e8260 100644 (file)
@@ -23,8 +23,6 @@
 #include <config.h>
 #endif
 
-#include <string.h>
-
 #include <pulse/volume.h>
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
@@ -36,7 +34,6 @@
 #include <pulsecore/sink-input.h>
 #include <pulsecore/source-output.h>
 #include <pulsecore/strbuf.h>
-#include <pulsecore/sample-util.h>
 #include <pulsecore/core-scache.h>
 #include <pulsecore/macro.h>
 #include <pulsecore/core-util.h>
@@ -232,6 +229,7 @@ char *pa_sink_list_to_string(pa_core *c) {
             "\tflags: %s%s%s%s%s%s%s%s\n"
             "\tstate: %s\n"
             "\tsuspend cause: %s%s%s%s\n"
+            "\tpriority: %u\n"
             "\tvolume: %s%s%s\n"
             "\t        balance %0.2f\n"
             "\tbase volume: %s%s%s\n"
@@ -262,6 +260,7 @@ char *pa_sink_list_to_string(pa_core *c) {
             sink->suspend_cause & PA_SUSPEND_APPLICATION ? "APPLICATION " : "",
             sink->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
             sink->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
+            sink->priority,
             pa_cvolume_snprint(cv, sizeof(cv), pa_sink_get_volume(sink, FALSE)),
             sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t        " : "",
             sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_sink_get_volume(sink, FALSE)) : "",
@@ -356,6 +355,7 @@ char *pa_source_list_to_string(pa_core *c) {
             "\tflags: %s%s%s%s%s%s%s\n"
             "\tstate: %s\n"
             "\tsuspend cause: %s%s%s%s\n"
+            "\tpriority: %u\n"
             "\tvolume: %s%s%s\n"
             "\t        balance %0.2f\n"
             "\tbase volume: %s%s%s\n"
@@ -383,6 +383,7 @@ char *pa_source_list_to_string(pa_core *c) {
             source->suspend_cause & PA_SUSPEND_APPLICATION ? "APPLICATION " : "",
             source->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "",
             source->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "",
+            source->priority,
             pa_cvolume_snprint(cv, sizeof(cv), pa_source_get_volume(source, FALSE)),
             source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t        " : "",
             source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_source_get_volume(source, FALSE)) : "",
@@ -549,8 +550,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
         pa_usec_t cl;
         const char *cmn;
         pa_cvolume v;
-
-        pa_sink_input_get_volume(i, &v, TRUE);
+        char *volume_str = NULL;
 
         cmn = pa_channel_map_to_pretty_name(&i->channel_map);
 
@@ -561,6 +561,15 @@ char *pa_sink_input_list_to_string(pa_core *c) {
 
         pa_assert(i->sink);
 
+        if (pa_sink_input_is_volume_readable(i)) {
+            pa_sink_input_get_volume(i, &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, &i->channel_map));
+        } else
+            volume_str = pa_xstrdup("n/a");
+
         pa_strbuf_printf(
             s,
             "    index: %u\n"
@@ -569,8 +578,6 @@ char *pa_sink_input_list_to_string(pa_core *c) {
             "\tstate: %s\n"
             "\tsink: %u <%s>\n"
             "\tvolume: %s\n"
-            "\t        %s\n"
-            "\t        balance %0.2f\n"
             "\tmuted: %s\n"
             "\tcurrent latency: %0.2f ms\n"
             "\trequested latency: %s\n"
@@ -592,9 +599,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
             i->flags & PA_SINK_INPUT_KILL_ON_SUSPEND ? "KILL_ON_SUSPEND " : "",
             state_table[pa_sink_input_get_state(i)],
             i->sink->index, i->sink->name,
-            pa_cvolume_snprint(cv, sizeof(cv), &v),
-            pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v),
-            pa_cvolume_get_balance(&v, &i->channel_map),
+            volume_str,
             pa_yes_no(pa_sink_input_get_mute(i)),
             (double) pa_sink_input_get_latency(i, NULL) / PA_USEC_PER_MSEC,
             clt,
@@ -604,6 +609,8 @@ char *pa_sink_input_list_to_string(pa_core *c) {
             cmn ? cmn : "",
             pa_resample_method_to_string(pa_sink_input_get_resample_method(i)));
 
+        pa_xfree(volume_str);
+
         if (i->module)
             pa_strbuf_printf(s, "\tmodule: %u\n", i->module->index);
         if (i->client)