]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/cli-text.c
add suspend_within_thread() callbacks to pa_sink_input/pa_source_output
[pulseaudio] / src / pulsecore / cli-text.c
index 8ca8f2d9feedef13efd72193f66433a67a81d577..324f83c805276ddb410a353d78be5939560fc53a 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
 
   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
   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;
             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);
 
         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"
 
         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"
             "\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"
             "\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"
             "\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_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        " : "",
             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,
             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,
             (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,18 @@ char *pa_sink_list_to_string(pa_core *c) {
             pa_sink_used_by(sink),
             pa_sink_linked_by(sink));
 
             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);
+        }
+
         if (sink->card)
             pa_strbuf_printf(s, "\tcard: %u <%s>\n", sink->card->index, sink->card->name);
         if (sink->module)
         if (sink->card)
             pa_strbuf_printf(s, "\tcard: %u <%s>\n", sink->card->index, sink->card->name);
         if (sink->module)
@@ -313,19 +320,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;
             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);
 
         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"
         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"
             "\tstate: %s\n"
             "\tvolume: %s%s%s\n"
             "\t        balance %0.2f\n"
@@ -333,7 +337,6 @@ char *pa_source_list_to_string(pa_core *c) {
             "\tvolume steps: %u\n"
             "\tmuted: %s\n"
             "\tcurrent latency: %0.2f ms\n"
             "\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"
             "\tmax rewind: %lu KiB\n"
             "\tsample spec: %s\n"
             "\tchannel map: %s%s%s\n"
@@ -349,6 +352,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_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        " : "",
             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 +364,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,
             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),
             (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 +372,18 @@ char *pa_source_list_to_string(pa_core *c) {
             pa_source_used_by(source),
             pa_source_linked_by(source));
 
             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);
+        }
+
         if (source->monitor_of)
             pa_strbuf_printf(s, "\tmonitor_of: %u\n", source->monitor_of->index);
         if (source->card)
         if (source->monitor_of)
             pa_strbuf_printf(s, "\tmonitor_of: %u\n", source->monitor_of->index);
         if (source->card)