[pulseaudio-discuss] [PATCH 4/4] Add remixing-use-all-sink-channels option.
david at mandelberg.org
david at mandelberg.org
Wed Jan 4 04:17:19 UTC 2017
From: David Mandelberg <dseomn at google.com>
This option controls the PA_RESAMPLER_USE_ALL_SINK_CHANNELS flag added
in a previous commit.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=62588
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=94563
---
man/pulse-daemon.conf.5.xml.in | 8 ++++++++
src/daemon/daemon-conf.c | 4 ++++
src/daemon/daemon-conf.h | 1 +
src/daemon/daemon.conf.in | 1 +
src/daemon/main.c | 1 +
src/pulsecore/core.c | 1 +
src/pulsecore/core.h | 1 +
src/pulsecore/sink-input.c | 2 ++
src/pulsecore/source-output.c | 2 ++
9 files changed, 21 insertions(+)
diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index ff5a293..d16fb79 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -130,6 +130,14 @@ License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
</option>
<option>
+ <p><opt>remixing-use-all-sink-channels=</opt> If enabled, use
+ all sink channels when remixing. Otherwise, remix to the minimal
+ set of sink channels needed to reproduce all of the source
+ channels. (This has no effect on LFE remixing.) Defaults to
+ <opt>no</opt>.</p>
+ </option>
+
+ <option>
<p><opt>enable-lfe-remixing=</opt> If disabled when upmixing or
downmixing ignore LFE channels. When this option is disabled the
output LFE channel will only get a signal when an input LFE
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index f0ed0b4..9c0b695 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -82,6 +82,7 @@ static const pa_daemon_conf default_conf = {
.log_time = false,
.resample_method = PA_RESAMPLER_AUTO,
.disable_remixing = false,
+ .remixing_use_all_sink_channels = false,
.disable_lfe_remixing = true,
.lfe_crossover_freq = 0,
.config_file = NULL,
@@ -554,6 +555,8 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
{ "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 },
+ { "remixing-use-all-sink-channels",
+ pa_config_parse_bool, &c->remixing_use_all_sink_channels, NULL },
{ "disable-lfe-remixing", pa_config_parse_bool, &c->disable_lfe_remixing, NULL },
{ "enable-lfe-remixing", pa_config_parse_not_bool, &c->disable_lfe_remixing, NULL },
{ "lfe-crossover-freq", pa_config_parse_unsigned, &c->lfe_crossover_freq, NULL },
@@ -748,6 +751,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, "enable-remixing = %s\n", pa_yes_no(!c->disable_remixing));
+ pa_strbuf_printf(s, "remixing-use-all-sink-channels = %s\n", pa_yes_no(c->remixing_use_all_sink_channels));
pa_strbuf_printf(s, "enable-lfe-remixing = %s\n", pa_yes_no(!c->disable_lfe_remixing));
pa_strbuf_printf(s, "lfe-crossover-freq = %u\n", c->lfe_crossover_freq);
pa_strbuf_printf(s, "default-sample-format = %s\n", pa_sample_format_to_string(c->default_sample_spec.format));
diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h
index 82b619f..e61f67f 100644
--- a/src/daemon/daemon-conf.h
+++ b/src/daemon/daemon-conf.h
@@ -68,6 +68,7 @@ typedef struct pa_daemon_conf {
disable_shm,
disable_memfd,
disable_remixing,
+ remixing_use_all_sink_channels,
disable_lfe_remixing,
load_default_script_file,
disallow_exit,
diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in
index f3a1cc3..93ceb40 100644
--- a/src/daemon/daemon.conf.in
+++ b/src/daemon/daemon.conf.in
@@ -55,6 +55,7 @@ ifelse(@HAVE_DBUS@, 1, [dnl
; resample-method = speex-float-1
; enable-remixing = yes
+; remixing-use-all-sink-channels = no
; enable-lfe-remixing = no
; lfe-crossover-freq = 0
diff --git a/src/daemon/main.c b/src/daemon/main.c
index dc5e5bc..280252a 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -1037,6 +1037,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->remixing_use_all_sink_channels = conf->remixing_use_all_sink_channels;
c->disable_lfe_remixing = conf->disable_lfe_remixing;
c->deferred_volume = conf->deferred_volume;
c->running_as_daemon = conf->daemonize;
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index 2a96dfa..47d598e 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -142,6 +142,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, bool shared, bool enable_memfd, size_t
c->realtime_scheduling = false;
c->realtime_priority = 5;
c->disable_remixing = false;
+ c->remixing_use_all_sink_channels = false;
c->disable_lfe_remixing = true;
c->lfe_crossover_freq = 0;
c->deferred_volume = true;
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 802111b..d2fe887 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -200,6 +200,7 @@ struct pa_core {
bool running_as_daemon:1;
bool realtime_scheduling:1;
bool disable_remixing:1;
+ bool remixing_use_all_sink_channels:1;
bool disable_lfe_remixing:1;
bool deferred_volume:1;
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index e9694f2..6057da7 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -456,6 +456,7 @@ int pa_sink_input_new(
((data->flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
((data->flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
(core->disable_remixing || (data->flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+ (core->remixing_use_all_sink_channels ? PA_RESAMPLER_USE_ALL_SINK_CHANNELS : 0) |
(core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
pa_log_warn("Unsupported resampling operation.");
return -PA_ERR_NOTSUPPORTED;
@@ -2259,6 +2260,7 @@ int pa_sink_input_update_rate(pa_sink_input *i) {
((i->flags & PA_SINK_INPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
((i->flags & PA_SINK_INPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
(i->core->disable_remixing || (i->flags & PA_SINK_INPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+ (i->core->remixing_use_all_sink_channels ? PA_RESAMPLER_USE_ALL_SINK_CHANNELS : 0) |
(i->core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0));
if (!new_resampler) {
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 6714ea9..ac4675b 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -401,6 +401,7 @@ int pa_source_output_new(
((data->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
((data->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
(core->disable_remixing || (data->flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+ (core->remixing_use_all_sink_channels ? PA_RESAMPLER_USE_ALL_SINK_CHANNELS : 0) |
(core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0)))) {
pa_log_warn("Unsupported resampling operation.");
return -PA_ERR_NOTSUPPORTED;
@@ -1714,6 +1715,7 @@ int pa_source_output_update_rate(pa_source_output *o) {
((o->flags & PA_SOURCE_OUTPUT_VARIABLE_RATE) ? PA_RESAMPLER_VARIABLE_RATE : 0) |
((o->flags & PA_SOURCE_OUTPUT_NO_REMAP) ? PA_RESAMPLER_NO_REMAP : 0) |
(o->core->disable_remixing || (o->flags & PA_SOURCE_OUTPUT_NO_REMIX) ? PA_RESAMPLER_NO_REMIX : 0) |
+ (o->core->remixing_use_all_sink_channels ? PA_RESAMPLER_USE_ALL_SINK_CHANNELS : 0) |
(o->core->disable_lfe_remixing ? PA_RESAMPLER_NO_LFE : 0));
if (!new_resampler) {
--
2.7.4
More information about the pulseaudio-discuss
mailing list