00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MPD_CONF_H
00021 #define MPD_CONF_H
00022
00023 #include <stdbool.h>
00024 #include <glib.h>
00025
00026 #define CONF_MUSIC_DIR "music_directory"
00027 #define CONF_PLAYLIST_DIR "playlist_directory"
00028 #define CONF_FOLLOW_INSIDE_SYMLINKS "follow_inside_symlinks"
00029 #define CONF_FOLLOW_OUTSIDE_SYMLINKS "follow_outside_symlinks"
00030 #define CONF_DB_FILE "db_file"
00031 #define CONF_STICKER_FILE "sticker_file"
00032 #define CONF_LOG_FILE "log_file"
00033 #define CONF_PID_FILE "pid_file"
00034 #define CONF_STATE_FILE "state_file"
00035 #define CONF_USER "user"
00036 #define CONF_GROUP "group"
00037 #define CONF_BIND_TO_ADDRESS "bind_to_address"
00038 #define CONF_PORT "port"
00039 #define CONF_LOG_LEVEL "log_level"
00040 #define CONF_ZEROCONF_NAME "zeroconf_name"
00041 #define CONF_ZEROCONF_ENABLED "zeroconf_enabled"
00042 #define CONF_PASSWORD "password"
00043 #define CONF_DEFAULT_PERMS "default_permissions"
00044 #define CONF_AUDIO_OUTPUT "audio_output"
00045 #define CONF_AUDIO_FILTER "filter"
00046 #define CONF_AUDIO_OUTPUT_FORMAT "audio_output_format"
00047 #define CONF_MIXER_TYPE "mixer_type"
00048 #define CONF_REPLAYGAIN "replaygain"
00049 #define CONF_REPLAYGAIN_PREAMP "replaygain_preamp"
00050 #define CONF_REPLAYGAIN_MISSING_PREAMP "replaygain_missing_preamp"
00051 #define CONF_REPLAYGAIN_LIMIT "replaygain_limit"
00052 #define CONF_VOLUME_NORMALIZATION "volume_normalization"
00053 #define CONF_SAMPLERATE_CONVERTER "samplerate_converter"
00054 #define CONF_AUDIO_BUFFER_SIZE "audio_buffer_size"
00055 #define CONF_BUFFER_BEFORE_PLAY "buffer_before_play"
00056 #define CONF_HTTP_PROXY_HOST "http_proxy_host"
00057 #define CONF_HTTP_PROXY_PORT "http_proxy_port"
00058 #define CONF_HTTP_PROXY_USER "http_proxy_user"
00059 #define CONF_HTTP_PROXY_PASSWORD "http_proxy_password"
00060 #define CONF_CONN_TIMEOUT "connection_timeout"
00061 #define CONF_MAX_CONN "max_connections"
00062 #define CONF_MAX_PLAYLIST_LENGTH "max_playlist_length"
00063 #define CONF_MAX_COMMAND_LIST_SIZE "max_command_list_size"
00064 #define CONF_MAX_OUTPUT_BUFFER_SIZE "max_output_buffer_size"
00065 #define CONF_FS_CHARSET "filesystem_charset"
00066 #define CONF_ID3V1_ENCODING "id3v1_encoding"
00067 #define CONF_METADATA_TO_USE "metadata_to_use"
00068 #define CONF_SAVE_ABSOLUTE_PATHS "save_absolute_paths_in_playlists"
00069 #define CONF_DECODER "decoder"
00070 #define CONF_INPUT "input"
00071 #define CONF_GAPLESS_MP3_PLAYBACK "gapless_mp3_playback"
00072 #define CONF_PLAYLIST_PLUGIN "playlist_plugin"
00073 #define CONF_AUTO_UPDATE "auto_update"
00074 #define CONF_AUTO_UPDATE_DEPTH "auto_update_depth"
00075 #define CONF_DESPOTIFY_USER "despotify_user"
00076 #define CONF_DESPOTIFY_PASSWORD "despotify_password"
00077 #define CONF_DESPOTIFY_HIGH_BITRATE "despotify_high_bitrate"
00078
00079 #define DEFAULT_PLAYLIST_MAX_LENGTH (1024*16)
00080 #define DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS false
00081
00082 #define MAX_FILTER_CHAIN_LENGTH 255
00083
00084 struct block_param {
00085 char *name;
00086 char *value;
00087 int line;
00088
00093 bool used;
00094 };
00095
00096 struct config_param {
00097 char *value;
00098 unsigned int line;
00099
00100 struct block_param *block_params;
00101 unsigned num_block_params;
00102
00107 bool used;
00108 };
00109
00114 G_GNUC_CONST
00115 static inline GQuark
00116 config_quark(void)
00117 {
00118 return g_quark_from_static_string("config");
00119 }
00120
00121 void config_global_init(void);
00122 void config_global_finish(void);
00123
00128 void config_global_check(void);
00129
00130 bool
00131 config_read_file(const char *file, GError **error_r);
00132
00133
00134
00135 G_GNUC_PURE
00136 const struct config_param *
00137 config_get_next_param(const char *name, const struct config_param *last);
00138
00139 G_GNUC_PURE
00140 static inline const struct config_param *
00141 config_get_param(const char *name)
00142 {
00143 return config_get_next_param(name, NULL);
00144 }
00145
00146
00147
00148
00149
00150
00151
00152
00153 G_GNUC_PURE
00154 const char *
00155 config_get_string(const char *name, const char *default_value);
00156
00165 G_GNUC_MALLOC
00166 char *
00167 config_dup_path(const char *name, GError **error_r);
00168
00169 G_GNUC_PURE
00170 unsigned
00171 config_get_unsigned(const char *name, unsigned default_value);
00172
00173 G_GNUC_PURE
00174 unsigned
00175 config_get_positive(const char *name, unsigned default_value);
00176
00177 G_GNUC_PURE
00178 const struct block_param *
00179 config_get_block_param(const struct config_param *param, const char *name);
00180
00181 G_GNUC_PURE
00182 bool config_get_bool(const char *name, bool default_value);
00183
00184 G_GNUC_PURE
00185 const char *
00186 config_get_block_string(const struct config_param *param, const char *name,
00187 const char *default_value);
00188
00189 G_GNUC_MALLOC
00190 static inline char *
00191 config_dup_block_string(const struct config_param *param, const char *name,
00192 const char *default_value)
00193 {
00194 return g_strdup(config_get_block_string(param, name, default_value));
00195 }
00196
00201 G_GNUC_MALLOC
00202 char *
00203 config_dup_block_path(const struct config_param *param, const char *name,
00204 GError **error_r);
00205
00206 G_GNUC_PURE
00207 unsigned
00208 config_get_block_unsigned(const struct config_param *param, const char *name,
00209 unsigned default_value);
00210
00211 G_GNUC_PURE
00212 bool
00213 config_get_block_bool(const struct config_param *param, const char *name,
00214 bool default_value);
00215
00216 G_GNUC_MALLOC
00217 struct config_param *
00218 config_new_param(const char *value, int line);
00219
00220 void
00221 config_param_free(struct config_param *param);
00222
00223 void
00224 config_add_block_param(struct config_param * param, const char *name,
00225 const char *value, int line);
00226
00227 #endif