summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-09-05 16:04:42 +0300
committerLennart Poettering <lennart@poettering.net>2008-09-05 16:04:42 +0300
commitf2164023fd0fda8c1a456c5c2f144f8943c24db9 (patch)
treec2c14f0d6b09640b40858eb889304dbb87d56a47
parent33d349dcbbef0952e9e59ca105e08fdff5454803 (diff)
Add new option to disable remixing from/to LFE and set it to on by default
-rw-r--r--man/pulse-daemon.conf.5.xml.in10
-rw-r--r--src/daemon/daemon-conf.c36
-rw-r--r--src/daemon/daemon-conf.h1
-rw-r--r--src/daemon/daemon.conf.in1
-rw-r--r--src/daemon/main.c1
-rw-r--r--src/pulsecore/core.c1
-rw-r--r--src/pulsecore/core.h1
-rw-r--r--src/pulsecore/resampler.c8
-rw-r--r--src/pulsecore/resampler.h7
-rw-r--r--src/pulsecore/sink-input.c3
-rw-r--r--src/pulsecore/source-output.c3
11 files changed, 49 insertions, 23 deletions
diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index c2eefaa5..ed158dfa 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -106,6 +106,16 @@ USA.
</option>
<option>
+ <p><opt>disable-lfe-remixing=</opt> When upmixing or downmixing
+ ignore LFE channels. When this option is on the output LFE
+ channel will only get a signal when an input LFE channel is
+ available as well. If no input LFE channel is available the
+ output LFE channel will always be 0. If no output LFE channel is
+ available the signal on the input LFE channel will be
+ ignored.</p>
+ </option>
+
+ <option>
<p><opt>use-pid-file=</opt> Create a PID file in
<file>/tmp/pulse-$USER/pid</file>. Of this is enabled you may
use commands like <opt>--kill</opt> or <opt>--check</opt>. If
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 40e0a170..77da3f7e 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -76,6 +76,7 @@ static const pa_daemon_conf default_conf = {
.log_level = PA_LOG_NOTICE,
.resample_method = PA_RESAMPLER_AUTO,
.disable_remixing = FALSE,
+ .disable_lfe_remixing = TRUE,
.config_file = NULL,
.use_pid_file = TRUE,
.system_instance = FALSE,
@@ -426,6 +427,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
{ "default-fragment-size-msec", parse_fragment_size_msec, NULL },
{ "nice-level", parse_nice_level, NULL },
{ "disable-remixing", pa_config_parse_bool, NULL },
+ { "disable-lfe-remixing", pa_config_parse_bool, NULL },
{ "load-default-script-file", pa_config_parse_bool, NULL },
#ifdef HAVE_SYS_RESOURCE_H
{ "rlimit-fsize", parse_rlimit, NULL },
@@ -490,66 +492,67 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
table[24].data = c;
table[25].data = c;
table[26].data = &c->disable_remixing;
- table[27].data = &c->load_default_script_file;
+ table[27].data = &c->disable_lfe_remixing;
+ table[28].data = &c->load_default_script_file;
#ifdef HAVE_SYS_RESOURCE_H
- table[28].data = &c->rlimit_fsize;
- table[29].data = &c->rlimit_data;
- table[30].data = &c->rlimit_stack;
- table[31].data = &c->rlimit_as;
- table[32].data = &c->rlimit_core;
- table[33].data = &c->rlimit_nofile;
- table[34].data = &c->rlimit_as;
+ table[29].data = &c->rlimit_fsize;
+ table[30].data = &c->rlimit_data;
+ table[31].data = &c->rlimit_stack;
+ table[32].data = &c->rlimit_as;
+ table[33].data = &c->rlimit_core;
+ table[34].data = &c->rlimit_nofile;
+ table[35].data = &c->rlimit_as;
#ifdef RLIMIT_NPROC
- table[35].data = &c->rlimit_nproc;
+ table[36].data = &c->rlimit_nproc;
#endif
#ifdef RLIMIT_MEMLOCK
#ifndef RLIMIT_NPROC
#error "Houston, we have a numbering problem!"
#endif
- table[36].data = &c->rlimit_memlock;
+ table[37].data = &c->rlimit_memlock;
#endif
#ifdef RLIMIT_LOCKS
#ifndef RLIMIT_MEMLOCK
#error "Houston, we have a numbering problem!"
#endif
- table[37].data = &c->rlimit_locks;
+ table[38].data = &c->rlimit_locks;
#endif
#ifdef RLIMIT_SIGPENDING
#ifndef RLIMIT_LOCKS
#error "Houston, we have a numbering problem!"
#endif
- table[38].data = &c->rlimit_sigpending;
+ table[39].data = &c->rlimit_sigpending;
#endif
#ifdef RLIMIT_MSGQUEUE
#ifndef RLIMIT_SIGPENDING
#error "Houston, we have a numbering problem!"
#endif
- table[39].data = &c->rlimit_msgqueue;
+ table[40].data = &c->rlimit_msgqueue;
#endif
#ifdef RLIMIT_NICE
#ifndef RLIMIT_MSGQUEUE
#error "Houston, we have a numbering problem!"
#endif
- table[40].data = &c->rlimit_nice;
+ table[41].data = &c->rlimit_nice;
#endif
#ifdef RLIMIT_RTPRIO
#ifndef RLIMIT_NICE
#error "Houston, we have a numbering problem!"
#endif
- table[41].data = &c->rlimit_rtprio;
+ table[42].data = &c->rlimit_rtprio;
#endif
#ifdef RLIMIT_RTTIME
#ifndef RLIMIT_RTTIME
#error "Houston, we have a numbering problem!"
#endif
- table[42].data = &c->rlimit_rttime;
+ table[43].data = &c->rlimit_rttime;
#endif
#endif
@@ -661,6 +664,7 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
pa_strbuf_printf(s, "log-level = %s\n", log_level_to_string[c->log_level]);
pa_strbuf_printf(s, "resample-method = %s\n", pa_resample_method_to_string(c->resample_method));
pa_strbuf_printf(s, "disable-remixing = %s\n", pa_yes_no(c->disable_remixing));
+ pa_strbuf_printf(s, "disable-lfe-remixing = %s\n", pa_yes_no(c->disable_lfe_remixing));
pa_strbuf_printf(s, "default-sample-format = %s\n", pa_sample_format_to_string(c->default_sample_spec.format));
pa_strbuf_printf(s, "default-sample-rate = %u\n", c->default_sample_spec.rate);
pa_strbuf_printf(s, "default-sample-channels = %u\n", c->default_sample_spec.channels);
diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h
index c42984f9..309a1428 100644
--- a/src/daemon/daemon-conf.h
+++ b/src/daemon/daemon-conf.h
@@ -66,6 +66,7 @@ typedef struct pa_daemon_conf {
no_cpu_limit,
disable_shm,
disable_remixing,
+ disable_lfe_remixing,
load_default_script_file,
disallow_exit;
int exit_idle_time,
diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in
index 33b1d61d..ea09fe09 100644
--- a/src/daemon/daemon.conf.in
+++ b/src/daemon/daemon.conf.in
@@ -47,6 +47,7 @@
; resample-method = speex-float-3
; disable-remixing = no
+; disable-lfe-remixing = yes
; no-cpu-limit = no
diff --git a/src/daemon/main.c b/src/daemon/main.c
index bb8af444..f91573b4 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -869,6 +869,7 @@ int main(int argc, char *argv[]) {
c->realtime_priority = conf->realtime_priority;
c->realtime_scheduling = !!conf->realtime_scheduling;
c->disable_remixing = !!conf->disable_remixing;
+ c->disable_lfe_remixing = !!conf->disable_lfe_remixing;
c->running_as_daemon = !!conf->daemonize;
c->disallow_exit = conf->disallow_exit;
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 6f8a2929..bd956ae0 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -138,6 +138,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
c->realtime_scheduling = FALSE;
c->realtime_priority = 5;
c->disable_remixing = FALSE;
+ c->disable_lfe_remixing = FALSE;
for (j = 0; j < PA_CORE_HOOK_MAX; j++)
pa_hook_init(&c->hooks[j], c);
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index eb768418..fb4490f2 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -124,6 +124,7 @@ struct pa_core {
pa_bool_t running_as_daemon:1;
pa_bool_t realtime_scheduling:1;
pa_bool_t disable_remixing:1;
+ pa_bool_t disable_lfe_remixing:1;
pa_resample_method_t resample_method;
int realtime_priority;
diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index 45cd68c1..0ae029b3 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -716,7 +716,11 @@ static void calc_map_table(pa_resampler *r) {
* channels for LFE. */
for (ic = 0; ic < r->i_ss.channels; ic++) {
- r->map_table[oc][ic] = 1.0f / (float) r->i_ss.channels;
+
+ if (!(r->flags & PA_RESAMPLER_NO_LFE))
+ r->map_table[oc][ic] = 1.0f / (float) r->i_ss.channels;
+ else
+ r->map_table[oc][ic] = 0;
/* Please note that a channel connected to LFE
* doesn't really count as connected. */
@@ -851,7 +855,7 @@ static void calc_map_table(pa_resampler *r) {
}
}
- if (ic_unconnected_lfe > 0) {
+ if (ic_unconnected_lfe > 0 && !(r->flags & PA_RESAMPLER_NO_LFE)) {
/* OK, so there is an unconnected LFE channel. Let's mix
* it into all channels, with factor 0.375 */
diff --git a/src/pulsecore/resampler.h b/src/pulsecore/resampler.h
index 5e302a9b..87110cc2 100644
--- a/src/pulsecore/resampler.h
+++ b/src/pulsecore/resampler.h
@@ -49,9 +49,10 @@ typedef enum pa_resample_method {
} pa_resample_method_t;
typedef enum pa_resample_flags {
- PA_RESAMPLER_VARIABLE_RATE = 1,
- PA_RESAMPLER_NO_REMAP = 2, /* implies NO_REMIX */
- PA_RESAMPLER_NO_REMIX = 4
+ PA_RESAMPLER_VARIABLE_RATE = 0x0001U,
+ PA_RESAMPLER_NO_REMAP = 0x0002U, /* implies NO_REMIX */
+ PA_RESAMPLER_NO_REMIX = 0x0004U,
+ PA_RESAMPLER_NO_LFE = 0x0008U
} pa_resample_flags_t;
pa_resampler* pa_resampler_new(
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 7d80242f..326a7e2c 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -201,7 +201,8 @@ pa_sink_input* pa_sink_input_new(
data->resample_method,
((flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
((flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
- (core->disable_remixing || (flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0)))) {
+ (core->disable_remixing || (flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+ (core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
pa_log_warn("Unsupported resampling operation.");
return NULL;
}
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 5df950a8..d76f6e4e 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -171,7 +171,8 @@ pa_source_output* pa_source_output_new(
data->resample_method,
((flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
((flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
- (core->disable_remixing || (flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0)))) {
+ (core->disable_remixing || (flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+ (core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
pa_log_warn("Unsupported resampling operation.");
return NULL;
}