summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/pulse/introspect.c10
-rw-r--r--src/pulse/introspect.h2
-rw-r--r--src/pulsecore/cli-text.c30
-rw-r--r--src/pulsecore/protocol-native.c7
-rw-r--r--src/pulsecore/sink.c1
-rw-r--r--src/pulsecore/sink.h2
-rw-r--r--src/pulsecore/source.c1
-rw-r--r--src/pulsecore/source.h2
8 files changed, 48 insertions, 7 deletions
diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c
index 38091581..5b905b7d 100644
--- a/src/pulse/introspect.c
+++ b/src/pulse/introspect.c
@@ -154,6 +154,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
memset(&i, 0, sizeof(i));
i.proplist = pa_proplist_new();
+ i.base_volume = PA_VOLUME_NORM;
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
@@ -170,7 +171,9 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
pa_tagstruct_getu32(t, &flags) < 0 ||
(o->context->version >= 13 &&
(pa_tagstruct_get_proplist(t, i.proplist) < 0 ||
- pa_tagstruct_get_usec(t, &i.configured_latency) < 0))) {
+ pa_tagstruct_get_usec(t, &i.configured_latency) < 0)) ||
+ (o->context->version >= 14 &&
+ pa_tagstruct_get_volume(t, &i.base_volume) < 0)) {
pa_context_fail(o->context, PA_ERR_PROTOCOL);
pa_proplist_free(i.proplist);
@@ -275,6 +278,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
memset(&i, 0, sizeof(i));
i.proplist = pa_proplist_new();
+ i.base_volume = PA_VOLUME_NORM;
if (pa_tagstruct_getu32(t, &i.index) < 0 ||
pa_tagstruct_gets(t, &i.name) < 0 ||
@@ -291,7 +295,9 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
pa_tagstruct_getu32(t, &flags) < 0 ||
(o->context->version >= 13 &&
(pa_tagstruct_get_proplist(t, i.proplist) < 0 ||
- pa_tagstruct_get_usec(t, &i.configured_latency) < 0))) {
+ pa_tagstruct_get_usec(t, &i.configured_latency) < 0)) ||
+ (o->context->version >= 14 &&
+ pa_tagstruct_get_volume(t, &i.base_volume) < 0)) {
pa_context_fail(o->context, PA_ERR_PROTOCOL);
pa_proplist_free(i.proplist);
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index 087bd9f9..b409cadb 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -231,6 +231,7 @@ typedef struct pa_sink_info {
pa_sink_flags_t flags; /**< Flags */
pa_proplist *proplist; /**< Property list \since 0.9.11 */
pa_usec_t configured_latency; /**< The latency this device has been configured to. \since 0.9.11 */
+ pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the output device. \since 0.9.14 */
} pa_sink_info;
/** Callback prototype for pa_context_get_sink_info_by_name() and friends */
@@ -286,6 +287,7 @@ typedef struct pa_source_info {
pa_source_flags_t flags; /**< Flags */
pa_proplist *proplist; /**< Property list \since 0.9.11 */
pa_usec_t configured_latency; /**< The latency this device has been configured to. \since 0.9.11 */
+ pa_volume_t base_volume; /**< Some kind of "base" volume that refers to unamplified/unattenuated volume in the context of the input device. \since 0.9.14 */
} pa_source_info;
/** Callback prototype for pa_context_get_source_info_by_name() and friends */
diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c
index 7bbc2660..362a9791 100644
--- a/src/pulsecore/cli-text.c
+++ b/src/pulsecore/cli-text.c
@@ -115,7 +115,12 @@ char *pa_sink_list_to_string(pa_core *c) {
pa_strbuf_printf(s, "%u sink(s) available.\n", pa_idxset_size(c->sinks));
for (sink = pa_idxset_first(c->sinks, &idx); sink; sink = pa_idxset_next(c->sinks, &idx)) {
- char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], *t;
+ char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
+ cv[PA_CVOLUME_SNPRINT_MAX],
+ cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
+ 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;
pa_sink_get_latency_range(sink, &min_latency, &max_latency);
@@ -127,7 +132,8 @@ char *pa_sink_list_to_string(pa_core *c) {
"\tdriver: <%s>\n"
"\tflags: %s%s%s%s%s%s\n"
"\tstate: %s\n"
- "\tvolume: %s\n"
+ "\tvolume: %s%s%s\n"
+ "\tbase volume: %s%s%s\n"
"\tmuted: %s\n"
"\tcurrent latency: %0.2f ms\n"
"\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n"
@@ -150,6 +156,11 @@ char *pa_sink_list_to_string(pa_core *c) {
sink->flags & PA_SINK_LATENCY ? "LATENCY " : "",
state_table[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->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_sink_get_volume(sink, FALSE)) : "",
+ pa_volume_snprint(v, sizeof(v), sink->base_volume),
+ sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "",
+ sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), sink->base_volume) : "",
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,
@@ -192,7 +203,12 @@ char *pa_source_list_to_string(pa_core *c) {
pa_strbuf_printf(s, "%u source(s) available.\n", pa_idxset_size(c->sources));
for (source = pa_idxset_first(c->sources, &idx); source; source = pa_idxset_next(c->sources, &idx)) {
- char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], *t;
+ char ss[PA_SAMPLE_SPEC_SNPRINT_MAX],
+ cv[PA_CVOLUME_SNPRINT_MAX],
+ cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX],
+ 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;
pa_source_get_latency_range(source, &min_latency, &max_latency);
@@ -204,7 +220,8 @@ char *pa_source_list_to_string(pa_core *c) {
"\tdriver: <%s>\n"
"\tflags: %s%s%s%s%s%s\n"
"\tstate: %s\n"
- "\tvolume: %s\n"
+ "\tvolume: %s%s%s\n"
+ "\tbase volume: %s%s%s\n"
"\tmuted: %s\n"
"\tcurrent latency: %0.2f ms\n"
"\tconfigured latency: %0.2f ms; range is %0.2f .. %0.2f ms\n"
@@ -225,6 +242,11 @@ char *pa_source_list_to_string(pa_core *c) {
source->flags & PA_SOURCE_LATENCY ? "LATENCY " : "",
state_table[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->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_source_get_volume(source, FALSE)) : "",
+ pa_volume_snprint(v, sizeof(v), source->base_volume),
+ source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "",
+ source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), source->base_volume) : "",
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,
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 56e86cb4..fa3e3f8d 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -2677,6 +2677,9 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin
pa_tagstruct_put_proplist(t, sink->proplist);
pa_tagstruct_put_usec(t, pa_sink_get_requested_latency(sink));
}
+
+ if (c->version >= 14)
+ pa_tagstruct_put_volume(t, sink->base_volume);
}
static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_source *source) {
@@ -2708,8 +2711,10 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s
pa_tagstruct_put_proplist(t, source->proplist);
pa_tagstruct_put_usec(t, pa_source_get_requested_latency(source));
}
-}
+ if (c->version >= 14)
+ pa_tagstruct_put_volume(t, source->base_volume);
+}
static void client_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_client *client) {
pa_assert(t);
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index 1580cf2e..37387766 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -191,6 +191,7 @@ pa_sink* pa_sink_new(
s->n_corked = 0;
s->volume = data->volume;
+ s->base_volume = PA_VOLUME_NORM;
s->muted = data->muted;
s->refresh_volume = s->refresh_muted = FALSE;
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index c5a73214..254be3b0 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -81,6 +81,8 @@ struct pa_sink {
pa_cvolume volume;
pa_bool_t muted;
+ pa_volume_t base_volume; /* shall be constant */
+
pa_bool_t refresh_volume:1;
pa_bool_t refresh_muted:1;
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index f113e295..5538ced1 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -185,6 +185,7 @@ pa_source* pa_source_new(
s->volume = data->volume;
s->muted = data->muted;
s->refresh_volume = s->refresh_muted = FALSE;
+ s->base_volume = PA_VOLUME_NORM;
reset_callbacks(s);
s->userdata = NULL;
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index aaf904b4..b93e4ad0 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -84,6 +84,8 @@ struct pa_source {
pa_cvolume volume;
pa_bool_t muted;
+ pa_volume_t base_volume; /* shall be constant */
+
pa_bool_t refresh_volume:1;
pa_bool_t refresh_muted:1;