]> code.delx.au - pulseaudio/blob - src/daemon/daemon-conf.h
module-dbus-protocol: Allow anyone to connect the daemon in system mode.
[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.h>
32 #include <pulsecore/core-util.h>
33
34 #ifdef HAVE_SYS_RESOURCE_H
35 #include <sys/resource.h>
36 #endif
37
38 /* The actual command to execute */
39 typedef enum pa_daemon_conf_cmd {
40 PA_CMD_DAEMON, /* the default */
41 PA_CMD_START,
42 PA_CMD_HELP,
43 PA_CMD_VERSION,
44 PA_CMD_DUMP_CONF,
45 PA_CMD_DUMP_MODULES,
46 PA_CMD_KILL,
47 PA_CMD_CHECK,
48 PA_CMD_DUMP_RESAMPLE_METHODS,
49 PA_CMD_CLEANUP_SHM
50 } pa_daemon_conf_cmd_t;
51
52 #ifdef HAVE_SYS_RESOURCE_H
53 typedef struct pa_rlimit {
54 rlim_t value;
55 pa_bool_t is_set;
56 } pa_rlimit;
57 #endif
58
59 /* A structure containing configuration data for the PulseAudio server . */
60 typedef struct pa_daemon_conf {
61 pa_daemon_conf_cmd_t cmd;
62 pa_bool_t daemonize,
63 fail,
64 high_priority,
65 realtime_scheduling,
66 disallow_module_loading,
67 use_pid_file,
68 system_instance,
69 no_cpu_limit,
70 disable_shm,
71 disable_remixing,
72 disable_lfe_remixing,
73 load_default_script_file,
74 disallow_exit,
75 log_meta,
76 log_time,
77 flat_volumes;
78 pa_server_type_t local_server_type;
79 int exit_idle_time,
80 scache_idle_time,
81 auto_log_target,
82 realtime_priority,
83 nice_level,
84 resample_method;
85 char *script_commands, *dl_search_path, *default_script_file;
86 pa_log_target_t log_target;
87 pa_log_level_t log_level;
88 unsigned log_backtrace;
89 char *config_file;
90
91 #ifdef HAVE_SYS_RESOURCE_H
92 pa_rlimit rlimit_fsize, rlimit_data, rlimit_stack, rlimit_core;
93 #ifdef RLIMIT_RSS
94 pa_rlimit rlimit_rss;
95 #endif
96 #ifdef RLIMIT_NOFILE
97 pa_rlimit rlimit_nofile;
98 #endif
99 #ifdef RLIMIT_AS
100 pa_rlimit rlimit_as;
101 #endif
102 #ifdef RLIMIT_NPROC
103 pa_rlimit rlimit_nproc;
104 #endif
105 #ifdef RLIMIT_MEMLOCK
106 pa_rlimit rlimit_memlock;
107 #endif
108 #ifdef RLIMIT_LOCKS
109 pa_rlimit rlimit_locks;
110 #endif
111 #ifdef RLIMIT_SIGPENDING
112 pa_rlimit rlimit_sigpending;
113 #endif
114 #ifdef RLIMIT_MSGQUEUE
115 pa_rlimit rlimit_msgqueue;
116 #endif
117 #ifdef RLIMIT_NICE
118 pa_rlimit rlimit_nice;
119 #endif
120 #ifdef RLIMIT_RTPRIO
121 pa_rlimit rlimit_rtprio;
122 #endif
123 #ifdef RLIMIT_RTTIME
124 pa_rlimit rlimit_rttime;
125 #endif
126 #endif
127
128 unsigned default_n_fragments, default_fragment_size_msec;
129 pa_sample_spec default_sample_spec;
130 pa_channel_map default_channel_map;
131 size_t shm_size;
132 } pa_daemon_conf;
133
134 /* Allocate a new structure and fill it with sane defaults */
135 pa_daemon_conf* pa_daemon_conf_new(void);
136 void pa_daemon_conf_free(pa_daemon_conf*c);
137
138 /* Load configuration data from the specified file overwriting the
139 * current settings in *c. If filename is NULL load the default daemon
140 * configuration file */
141 int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename);
142
143 /* Pretty print the current configuration data of the daemon. The
144 * returned string has to be freed manually. The output of this
145 * function may be parsed with pa_daemon_conf_load(). */
146 char *pa_daemon_conf_dump(pa_daemon_conf *c);
147
148 /* Load the configuration data from the process' environment
149 * overwriting the current settings in *c. */
150 int pa_daemon_conf_env(pa_daemon_conf *c);
151
152 /* Set these configuration variables in the structure by passing a string */
153 int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const char *string);
154 int pa_daemon_conf_set_log_level(pa_daemon_conf *c, const char *string);
155 int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string);
156 int pa_daemon_conf_set_local_server_type(pa_daemon_conf *c, const char *string);
157
158 const char *pa_daemon_conf_get_default_script_file(pa_daemon_conf *c);
159 FILE *pa_daemon_conf_open_default_script_file(pa_daemon_conf *c);
160
161 #endif