mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
Add new option to disable remixing from/to LFE and set it to on by default
This commit is contained in:
parent
33d349dcbb
commit
f2164023fd
11 changed files with 49 additions and 23 deletions
|
|
@ -105,6 +105,16 @@ USA.
|
|||
matching only.</p>
|
||||
</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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
; resample-method = speex-float-3
|
||||
; disable-remixing = no
|
||||
; disable-lfe-remixing = yes
|
||||
|
||||
; no-cpu-limit = no
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue