]> code.delx.au - pulseaudio/blob - src/daemon/daemon-conf.h
9cec189f82cbd86c285e423b82e5796db645b204
[pulseaudio] / src / daemon / daemon-conf.h
1 #ifndef foodaemonconfhfoo
2 #define foodaemonconfhfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2004-2006 Lennart Poettering
8 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
9
10 PulseAudio is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published
12 by the Free Software Foundation; either version 2.1 of the License,
13 or (at your option) any later version.
14
15 PulseAudio is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with PulseAudio; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 USA.
24 ***/
25
26 #include <pulse/sample.h>
27 #include <pulse/channelmap.h>
28
29 #include <pulsecore/log.h>
30 #include <pulsecore/macro.h>
31 #include <pulsecore/core-util.h>
32
33 #ifdef HAVE_SYS_RESOURCE_H
34 #include <sys/resource.h>
35 #endif
36
37 /* The actual command to execute */
38 typedef enum pa_daemon_conf_cmd {
39 PA_CMD_DAEMON, /* the default */
40 PA_CMD_START,
41 PA_CMD_HELP,
42 PA_CMD_VERSION,
43 PA_CMD_DUMP_CONF,
44 PA_CMD_DUMP_MODULES,
45 PA_CMD_KILL,
46 PA_CMD_CHECK,
47 PA_CMD_DUMP_RESAMPLE_METHODS,
48 PA_CMD_CLEANUP_SHM
49 } pa_daemon_conf_cmd_t;
50
51 #ifdef HAVE_SYS_RESOURCE_H
52 typedef struct pa_rlimit {
53 rlim_t value;
54 pa_bool_t is_set;
55 } pa_rlimit;
56 #endif
57
58 /* A structure containing configuration data for the PulseAudio server . */
59 typedef struct pa_daemon_conf {
60 pa_daemon_conf_cmd_t cmd;
61 pa_bool_t daemonize,
62 fail,
63 high_priority,
64 realtime_scheduling,
65 disallow_module_loading,
66 use_pid_file,
67 system_instance,
68 no_cpu_limit,
69 disable_shm,
70 disable_remixing,
71 disable_lfe_remixing,
72 load_default_script_file,
73 disallow_exit,
74 log_meta,
75 log_time,
76 flat_volumes;
77 int exit_idle_time,
78 scache_idle_time,
79 auto_log_target,
80 realtime_priority,
81 nice_level,
82 resample_method;
83 char *script_commands, *dl_search_path, *default_script_file;
84 pa_log_target_t log_target;
85 pa_log_level_t log_level;
86 unsigned log_backtrace;
87 char *config_file;
88
89 #ifdef HAVE_SYS_RESOURCE_H
90 pa_rlimit rlimit_fsize, rlimit_data, rlimit_stack, rlimit_core;
91 #ifdef RLIMIT_RSS
92 pa_rlimit rlimit_rss;
93 #endif
94 #ifdef RLIMIT_NOFILE
95 pa_rlimit rlimit_nofile;
96 #endif
97 #ifdef RLIMIT_AS
98 pa_rlimit rlimit_as;
99 #endif
100 #ifdef RLIMIT_NPROC
101 pa_rlimit rlimit_nproc;
102 #endif
103 #ifdef RLIMIT_MEMLOCK
104 pa_rlimit rlimit_memlock;
105 #endif
106 #ifdef RLIMIT_LOCKS
107 pa_rlimit rlimit_locks;
108 #endif
109 #ifdef RLIMIT_SIGPENDING
110 pa_rlimit rlimit_sigpending;
111 #endif
112 #ifdef RLIMIT_MSGQUEUE
113 pa_rlimit rlimit_msgqueue;
114 #endif
115 #ifdef RLIMIT_NICE
116 pa_rlimit rlimit_nice;
117 #endif
118 #ifdef RLIMIT_RTPRIO
119 pa_rlimit rlimit_rtprio;
120 #endif
121 #ifdef RLIMIT_RTTIME
122 pa_rlimit rlimit_rttime;
123 #endif
124 #endif
125
126 unsigned default_n_fragments, default_fragment_size_msec;
127 pa_sample_spec default_sample_spec;
128 pa_channel_map default_channel_map;
129 size_t shm_size;
130 } pa_daemon_conf;
131
132 /* Allocate a new structure and fill it with sane defaults */
133 pa_daemon_conf* pa_daemon_conf_new(void);
134 void pa_daemon_conf_free(pa_daemon_conf*c);
135
136 /* Load configuration data from the specified file overwriting the
137 * current settings in *c. If filename is NULL load the default daemon
138 * configuration file */
139 int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename);
140
141 /* Pretty print the current configuration data of the daemon. The
142 * returned string has to be freed manually. The output of this
143 * function may be parsed with pa_daemon_conf_load(). */
144 char *pa_daemon_conf_dump(pa_daemon_conf *c);
145
146 /* Load the configuration data from the process' environment
147 * overwriting the current settings in *c. */
148 int pa_daemon_conf_env(pa_daemon_conf *c);
149
150 /* Set these configuration variables in the structure by passing a string */
151 int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const char *string);
152 int pa_daemon_conf_set_log_level(pa_daemon_conf *c, const char *string);
153 int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string);
154
155 const char *pa_daemon_conf_get_default_script_file(pa_daemon_conf *c);
156 FILE *pa_daemon_conf_open_default_script_file(pa_daemon_conf *c);
157
158 #endif