]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/core.c
Add new option to disable remixing from/to LFE and set it to on by default
[pulseaudio] / src / pulsecore / core.c
index 5e40ea882068524923a2e36de63c0ffd2061d38b..bd956ae0b5b287198a3873e865bca53681b42e73 100644 (file)
@@ -125,7 +125,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
     c->mempool = pool;
     pa_silence_cache_init(&c->silence_cache);
 
-    c->quit_event = NULL;
+    c->exit_event = NULL;
 
     c->exit_idle_time = -1;
     c->module_idle_time = 20;
@@ -134,9 +134,11 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
     c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
 
     c->disallow_module_loading = FALSE;
+    c->disallow_exit = FALSE;
     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);
@@ -149,7 +151,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, int shared) {
     pa_check_signal_is_blocked(SIGPIPE);
 #endif
 
-    pa_core_check_quit(c);
+    pa_core_check_idle(c);
 
     return c;
 }
@@ -182,8 +184,8 @@ static void core_free(pa_object *o) {
     pa_autoload_free(c);
     pa_subscription_free_all(c);
 
-    if (c->quit_event)
-        c->mainloop->time_free(c->quit_event);
+    if (c->exit_event)
+        c->mainloop->time_free(c->exit_event);
 
     pa_xfree(c->default_source_name);
     pa_xfree(c->default_sink_name);
@@ -199,17 +201,18 @@ static void core_free(pa_object *o) {
     pa_xfree(c);
 }
 
-static void quit_callback(pa_mainloop_api*m, pa_time_event *e, PA_GCC_UNUSED const struct timeval *tv, void *userdata) {
+static void exit_callback(pa_mainloop_api*m, pa_time_event *e, const struct timeval *tv, void *userdata) {
     pa_core *c = userdata;
-    pa_assert(c->quit_event == e);
+    pa_assert(c->exit_event == e);
 
-    m->quit(m, 0);
+    pa_log_info("We are idle, quitting...");
+    pa_core_exit(c, TRUE, 0);
 }
 
-void pa_core_check_quit(pa_core *c) {
+void pa_core_check_idle(pa_core *c) {
     pa_assert(c);
 
-    if (!c->quit_event &&
+    if (!c->exit_event &&
         c->exit_idle_time >= 0 &&
         pa_idxset_size(c->clients) == 0) {
 
@@ -217,10 +220,20 @@ void pa_core_check_quit(pa_core *c) {
         pa_gettimeofday(&tv);
         tv.tv_sec+= c->exit_idle_time;
 
-        c->quit_event = c->mainloop->time_new(c->mainloop, &tv, quit_callback, c);
+        c->exit_event = c->mainloop->time_new(c->mainloop, &tv, exit_callback, c);
 
-    } else if (c->quit_event && pa_idxset_size(c->clients) > 0) {
-        c->mainloop->time_free(c->quit_event);
-        c->quit_event = NULL;
+    } else if (c->exit_event && pa_idxset_size(c->clients) > 0) {
+        c->mainloop->time_free(c->exit_event);
+        c->exit_event = NULL;
     }
 }
+
+int pa_core_exit(pa_core *c, pa_bool_t force, int retval) {
+    pa_assert(c);
+
+    if (c->disallow_exit && !force)
+        return -1;
+
+    c->mainloop->quit(c->mainloop, retval);
+    return 0;
+}