summaryrefslogtreecommitdiffstats
path: root/src/pulse
diff options
context:
space:
mode:
Diffstat (limited to 'src/pulse')
-rw-r--r--src/pulse/client-conf-x11.c15
-rw-r--r--src/pulse/client-conf.c31
-rw-r--r--src/pulse/context.c24
-rw-r--r--src/pulse/volume.c2
-rw-r--r--src/pulse/volume.h8
5 files changed, 47 insertions, 33 deletions
diff --git a/src/pulse/client-conf-x11.c b/src/pulse/client-conf-x11.c
index 3bec742f..4970363b 100644
--- a/src/pulse/client-conf-x11.c
+++ b/src/pulse/client-conf-x11.c
@@ -57,8 +57,23 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
}
if (pa_x11_get_prop(d, "PULSE_SERVER", t, sizeof(t))) {
+ pa_bool_t disable_autospawn = TRUE;
+
pa_xfree(c->default_server);
c->default_server = pa_xstrdup(t);
+
+ if (pa_x11_get_prop(d, "PULSE_SESSION_ID", t, sizeof(t))) {
+ char *id;
+
+ if ((id = pa_session_id())) {
+ if (pa_streq(t, id))
+ disable_autospawn = FALSE;
+ pa_xfree(id);
+ }
+ }
+
+ if (disable_autospawn)
+ c->autospawn = FALSE;
}
if (pa_x11_get_prop(d, "PULSE_SINK", t, sizeof(t))) {
diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
index 58bc3f90..940d0b67 100644
--- a/src/pulse/client-conf.c
+++ b/src/pulse/client-conf.c
@@ -92,28 +92,18 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
/* Prepare the configuration parse table */
pa_config_item table[] = {
- { "daemon-binary", pa_config_parse_string, NULL, NULL },
- { "extra-arguments", pa_config_parse_string, NULL, NULL },
- { "default-sink", pa_config_parse_string, NULL, NULL },
- { "default-source", pa_config_parse_string, NULL, NULL },
- { "default-server", pa_config_parse_string, NULL, NULL },
- { "autospawn", pa_config_parse_bool, NULL, NULL },
- { "cookie-file", pa_config_parse_string, NULL, NULL },
- { "disable-shm", pa_config_parse_bool, NULL, NULL },
- { "shm-size-bytes", pa_config_parse_size, NULL, NULL },
+ { "daemon-binary", pa_config_parse_string, &c->daemon_binary, NULL },
+ { "extra-arguments", pa_config_parse_string, &c->extra_arguments, NULL },
+ { "default-sink", pa_config_parse_string, &c->default_sink, NULL },
+ { "default-source", pa_config_parse_string, &c->default_source, NULL },
+ { "default-server", pa_config_parse_string, &c->default_server, NULL },
+ { "autospawn", pa_config_parse_bool, &c->autospawn, NULL },
+ { "cookie-file", pa_config_parse_string, &c->cookie_file, NULL },
+ { "disable-shm", pa_config_parse_bool, &c->disable_shm, NULL },
+ { "shm-size-bytes", pa_config_parse_size, &c->shm_size, NULL },
{ NULL, NULL, NULL, NULL },
};
- table[0].data = &c->daemon_binary;
- table[1].data = &c->extra_arguments;
- table[2].data = &c->default_sink;
- table[3].data = &c->default_source;
- table[4].data = &c->default_server;
- table[5].data = &c->autospawn;
- table[6].data = &c->cookie_file;
- table[7].data = &c->disable_shm;
- table[8].data = &c->shm_size;
-
if (filename) {
if (!(f = fopen(filename, "r"))) {
@@ -160,6 +150,9 @@ int pa_client_conf_env(pa_client_conf *c) {
if ((e = getenv(ENV_DEFAULT_SERVER))) {
pa_xfree(c->default_server);
c->default_server = pa_xstrdup(e);
+
+ /* We disable autospawning automatically if a specific server was set */
+ c->autospawn = FALSE;
}
if ((e = getenv(ENV_DAEMON_BINARY))) {
diff --git a/src/pulse/context.c b/src/pulse/context.c
index ef36f090..4aad737f 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -186,10 +186,10 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *
#endif
c->conf = pa_client_conf_new();
+ pa_client_conf_load(c->conf, NULL);
#ifdef HAVE_X11
pa_client_conf_from_x11(c->conf, NULL);
#endif
- pa_client_conf_load(c->conf, NULL);
pa_client_conf_env(c->conf);
if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm, c->conf->shm_size))) {
@@ -925,7 +925,9 @@ int pa_context_connect(
PA_CHECK_VALIDITY(c, !(flags & ~(PA_CONTEXT_NOAUTOSPAWN|PA_CONTEXT_NOFAIL)), PA_ERR_INVALID);
PA_CHECK_VALIDITY(c, !server || *server, PA_ERR_INVALID);
- if (!server)
+ if (server)
+ c->conf->autospawn = FALSE;
+ else
server = c->conf->default_server;
pa_context_ref(c);
@@ -967,18 +969,18 @@ int pa_context_connect(
/* The user instance via PF_LOCAL */
c->server_list = prepend_per_user(c->server_list);
+ }
- /* Set up autospawning */
- if (!(flags & PA_CONTEXT_NOAUTOSPAWN) && c->conf->autospawn) {
+ /* Set up autospawning */
+ if (!(flags & PA_CONTEXT_NOAUTOSPAWN) && c->conf->autospawn) {
- if (getuid() == 0)
- pa_log_debug("Not doing autospawn since we are root.");
- else {
- c->do_autospawn = TRUE;
+ if (getuid() == 0)
+ pa_log_debug("Not doing autospawn since we are root.");
+ else {
+ c->do_autospawn = TRUE;
- if (api)
- c->spawn_api = *api;
- }
+ if (api)
+ c->spawn_api = *api;
}
}
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index ad3b3a49..6848771e 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -120,7 +120,7 @@ pa_volume_t pa_sw_volume_divide(pa_volume_t a, pa_volume_t b) {
return pa_sw_volume_from_linear(pa_sw_volume_to_linear(a) / v);
}
-#define USER_DECIBEL_RANGE 60
+#define USER_DECIBEL_RANGE 90
pa_volume_t pa_sw_volume_from_dB(double dB) {
if (isinf(dB) < 0 || dB <= -USER_DECIBEL_RANGE)
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index c3c396c8..5b7e1213 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -24,6 +24,7 @@
***/
#include <inttypes.h>
+#include <limits.h>
#include <pulse/cdecl.h>
#include <pulse/gccmacro.h>
@@ -102,12 +103,15 @@ PA_C_DECL_BEGIN
* > PA_VOLUME_NORM: increased volume */
typedef uint32_t pa_volume_t;
-/** Normal volume (100%) */
+/** Normal volume (100%, 0 dB) */
#define PA_VOLUME_NORM ((pa_volume_t) 0x10000U)
-/** Muted volume (0%) */
+/** Muted volume (0%, -inf dB) */
#define PA_VOLUME_MUTED ((pa_volume_t) 0U)
+/** Maximum volume we can store. \since 0.9.15 */
+#define PA_VOLUME_MAX ((pa_volume_t) UINT32_MAX)
+
/** A structure encapsulating a per-channel volume */
typedef struct pa_cvolume {
uint8_t channels; /**< Number of channels */