]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/cli-text.c
core: add a seperate fixed_latency field for sinks/sources with fixed latency
[pulseaudio] / src / pulsecore / cli-text.c
index 57129d0c9cbf689ce435561c63f4e86eb84bd1ae..b0911ef1f279bd5d32d29b6dd6c92986c2878c9f 100644 (file)
@@ -5,7 +5,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -220,19 +220,17 @@ char *pa_sink_list_to_string(pa_core *c) {
             v[PA_VOLUME_SNPRINT_MAX],
             vdb[PA_SW_VOLUME_SNPRINT_DB_MAX],
             cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
-        pa_usec_t min_latency, max_latency;
         const char *cmn;
 
         cmn = pa_channel_map_to_pretty_name(&sink->channel_map);
 
-        pa_sink_get_latency_range(sink, &min_latency, &max_latency);
 
         pa_strbuf_printf(
             s,
             "  %c index: %u\n"
             "\tname: <%s>\n"
             "\tdriver: <%s>\n"
-            "\tflags: %s%s%s%s%s%s%s\n"
+            "\tflags: %s%s%s%s%s%s%s%s\n"
             "\tstate: %s\n"
             "\tvolume: %s%s%s\n"
             "\t        balance %0.2f\n"
@@ -240,7 +238,6 @@ char *pa_sink_list_to_string(pa_core *c) {
             "\tvolume steps: %u\n"
             "\tmuted: %s\n"
             "\tcurrent latency: %0.2f ms\n"
-            "\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n"
             "\tmax request: %lu KiB\n"
             "\tmax rewind: %lu KiB\n"
             "\tmonitor source: %u\n"
@@ -258,7 +255,8 @@ char *pa_sink_list_to_string(pa_core *c) {
             sink->flags & PA_SINK_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
             sink->flags & PA_SINK_DECIBEL_VOLUME ? "DECIBEL_VOLUME " : "",
             sink->flags & PA_SINK_LATENCY ? "LATENCY " : "",
-            sink->flags & PA_SINK_FLAT_VOLUME ? "FLAT_VOLUME" : "",
+            sink->flags & PA_SINK_FLAT_VOLUME ? "FLAT_VOLUME " : "",
+            sink->flags & PA_SINK_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "",
             sink_state_to_string(pa_sink_get_state(sink)),
             pa_cvolume_snprint(cv, sizeof(cv), pa_sink_get_volume(sink, FALSE)),
             sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t        " : "",
@@ -270,9 +268,6 @@ char *pa_sink_list_to_string(pa_core *c) {
             sink->n_volume_steps,
             pa_yes_no(pa_sink_get_mute(sink, FALSE)),
             (double) pa_sink_get_latency(sink) / (double) PA_USEC_PER_MSEC,
-            (double) pa_sink_get_requested_latency(sink) / (double) PA_USEC_PER_MSEC,
-            (double) min_latency / PA_USEC_PER_MSEC,
-            (double) max_latency / PA_USEC_PER_MSEC,
             (unsigned long) pa_sink_get_max_request(sink) / 1024,
             (unsigned long) pa_sink_get_max_rewind(sink) / 1024,
             sink->monitor_source ? sink->monitor_source->index : PA_INVALID_INDEX,
@@ -283,6 +278,22 @@ char *pa_sink_list_to_string(pa_core *c) {
             pa_sink_used_by(sink),
             pa_sink_linked_by(sink));
 
+        if (sink->flags & PA_SINK_DYNAMIC_LATENCY) {
+            pa_usec_t min_latency, max_latency;
+            pa_sink_get_latency_range(sink, &min_latency, &max_latency);
+
+            pa_strbuf_printf(
+                    s,
+                    "\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n",
+                    (double) pa_sink_get_requested_latency(sink) / (double) PA_USEC_PER_MSEC,
+                    (double) min_latency / PA_USEC_PER_MSEC,
+                    (double) max_latency / PA_USEC_PER_MSEC);
+        } else
+            pa_strbuf_printf(
+                    s,
+                    "\tfixed latency: %0.2f ms\n",
+                    (double) pa_sink_get_requested_latency(sink) / PA_USEC_PER_MSEC);
+
         if (sink->card)
             pa_strbuf_printf(s, "\tcard: %u <%s>\n", sink->card->index, sink->card->name);
         if (sink->module)
@@ -313,19 +324,16 @@ char *pa_source_list_to_string(pa_core *c) {
             v[PA_VOLUME_SNPRINT_MAX],
             vdb[PA_SW_VOLUME_SNPRINT_DB_MAX],
             cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
-        pa_usec_t min_latency, max_latency;
         const char *cmn;
 
         cmn = pa_channel_map_to_pretty_name(&source->channel_map);
 
-        pa_source_get_latency_range(source, &min_latency, &max_latency);
-
         pa_strbuf_printf(
             s,
             "  %c index: %u\n"
             "\tname: <%s>\n"
             "\tdriver: <%s>\n"
-            "\tflags: %s%s%s%s%s%s\n"
+            "\tflags: %s%s%s%s%s%s%s\n"
             "\tstate: %s\n"
             "\tvolume: %s%s%s\n"
             "\t        balance %0.2f\n"
@@ -333,7 +341,6 @@ char *pa_source_list_to_string(pa_core *c) {
             "\tvolume steps: %u\n"
             "\tmuted: %s\n"
             "\tcurrent latency: %0.2f ms\n"
-            "\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n"
             "\tmax rewind: %lu KiB\n"
             "\tsample spec: %s\n"
             "\tchannel map: %s%s%s\n"
@@ -349,6 +356,7 @@ char *pa_source_list_to_string(pa_core *c) {
             source->flags & PA_SOURCE_HW_VOLUME_CTRL ? "HW_VOLUME_CTRL " : "",
             source->flags & PA_SOURCE_DECIBEL_VOLUME ? "DECIBEL_VOLUME " : "",
             source->flags & PA_SOURCE_LATENCY ? "LATENCY " : "",
+            source->flags & PA_SOURCE_DYNAMIC_LATENCY ? "DYNAMIC_LATENCY" : "",
             source_state_to_string(pa_source_get_state(source)),
             pa_cvolume_snprint(cv, sizeof(cv), pa_source_get_volume(source, FALSE)),
             source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t        " : "",
@@ -360,9 +368,6 @@ char *pa_source_list_to_string(pa_core *c) {
             source->n_volume_steps,
             pa_yes_no(pa_source_get_mute(source, FALSE)),
             (double) pa_source_get_latency(source) / PA_USEC_PER_MSEC,
-            (double) pa_source_get_requested_latency(source) / PA_USEC_PER_MSEC,
-            (double) min_latency / PA_USEC_PER_MSEC,
-            (double) max_latency / PA_USEC_PER_MSEC,
             (unsigned long) pa_source_get_max_rewind(source) / 1024,
             pa_sample_spec_snprint(ss, sizeof(ss), &source->sample_spec),
             pa_channel_map_snprint(cm, sizeof(cm), &source->channel_map),
@@ -371,6 +376,22 @@ char *pa_source_list_to_string(pa_core *c) {
             pa_source_used_by(source),
             pa_source_linked_by(source));
 
+        if (source->flags & PA_SOURCE_DYNAMIC_LATENCY) {
+            pa_usec_t min_latency, max_latency;
+            pa_source_get_latency_range(source, &min_latency, &max_latency);
+
+            pa_strbuf_printf(
+                    s,
+                    "\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n",
+                    (double) pa_source_get_requested_latency(source) / PA_USEC_PER_MSEC,
+                    (double) min_latency / PA_USEC_PER_MSEC,
+                    (double) max_latency / PA_USEC_PER_MSEC);
+        } else
+            pa_strbuf_printf(
+                    s,
+                    "\tfixed latency: %0.2f ms\n",
+                    (double) pa_source_get_requested_latency(source) / PA_USEC_PER_MSEC);
+
         if (source->monitor_of)
             pa_strbuf_printf(s, "\tmonitor_of: %u\n", source->monitor_of->index);
         if (source->card)
@@ -421,7 +442,7 @@ char *pa_source_output_list_to_string(pa_core *c) {
             s,
             "    index: %u\n"
             "\tdriver: <%s>\n"
-            "\tflags: %s%s%s%s%s%s%s%s\n"
+            "\tflags: %s%s%s%s%s%s%s%s%s%s\n"
             "\tstate: %s\n"
             "\tsource: %u <%s>\n"
             "\tcurrent latency: %0.2f ms\n"
@@ -439,6 +460,8 @@ char *pa_source_output_list_to_string(pa_core *c) {
             o->flags & PA_SOURCE_OUTPUT_FIX_FORMAT ? "FIX_FORMAT " : "",
             o->flags & PA_SOURCE_OUTPUT_FIX_RATE ? "FIX_RATE " : "",
             o->flags & PA_SOURCE_OUTPUT_FIX_CHANNELS ? "FIX_CHANNELS " : "",
+            o->flags & PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND ? "DONT_INHIBIT_AUTO_SUSPEND " : "",
+            o->flags & PA_SOURCE_OUTPUT_FAIL_ON_SUSPEND ? "FAIL_ON_SUSPEND " : "",
             state_table[pa_source_output_get_state(o)],
             o->source->index, o->source->name,
             (double) pa_source_output_get_latency(o, NULL) / PA_USEC_PER_MSEC,
@@ -498,7 +521,7 @@ char *pa_sink_input_list_to_string(pa_core *c) {
             s,
             "    index: %u\n"
             "\tdriver: <%s>\n"
-            "\tflags: %s%s%s%s%s%s%s%s\n"
+            "\tflags: %s%s%s%s%s%s%s%s%s%s\n"
             "\tstate: %s\n"
             "\tsink: %u <%s>\n"
             "\tvolume: %s\n"
@@ -520,6 +543,8 @@ char *pa_sink_input_list_to_string(pa_core *c) {
             i->flags & PA_SINK_INPUT_FIX_FORMAT ? "FIX_FORMAT " : "",
             i->flags & PA_SINK_INPUT_FIX_RATE ? "FIX_RATE " : "",
             i->flags & PA_SINK_INPUT_FIX_CHANNELS ? "FIX_CHANNELS " : "",
+            i->flags & PA_SINK_INPUT_DONT_INHIBIT_AUTO_SUSPEND ? "DONT_INHIBIT_AUTO_SUSPEND " : "",
+            i->flags & PA_SINK_INPUT_FAIL_ON_SUSPEND ? "FAIL_ON_SUSPEND " : "",
             state_table[pa_sink_input_get_state(i)],
             i->sink->index, i->sink->name,
             pa_cvolume_snprint(cv, sizeof(cv), pa_sink_input_get_volume(i)),