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