summaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/alsa/alsa-mixer.c18
-rw-r--r--src/modules/alsa/mixer/paths/analog-output-headphones.conf2
-rw-r--r--src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf2
-rw-r--r--src/modules/alsa/mixer/paths/analog-output-mono.conf2
-rw-r--r--src/modules/module-cli.c28
-rw-r--r--src/modules/module-position-event-sounds.c5
-rw-r--r--src/modules/raop/module-raop-discover.c4
-rw-r--r--src/modules/rtp/rtsp_client.c24
8 files changed, 42 insertions, 43 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 685169b9..f3ce681f 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -479,7 +479,6 @@ static int element_get_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
snd_mixer_elem_t *me;
snd_mixer_selem_channel_id_t c;
pa_channel_position_mask_t mask = 0;
- pa_volume_t max_channel_volume = PA_VOLUME_MUTED;
unsigned k;
pa_assert(m);
@@ -546,9 +545,6 @@ static int element_get_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
f = from_alsa_volume(value, e->min_volume, e->max_volume);
}
- if (f > max_channel_volume)
- max_channel_volume = f;
-
for (k = 0; k < cm->channels; k++)
if (e->masks[c][e->n_channels-1] & PA_CHANNEL_POSITION_MASK(cm->map[k]))
if (v->values[k] < f)
@@ -559,7 +555,7 @@ static int element_get_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
for (k = 0; k < cm->channels; k++)
if (!(mask & PA_CHANNEL_POSITION_MASK(cm->map[k])))
- v->values[k] = max_channel_volume;
+ v->values[k] = PA_VOLUME_NORM;
return 0;
}
@@ -681,7 +677,6 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
snd_mixer_elem_t *me;
snd_mixer_selem_channel_id_t c;
pa_channel_position_mask_t mask = 0;
- pa_volume_t max_channel_volume = PA_VOLUME_MUTED;
unsigned k;
pa_assert(m);
@@ -771,9 +766,6 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
f = from_alsa_volume(value, e->min_volume, e->max_volume);
}
- if (f > max_channel_volume)
- max_channel_volume = f;
-
for (k = 0; k < cm->channels; k++)
if (e->masks[c][e->n_channels-1] & PA_CHANNEL_POSITION_MASK(cm->map[k]))
if (rv.values[k] < f)
@@ -784,7 +776,7 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann
for (k = 0; k < cm->channels; k++)
if (!(mask & PA_CHANNEL_POSITION_MASK(cm->map[k])))
- rv.values[k] = max_channel_volume;
+ rv.values[k] = PA_VOLUME_NORM;
*v = rv;
return 0;
@@ -1716,11 +1708,11 @@ static int option_verify(pa_alsa_option *o) {
{ "input-radio", N_("Radio") },
{ "input-video", N_("Video") },
{ "input-agc-on", N_("Automatic Gain Control") },
- { "input-agc-off", "" },
+ { "input-agc-off", N_("No Automatic Gain Control") },
{ "input-boost-on", N_("Boost") },
- { "input-boost-off", "" },
+ { "input-boost-off", N_("No Boost") },
{ "output-amplifier-on", N_("Amplifier") },
- { "output-amplifier-off", "" }
+ { "output-amplifier-off", N_("No Amplifier") }
};
pa_assert(o);
diff --git a/src/modules/alsa/mixer/paths/analog-output-headphones.conf b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
index 691cb3f2..61d2e297 100644
--- a/src/modules/alsa/mixer/paths/analog-output-headphones.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-headphones.conf
@@ -56,7 +56,7 @@ volume = off
switch = off
volume = off
-[Element Sourround]
+[Element Surround]
switch = off
volume = off
diff --git a/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf b/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf
index 3457d4a2..911361d7 100644
--- a/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf
@@ -62,7 +62,7 @@ volume = off
switch = off
volume = off
-[Element Sourround]
+[Element Surround]
switch = off
volume = off
diff --git a/src/modules/alsa/mixer/paths/analog-output-mono.conf b/src/modules/alsa/mixer/paths/analog-output-mono.conf
index dc270cfe..2fbc60b7 100644
--- a/src/modules/alsa/mixer/paths/analog-output-mono.conf
+++ b/src/modules/alsa/mixer/paths/analog-output-mono.conf
@@ -59,7 +59,7 @@ volume = off
switch = off
volume = off
-[Element Sourround]
+[Element Surround]
switch = off
volume = off
diff --git a/src/modules/module-cli.c b/src/modules/module-cli.c
index fd9452b4..6bd0f4fc 100644
--- a/src/modules/module-cli.c
+++ b/src/modules/module-cli.c
@@ -25,6 +25,8 @@
#include <stdio.h>
#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
#include <pulsecore/module.h>
#include <pulsecore/iochannel.h>
@@ -33,6 +35,8 @@
#include <pulsecore/log.h>
#include <pulsecore/modargs.h>
#include <pulsecore/macro.h>
+#include <pulsecore/core-util.h>
+#include <pulsecore/core-error.h>
#include "module-cli-symdef.h"
@@ -69,6 +73,7 @@ int pa__init(pa_module*m) {
pa_iochannel *io;
pa_modargs *ma;
pa_bool_t exit_on_eof = FALSE;
+ int fd;
pa_assert(m);
@@ -88,15 +93,28 @@ int pa__init(pa_module*m) {
}
if (pa_stdio_acquire() < 0) {
- pa_log("STDIN/STDUSE already in use.");
+ pa_log("STDIN/STDOUT already in use.");
goto fail;
}
- io = pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO);
- pa_iochannel_set_noclose(io, 1);
+ /* We try to open the controlling tty anew here. This has the
+ * benefit of giving us a new fd that doesn't share the O_NDELAY
+ * flag with fds 0, 1, or 2. Since pa_iochannel_xxx needs O_NDELAY
+ * on its fd using those fds directly could set O_NDELAY which
+ * fprintf() doesn't really like, resulting in truncated output
+ * of log messages, particularly because if stdout and stderr are
+ * dup'ed they share the same O_NDELAY, too. */
+
+ if ((fd = open("/dev/tty", O_RDWR|O_CLOEXEC|O_NONBLOCK)) >= 0) {
+ io = pa_iochannel_new(m->core->mainloop, fd, fd);
+ pa_log_debug("Managed to open /dev/tty.");
+ } else {
+ io = pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO);
+ pa_iochannel_set_noclose(io, TRUE);
+ pa_log_debug("Failed to open /dev/tty, using stdin/stdout fds instead.");
+ }
m->userdata = pa_cli_new(m->core, io, m);
-
pa_cli_set_eof_callback(m->userdata, exit_on_eof ? eof_and_exit_cb : eof_and_unload_cb, m);
pa_modargs_free(ma);
@@ -114,7 +132,7 @@ fail:
void pa__done(pa_module*m) {
pa_assert(m);
- if (m->core->running_as_daemon == 0) {
+ if (m->userdata) {
pa_cli_free(m->userdata);
pa_stdio_release();
}
diff --git a/src/modules/module-position-event-sounds.c b/src/modules/module-position-event-sounds.c
index fa8f73d8..7221b14f 100644
--- a/src/modules/module-position-event-sounds.c
+++ b/src/modules/module-position-event-sounds.c
@@ -65,8 +65,9 @@ static int parse_pos(const char *pos, double *f) {
}
if (*f < 0.0 || *f > 1.0) {
- pa_log_warn("Property hpos/vpos out of range %0.2f", *f);
- return -1;
+ pa_log_debug("Property hpos/vpos out of range %0.2f", *f);
+
+ *f = PA_CLAMP(*f, 0.0, 1.0);
}
return 0;
diff --git a/src/modules/raop/module-raop-discover.c b/src/modules/raop/module-raop-discover.c
index eaeb77fc..adba8e4f 100644
--- a/src/modules/raop/module-raop-discover.c
+++ b/src/modules/raop/module-raop-discover.c
@@ -265,7 +265,7 @@ static void browser_cb(
struct tunnel *t2;
if ((t2 = pa_hashmap_get(u->tunnels, t))) {
- pa_module_unload_by_index(u->core, t2->module_index, TRUE);
+ pa_module_unload_request_by_index(u->core, t2->module_index, TRUE);
pa_hashmap_remove(u->tunnels, t2);
tunnel_free(t2);
}
@@ -386,7 +386,7 @@ void pa__done(pa_module*m) {
struct tunnel *t;
while ((t = pa_hashmap_steal_first(u->tunnels))) {
- pa_module_unload_by_index(u->core, t->module_index, TRUE);
+ pa_module_unload_request_by_index(u->core, t->module_index, TRUE);
tunnel_free(t);
}
diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index 915c1072..59618064 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -60,7 +60,6 @@ struct pa_rtsp_client {
uint16_t port;
pa_socket_client *sc;
- pa_iochannel *io;
pa_ioline *ioline;
pa_rtsp_cb_t callback;
@@ -111,10 +110,8 @@ void pa_rtsp_client_free(pa_rtsp_client* c) {
if (c->sc)
pa_socket_client_unref(c->sc);
- if (c->ioline)
- pa_ioline_close(c->ioline);
- else if (c->io)
- pa_iochannel_free(c->io);
+
+ pa_rtsp_disconnect(c);
pa_xfree(c->hostname);
pa_xfree(c->url);
@@ -187,7 +184,6 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
if (!s) {
/* Keep the ioline/iochannel open as they will be freed automatically */
c->ioline = NULL;
- c->io = NULL;
c->callback(c, STATE_DISCONNECTED, NULL, c->userdata);
return;
}
@@ -303,8 +299,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata
pa_log("Connection failed: %s", pa_cstrerror(errno));
return;
}
- pa_assert(!c->io);
- c->io = io;
+ pa_assert(!c->ioline);
c->ioline = pa_ioline_new(io);
pa_ioline_set_callback(c->ioline, line_callback, c);
@@ -360,9 +355,6 @@ void pa_rtsp_disconnect(pa_rtsp_client *c) {
if (c->ioline)
pa_ioline_close(c->ioline);
- else if (c->io)
- pa_iochannel_free(c->io);
- c->io = NULL;
c->ioline = NULL;
}
@@ -408,13 +400,11 @@ static int rtsp_exec(pa_rtsp_client* c, const char* cmd,
pa_headerlist* headers) {
pa_strbuf* buf;
char* hdrs;
- ssize_t l;
pa_assert(c);
pa_assert(c->url);
-
- if (!cmd)
- return -1;
+ pa_assert(cmd);
+ pa_assert(c->ioline);
pa_log_debug("Sending command: %s", cmd);
@@ -453,11 +443,9 @@ static int rtsp_exec(pa_rtsp_client* c, const char* cmd,
hdrs = pa_strbuf_tostring_free(buf);
/*pa_log_debug("Submitting request:");
pa_log_debug(hdrs);*/
- l = pa_iochannel_write(c->io, hdrs, strlen(hdrs));
+ pa_ioline_puts(c->ioline, hdrs);
pa_xfree(hdrs);
- /* FIXME: this is broken, not necessarily all bytes are written */
-
return 0;
}