mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
allow setting the default sample and fragment settings from the config file
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1630 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
b44ce9e4e0
commit
e2a10de756
4 changed files with 196 additions and 54 deletions
|
|
@ -29,7 +29,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <pulse/xmalloc.h>
|
#include <pulse/xmalloc.h>
|
||||||
|
|
@ -39,6 +38,7 @@
|
||||||
#include <pulsecore/strbuf.h>
|
#include <pulsecore/strbuf.h>
|
||||||
#include <pulsecore/conf-parser.h>
|
#include <pulsecore/conf-parser.h>
|
||||||
#include <pulsecore/resampler.h>
|
#include <pulsecore/resampler.h>
|
||||||
|
#include <pulsecore/macro.h>
|
||||||
|
|
||||||
#include "daemon-conf.h"
|
#include "daemon-conf.h"
|
||||||
|
|
||||||
|
|
@ -77,7 +77,10 @@ static const pa_daemon_conf default_conf = {
|
||||||
.use_pid_file = 1,
|
.use_pid_file = 1,
|
||||||
.system_instance = 0,
|
.system_instance = 0,
|
||||||
.no_cpu_limit = 0,
|
.no_cpu_limit = 0,
|
||||||
.disable_shm = 0
|
.disable_shm = 0,
|
||||||
|
.default_n_fragments = 4,
|
||||||
|
.default_fragment_size_msec = 25,
|
||||||
|
.default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 }
|
||||||
#ifdef HAVE_SYS_RESOURCE_H
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
, .rlimit_as = { .value = 0, .is_set = 0 },
|
, .rlimit_as = { .value = 0, .is_set = 0 },
|
||||||
.rlimit_core = { .value = 0, .is_set = 0 },
|
.rlimit_core = { .value = 0, .is_set = 0 },
|
||||||
|
|
@ -96,7 +99,7 @@ static const pa_daemon_conf default_conf = {
|
||||||
|
|
||||||
pa_daemon_conf* pa_daemon_conf_new(void) {
|
pa_daemon_conf* pa_daemon_conf_new(void) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
pa_daemon_conf *c = pa_xmemdup(&default_conf, sizeof(default_conf));
|
pa_daemon_conf *c = pa_xnewdup(pa_daemon_conf, &default_conf, 1);
|
||||||
|
|
||||||
if ((f = pa_open_config_file(DEFAULT_SCRIPT_FILE, DEFAULT_SCRIPT_FILE_USER, ENV_SCRIPT_FILE, &c->default_script_file, "r")))
|
if ((f = pa_open_config_file(DEFAULT_SCRIPT_FILE, DEFAULT_SCRIPT_FILE_USER, ENV_SCRIPT_FILE, &c->default_script_file, "r")))
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
@ -106,7 +109,7 @@ pa_daemon_conf* pa_daemon_conf_new(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void pa_daemon_conf_free(pa_daemon_conf *c) {
|
void pa_daemon_conf_free(pa_daemon_conf *c) {
|
||||||
assert(c);
|
pa_assert(c);
|
||||||
pa_xfree(c->script_commands);
|
pa_xfree(c->script_commands);
|
||||||
pa_xfree(c->dl_search_path);
|
pa_xfree(c->dl_search_path);
|
||||||
pa_xfree(c->default_script_file);
|
pa_xfree(c->default_script_file);
|
||||||
|
|
@ -115,7 +118,8 @@ void pa_daemon_conf_free(pa_daemon_conf *c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const char *string) {
|
int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const char *string) {
|
||||||
assert(c && string);
|
pa_assert(c);
|
||||||
|
pa_assert(string);
|
||||||
|
|
||||||
if (!strcmp(string, "auto"))
|
if (!strcmp(string, "auto"))
|
||||||
c->auto_log_target = 1;
|
c->auto_log_target = 1;
|
||||||
|
|
@ -133,7 +137,8 @@ int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const char *string) {
|
||||||
|
|
||||||
int pa_daemon_conf_set_log_level(pa_daemon_conf *c, const char *string) {
|
int pa_daemon_conf_set_log_level(pa_daemon_conf *c, const char *string) {
|
||||||
uint32_t u;
|
uint32_t u;
|
||||||
assert(c && string);
|
pa_assert(c);
|
||||||
|
pa_assert(string);
|
||||||
|
|
||||||
if (pa_atou(string, &u) >= 0) {
|
if (pa_atou(string, &u) >= 0) {
|
||||||
if (u >= PA_LOG_LEVEL_MAX)
|
if (u >= PA_LOG_LEVEL_MAX)
|
||||||
|
|
@ -158,7 +163,8 @@ int pa_daemon_conf_set_log_level(pa_daemon_conf *c, const char *string) {
|
||||||
|
|
||||||
int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string) {
|
int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string) {
|
||||||
int m;
|
int m;
|
||||||
assert(c && string);
|
pa_assert(c);
|
||||||
|
pa_assert(string);
|
||||||
|
|
||||||
if ((m = pa_parse_resample_method(string)) < 0)
|
if ((m = pa_parse_resample_method(string)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -169,7 +175,11 @@ int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string) {
|
||||||
|
|
||||||
static int parse_log_target(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
static int parse_log_target(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
pa_daemon_conf *c = data;
|
pa_daemon_conf *c = data;
|
||||||
assert(filename && lvalue && rvalue && data);
|
|
||||||
|
pa_assert(filename);
|
||||||
|
pa_assert(lvalue);
|
||||||
|
pa_assert(rvalue);
|
||||||
|
pa_assert(data);
|
||||||
|
|
||||||
if (pa_daemon_conf_set_log_target(c, rvalue) < 0) {
|
if (pa_daemon_conf_set_log_target(c, rvalue) < 0) {
|
||||||
pa_log("[%s:%u] Invalid log target '%s'.", filename, line, rvalue);
|
pa_log("[%s:%u] Invalid log target '%s'.", filename, line, rvalue);
|
||||||
|
|
@ -181,7 +191,11 @@ static int parse_log_target(const char *filename, unsigned line, const char *lva
|
||||||
|
|
||||||
static int parse_log_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
static int parse_log_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
pa_daemon_conf *c = data;
|
pa_daemon_conf *c = data;
|
||||||
assert(filename && lvalue && rvalue && data);
|
|
||||||
|
pa_assert(filename);
|
||||||
|
pa_assert(lvalue);
|
||||||
|
pa_assert(rvalue);
|
||||||
|
pa_assert(data);
|
||||||
|
|
||||||
if (pa_daemon_conf_set_log_level(c, rvalue) < 0) {
|
if (pa_daemon_conf_set_log_level(c, rvalue) < 0) {
|
||||||
pa_log("[%s:%u] Invalid log level '%s'.", filename, line, rvalue);
|
pa_log("[%s:%u] Invalid log level '%s'.", filename, line, rvalue);
|
||||||
|
|
@ -193,10 +207,14 @@ static int parse_log_level(const char *filename, unsigned line, const char *lval
|
||||||
|
|
||||||
static int parse_resample_method(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
static int parse_resample_method(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
pa_daemon_conf *c = data;
|
pa_daemon_conf *c = data;
|
||||||
assert(filename && lvalue && rvalue && data);
|
|
||||||
|
pa_assert(filename);
|
||||||
|
pa_assert(lvalue);
|
||||||
|
pa_assert(rvalue);
|
||||||
|
pa_assert(data);
|
||||||
|
|
||||||
if (pa_daemon_conf_set_resample_method(c, rvalue) < 0) {
|
if (pa_daemon_conf_set_resample_method(c, rvalue) < 0) {
|
||||||
pa_log("[%s:%u] Inavalid resample method '%s'.", filename, line, rvalue);
|
pa_log("[%s:%u] Invalid resample method '%s'.", filename, line, rvalue);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,10 +224,11 @@ static int parse_resample_method(const char *filename, unsigned line, const char
|
||||||
static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
#ifdef HAVE_SYS_RESOURCE_H
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
struct pa_rlimit *r = data;
|
struct pa_rlimit *r = data;
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
pa_assert(filename);
|
||||||
assert(rvalue);
|
pa_assert(lvalue);
|
||||||
assert(r);
|
pa_assert(rvalue);
|
||||||
|
pa_assert(r);
|
||||||
|
|
||||||
if (rvalue[strspn(rvalue, "\t ")] == 0) {
|
if (rvalue[strspn(rvalue, "\t ")] == 0) {
|
||||||
/* Empty string */
|
/* Empty string */
|
||||||
|
|
@ -218,7 +237,7 @@ static int parse_rlimit(const char *filename, unsigned line, const char *lvalue,
|
||||||
} else {
|
} else {
|
||||||
int32_t k;
|
int32_t k;
|
||||||
if (pa_atoi(rvalue, &k) < 0) {
|
if (pa_atoi(rvalue, &k) < 0) {
|
||||||
pa_log("[%s:%u] Inavalid rlimit '%s'.", filename, line, rvalue);
|
pa_log("[%s:%u] Invalid rlimit '%s'.", filename, line, rvalue);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
r->is_set = k >= 0;
|
r->is_set = k >= 0;
|
||||||
|
|
@ -231,43 +250,138 @@ static int parse_rlimit(const char *filename, unsigned line, const char *lvalue,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int parse_sample_format(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
|
pa_daemon_conf *c = data;
|
||||||
|
pa_sample_format_t f;
|
||||||
|
|
||||||
|
pa_assert(filename);
|
||||||
|
pa_assert(lvalue);
|
||||||
|
pa_assert(rvalue);
|
||||||
|
pa_assert(data);
|
||||||
|
|
||||||
|
if ((f = pa_parse_sample_format(rvalue)) < 0) {
|
||||||
|
pa_log("[%s:%u] Invalid sample format '%s'.", filename, line, rvalue);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->default_sample_spec.format = f;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int parse_sample_rate(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
|
pa_daemon_conf *c = data;
|
||||||
|
int32_t r;
|
||||||
|
|
||||||
|
pa_assert(filename);
|
||||||
|
pa_assert(lvalue);
|
||||||
|
pa_assert(rvalue);
|
||||||
|
pa_assert(data);
|
||||||
|
|
||||||
|
if (pa_atoi(rvalue, &r) < 0 || r > PA_RATE_MAX || r <= 0) {
|
||||||
|
pa_log("[%s:%u] Invalid sample rate '%s'.", filename, line, rvalue);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->default_sample_spec.rate = r;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int parse_sample_channels(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
|
pa_daemon_conf *c = data;
|
||||||
|
int32_t n;
|
||||||
|
|
||||||
|
pa_assert(filename);
|
||||||
|
pa_assert(lvalue);
|
||||||
|
pa_assert(rvalue);
|
||||||
|
pa_assert(data);
|
||||||
|
|
||||||
|
if (pa_atoi(rvalue, &n) < 0 || n > PA_CHANNELS_MAX || n <= 0) {
|
||||||
|
pa_log("[%s:%u] Invalid sample channels '%s'.", filename, line, rvalue);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->default_sample_spec.channels = (uint8_t) n;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int parse_fragments(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
|
pa_daemon_conf *c = data;
|
||||||
|
int32_t n;
|
||||||
|
|
||||||
|
pa_assert(filename);
|
||||||
|
pa_assert(lvalue);
|
||||||
|
pa_assert(rvalue);
|
||||||
|
pa_assert(data);
|
||||||
|
|
||||||
|
if (pa_atoi(rvalue, &n) < 0 || n < 2) {
|
||||||
|
pa_log("[%s:%u] Invalid number of fragments '%s'.", filename, line, rvalue);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->default_n_fragments = (unsigned) n;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int parse_fragment_size_msec(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
|
||||||
|
pa_daemon_conf *c = data;
|
||||||
|
int32_t n;
|
||||||
|
|
||||||
|
pa_assert(filename);
|
||||||
|
pa_assert(lvalue);
|
||||||
|
pa_assert(rvalue);
|
||||||
|
pa_assert(data);
|
||||||
|
|
||||||
|
if (pa_atoi(rvalue, &n) < 0 || n < 1) {
|
||||||
|
pa_log("[%s:%u] Invalid fragment size '%s'.", filename, line, rvalue);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->default_fragment_size_msec = (unsigned) n;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
|
int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
|
||||||
int r = -1;
|
int r = -1;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
|
|
||||||
pa_config_item table[] = {
|
pa_config_item table[] = {
|
||||||
{ "daemonize", pa_config_parse_bool, NULL },
|
{ "daemonize", pa_config_parse_bool, NULL },
|
||||||
{ "fail", pa_config_parse_bool, NULL },
|
{ "fail", pa_config_parse_bool, NULL },
|
||||||
{ "high-priority", pa_config_parse_bool, NULL },
|
{ "high-priority", pa_config_parse_bool, NULL },
|
||||||
{ "disallow-module-loading", pa_config_parse_bool, NULL },
|
{ "disallow-module-loading", pa_config_parse_bool, NULL },
|
||||||
{ "exit-idle-time", pa_config_parse_int, NULL },
|
{ "exit-idle-time", pa_config_parse_int, NULL },
|
||||||
{ "module-idle-time", pa_config_parse_int, NULL },
|
{ "module-idle-time", pa_config_parse_int, NULL },
|
||||||
{ "scache-idle-time", pa_config_parse_int, NULL },
|
{ "scache-idle-time", pa_config_parse_int, NULL },
|
||||||
{ "dl-search-path", pa_config_parse_string, NULL },
|
{ "dl-search-path", pa_config_parse_string, NULL },
|
||||||
{ "default-script-file", pa_config_parse_string, NULL },
|
{ "default-script-file", pa_config_parse_string, NULL },
|
||||||
{ "log-target", parse_log_target, NULL },
|
{ "log-target", parse_log_target, NULL },
|
||||||
{ "log-level", parse_log_level, NULL },
|
{ "log-level", parse_log_level, NULL },
|
||||||
{ "verbose", parse_log_level, NULL },
|
{ "verbose", parse_log_level, NULL },
|
||||||
{ "resample-method", parse_resample_method, NULL },
|
{ "resample-method", parse_resample_method, NULL },
|
||||||
{ "use-pid-file", pa_config_parse_bool, NULL },
|
{ "use-pid-file", pa_config_parse_bool, NULL },
|
||||||
{ "system-instance", pa_config_parse_bool, NULL },
|
{ "system-instance", pa_config_parse_bool, NULL },
|
||||||
{ "no-cpu-limit", pa_config_parse_bool, NULL },
|
{ "no-cpu-limit", pa_config_parse_bool, NULL },
|
||||||
{ "disable-shm", pa_config_parse_bool, NULL },
|
{ "disable-shm", pa_config_parse_bool, NULL },
|
||||||
|
{ "default-sample-format", parse_sample_format, NULL },
|
||||||
|
{ "default-sample-rate", parse_sample_rate, NULL },
|
||||||
|
{ "default-sample-channels", parse_sample_channels, NULL },
|
||||||
|
{ "default-fragments", parse_fragments, NULL },
|
||||||
|
{ "default-fragment-size-msec", parse_fragment_size_msec, NULL },
|
||||||
#ifdef HAVE_SYS_RESOURCE_H
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
{ "rlimit-as", parse_rlimit, NULL },
|
{ "rlimit-as", parse_rlimit, NULL },
|
||||||
{ "rlimit-core", parse_rlimit, NULL },
|
{ "rlimit-core", parse_rlimit, NULL },
|
||||||
{ "rlimit-data", parse_rlimit, NULL },
|
{ "rlimit-data", parse_rlimit, NULL },
|
||||||
{ "rlimit-fsize", parse_rlimit, NULL },
|
{ "rlimit-fsize", parse_rlimit, NULL },
|
||||||
{ "rlimit-nofile", parse_rlimit, NULL },
|
{ "rlimit-nofile", parse_rlimit, NULL },
|
||||||
{ "rlimit-stack", parse_rlimit, NULL },
|
{ "rlimit-stack", parse_rlimit, NULL },
|
||||||
#ifdef RLIMIT_NPROC
|
#ifdef RLIMIT_NPROC
|
||||||
{ "rlimit-nproc", parse_rlimit, NULL },
|
{ "rlimit-nproc", parse_rlimit, NULL },
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_MEMLOCK
|
#ifdef RLIMIT_MEMLOCK
|
||||||
{ "rlimit-memlock", parse_rlimit, NULL },
|
{ "rlimit-memlock", parse_rlimit, NULL },
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
{ NULL, NULL, NULL },
|
{ NULL, NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
table[0].data = &c->daemonize;
|
table[0].data = &c->daemonize;
|
||||||
|
|
@ -287,25 +401,29 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
|
||||||
table[14].data = &c->system_instance;
|
table[14].data = &c->system_instance;
|
||||||
table[15].data = &c->no_cpu_limit;
|
table[15].data = &c->no_cpu_limit;
|
||||||
table[16].data = &c->disable_shm;
|
table[16].data = &c->disable_shm;
|
||||||
|
table[17].data = c;
|
||||||
|
table[18].data = c;
|
||||||
|
table[19].data = c;
|
||||||
|
table[20].data = c;
|
||||||
|
table[21].data = c;
|
||||||
#ifdef HAVE_SYS_RESOURCE_H
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
table[17].data = &c->rlimit_as;
|
table[22].data = &c->rlimit_as;
|
||||||
table[18].data = &c->rlimit_core;
|
table[23].data = &c->rlimit_core;
|
||||||
table[19].data = &c->rlimit_data;
|
table[24].data = &c->rlimit_data;
|
||||||
table[20].data = &c->rlimit_fsize;
|
table[25].data = &c->rlimit_fsize;
|
||||||
table[21].data = &c->rlimit_nofile;
|
table[26].data = &c->rlimit_nofile;
|
||||||
table[22].data = &c->rlimit_stack;
|
table[27].data = &c->rlimit_stack;
|
||||||
#ifdef RLIMIT_NPROC
|
#ifdef RLIMIT_NPROC
|
||||||
table[23].data = &c->rlimit_nproc;
|
table[28].data = &c->rlimit_nproc;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RLIMIT_MEMLOCK
|
#ifdef RLIMIT_MEMLOCK
|
||||||
#ifndef RLIMIT_NPROC
|
#ifndef RLIMIT_NPROC
|
||||||
#error "Houston, we have a numbering problem!"
|
#error "Houston, we have a numbering problem!"
|
||||||
#endif
|
#endif
|
||||||
table[24].data = &c->rlimit_memlock;
|
table[29].data = &c->rlimit_memlock;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
pa_xfree(c->config_file);
|
pa_xfree(c->config_file);
|
||||||
c->config_file = NULL;
|
c->config_file = NULL;
|
||||||
|
|
||||||
|
|
@ -351,12 +469,16 @@ static const char* const log_level_to_string[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
char *pa_daemon_conf_dump(pa_daemon_conf *c) {
|
char *pa_daemon_conf_dump(pa_daemon_conf *c) {
|
||||||
pa_strbuf *s = pa_strbuf_new();
|
pa_strbuf *s;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
|
||||||
|
s = pa_strbuf_new();
|
||||||
|
|
||||||
if (c->config_file)
|
if (c->config_file)
|
||||||
pa_strbuf_printf(s, "### Read from configuration file: %s ###\n", c->config_file);
|
pa_strbuf_printf(s, "### Read from configuration file: %s ###\n", c->config_file);
|
||||||
|
|
||||||
assert(c->log_level <= PA_LOG_LEVEL_MAX);
|
pa_assert(c->log_level <= PA_LOG_LEVEL_MAX);
|
||||||
|
|
||||||
pa_strbuf_printf(s, "daemonize = %i\n", !!c->daemonize);
|
pa_strbuf_printf(s, "daemonize = %i\n", !!c->daemonize);
|
||||||
pa_strbuf_printf(s, "fail = %i\n", !!c->fail);
|
pa_strbuf_printf(s, "fail = %i\n", !!c->fail);
|
||||||
|
|
@ -373,7 +495,12 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
|
||||||
pa_strbuf_printf(s, "use-pid-file = %i\n", c->use_pid_file);
|
pa_strbuf_printf(s, "use-pid-file = %i\n", c->use_pid_file);
|
||||||
pa_strbuf_printf(s, "system-instance = %i\n", !!c->system_instance);
|
pa_strbuf_printf(s, "system-instance = %i\n", !!c->system_instance);
|
||||||
pa_strbuf_printf(s, "no-cpu-limit = %i\n", !!c->no_cpu_limit);
|
pa_strbuf_printf(s, "no-cpu-limit = %i\n", !!c->no_cpu_limit);
|
||||||
pa_strbuf_printf(s, "disable_shm = %i\n", !!c->disable_shm);
|
pa_strbuf_printf(s, "disable-shm = %i\n", !!c->disable_shm);
|
||||||
|
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);
|
||||||
|
pa_strbuf_printf(s, "default-fragments = %u\n", c->default_n_fragments);
|
||||||
|
pa_strbuf_printf(s, "default-fragment-size-msec = %u\n", c->default_fragment_size_msec);
|
||||||
#ifdef HAVE_SYS_RESOURCE_H
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
pa_strbuf_printf(s, "rlimit-as = %li\n", c->rlimit_as.is_set ? (long int) c->rlimit_as.value : -1);
|
pa_strbuf_printf(s, "rlimit-as = %li\n", c->rlimit_as.is_set ? (long int) c->rlimit_as.value : -1);
|
||||||
pa_strbuf_printf(s, "rlimit-core = %li\n", c->rlimit_core.is_set ? (long int) c->rlimit_core.value : -1);
|
pa_strbuf_printf(s, "rlimit-core = %li\n", c->rlimit_core.is_set ? (long int) c->rlimit_core.value : -1);
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#include <pulsecore/log.h>
|
#include <pulsecore/log.h>
|
||||||
|
#include <pulse/sample.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_RESOURCE_H
|
#ifdef HAVE_SYS_RESOURCE_H
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
@ -80,6 +81,8 @@ typedef struct pa_daemon_conf {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
unsigned default_n_fragments, default_fragment_size_msec;
|
||||||
|
pa_sample_spec default_sample_spec;
|
||||||
} pa_daemon_conf;
|
} pa_daemon_conf;
|
||||||
|
|
||||||
/* Allocate a new structure and fill it with sane defaults */
|
/* Allocate a new structure and fill it with sane defaults */
|
||||||
|
|
|
||||||
|
|
@ -99,3 +99,12 @@
|
||||||
|
|
||||||
## Disable shared memory data transfer
|
## Disable shared memory data transfer
|
||||||
; disable-shm = 0
|
; disable-shm = 0
|
||||||
|
|
||||||
|
## Default sample format
|
||||||
|
; default-sample-format = s16le
|
||||||
|
; default-sample-rate = 44100
|
||||||
|
; default-sample-channels = 2
|
||||||
|
|
||||||
|
## Default fragment settings, for device drivers that need this
|
||||||
|
; default-fragments = 4
|
||||||
|
; default-fragment-size-msec = 25
|
||||||
|
|
|
||||||
|
|
@ -573,6 +573,9 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c->is_system_instance = !!conf->system_instance;
|
c->is_system_instance = !!conf->system_instance;
|
||||||
|
c->default_sample_spec = conf->default_sample_spec;
|
||||||
|
c->default_n_fragments = conf->default_n_fragments;
|
||||||
|
c->default_fragment_size_msec = conf->default_fragment_size_msec;
|
||||||
|
|
||||||
r = pa_signal_init(pa_mainloop_get_api(mainloop));
|
r = pa_signal_init(pa_mainloop_get_api(mainloop));
|
||||||
assert(r == 0);
|
assert(r == 0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue