[pulseaudio-discuss] [PATCH] core: add global max soft volume (first part)
Deng Zhengrong
dzrongg at gmail.com
Tue Aug 14 17:53:33 PDT 2012
Add the global max soft volume stub, the enforcement in sink/sink-input is not
implemented in this patch yet.
---
src/daemon/daemon-conf.c | 2 ++
src/daemon/daemon-conf.h | 1 +
src/daemon/main.c | 1 +
src/pulsecore/conf-parser.c | 4 ++++
src/pulsecore/conf-parser.h | 1 +
src/pulsecore/core.h | 2 ++
6 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 2c43cf9..3ef54c7 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -100,6 +100,7 @@ static const pa_daemon_conf default_conf = {
.default_fragment_size_msec = 25,
.deferred_volume_safety_margin_usec = 8000,
.deferred_volume_extra_delay_usec = 0,
+ .max_soft_volume = PA_VOLUME_MAX,
.default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 },
.alternate_sample_rate = 48000,
.default_channel_map = { .channels = 2, .map = { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT } },
@@ -599,6 +600,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
pa_config_parse_unsigned, &c->deferred_volume_safety_margin_usec, NULL },
{ "deferred-volume-extra-delay-usec",
pa_config_parse_int, &c->deferred_volume_extra_delay_usec, NULL },
+ { "max-soft-volume", pa_config_parse_volume, &c->max_soft_volume, NULL },
{ "nice-level", parse_nice_level, c, NULL },
{ "disable-remixing", pa_config_parse_bool, &c->disable_remixing, NULL },
{ "enable-remixing", pa_config_parse_not_bool, &c->disable_remixing, NULL },
diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h
index faf2540..9591ea6 100644
--- a/src/daemon/daemon-conf.h
+++ b/src/daemon/daemon-conf.h
@@ -130,6 +130,7 @@ typedef struct pa_daemon_conf {
unsigned default_n_fragments, default_fragment_size_msec;
unsigned deferred_volume_safety_margin_usec;
int deferred_volume_extra_delay_usec;
+ pa_volume_t max_soft_volume;
pa_sample_spec default_sample_spec;
uint32_t alternate_sample_rate;
pa_channel_map default_channel_map;
diff --git a/src/daemon/main.c b/src/daemon/main.c
index f7b102d..15d5d99 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -1030,6 +1030,7 @@ int main(int argc, char *argv[]) {
c->running_as_daemon = !!conf->daemonize;
c->disallow_exit = conf->disallow_exit;
c->flat_volumes = conf->flat_volumes;
+ c->max_soft_volume = conf->max_soft_volume;
#ifdef HAVE_DBUS
c->server_type = conf->local_server_type;
#endif
diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
index 062fa8e..653540a 100644
--- a/src/pulsecore/conf-parser.c
+++ b/src/pulsecore/conf-parser.c
@@ -232,6 +232,10 @@ int pa_config_parse_int(pa_config_parser_state *state) {
return 0;
}
+int pa_config_parse_volume(pa_config_parser_state *state) {
+ return pa_config_parse_unsigned(state);
+}
+
int pa_config_parse_unsigned(pa_config_parser_state *state) {
unsigned *u;
uint32_t k;
diff --git a/src/pulsecore/conf-parser.h b/src/pulsecore/conf-parser.h
index 7892a07..5175160 100644
--- a/src/pulsecore/conf-parser.h
+++ b/src/pulsecore/conf-parser.h
@@ -75,6 +75,7 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_p
/* Generic parsers for integers, size_t, booleans and strings */
int pa_config_parse_int(pa_config_parser_state *state);
int pa_config_parse_unsigned(pa_config_parser_state *state);
+int pa_config_parse_volume(pa_config_parser_state *state);
int pa_config_parse_size(pa_config_parser_state *state);
int pa_config_parse_bool(pa_config_parser_state *state);
int pa_config_parse_not_bool(pa_config_parser_state *state);
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index ba21fa9..5be9c46 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -173,6 +173,8 @@ struct pa_core {
pa_bool_t disable_lfe_remixing:1;
pa_bool_t deferred_volume:1;
+ pa_volume_t max_soft_volume;
+
pa_resample_method_t resample_method;
int realtime_priority;
--
1.7.7.6
More information about the pulseaudio-discuss
mailing list