2004-02-24 00:41:20 +01:00
|
|
|
/* the Music Player Daemon (MPD)
|
2007-04-05 05:22:33 +02:00
|
|
|
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
|
2004-02-24 00:41:20 +01:00
|
|
|
* This project's homepage is: http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2008-10-31 09:19:53 +01:00
|
|
|
#ifndef MPD_CONF_H
|
|
|
|
#define MPD_CONF_H
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-11-27 19:19:34 +01:00
|
|
|
#include <stdbool.h>
|
2009-01-10 21:33:38 +01:00
|
|
|
#include <glib.h>
|
2008-11-27 19:19:34 +01:00
|
|
|
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_MUSIC_DIR "music_directory"
|
|
|
|
#define CONF_PLAYLIST_DIR "playlist_directory"
|
2008-11-28 10:57:39 +01:00
|
|
|
#define CONF_FOLLOW_INSIDE_SYMLINKS "follow_inside_symlinks"
|
|
|
|
#define CONF_FOLLOW_OUTSIDE_SYMLINKS "follow_outside_symlinks"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_DB_FILE "db_file"
|
2009-01-19 18:51:57 +01:00
|
|
|
#define CONF_STICKER_FILE "sticker_file"
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_LOG_FILE "log_file"
|
|
|
|
#define CONF_ERROR_FILE "error_file"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_PID_FILE "pid_file"
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_STATE_FILE "state_file"
|
|
|
|
#define CONF_USER "user"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_BIND_TO_ADDRESS "bind_to_address"
|
|
|
|
#define CONF_PORT "port"
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_LOG_LEVEL "log_level"
|
2007-01-11 21:41:17 +01:00
|
|
|
#define CONF_ZEROCONF_NAME "zeroconf_name"
|
2007-06-03 20:08:51 +02:00
|
|
|
#define CONF_ZEROCONF_ENABLED "zeroconf_enabled"
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_PASSWORD "password"
|
|
|
|
#define CONF_DEFAULT_PERMS "default_permissions"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_AUDIO_OUTPUT "audio_output"
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_AUDIO_OUTPUT_FORMAT "audio_output_format"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_MIXER_TYPE "mixer_type"
|
|
|
|
#define CONF_MIXER_DEVICE "mixer_device"
|
|
|
|
#define CONF_MIXER_CONTROL "mixer_control"
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_REPLAYGAIN "replaygain"
|
|
|
|
#define CONF_REPLAYGAIN_PREAMP "replaygain_preamp"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_VOLUME_NORMALIZATION "volume_normalization"
|
2007-02-02 04:51:07 +01:00
|
|
|
#define CONF_SAMPLERATE_CONVERTER "samplerate_converter"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_AUDIO_BUFFER_SIZE "audio_buffer_size"
|
|
|
|
#define CONF_BUFFER_BEFORE_PLAY "buffer_before_play"
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_HTTP_PROXY_HOST "http_proxy_host"
|
|
|
|
#define CONF_HTTP_PROXY_PORT "http_proxy_port"
|
|
|
|
#define CONF_HTTP_PROXY_USER "http_proxy_user"
|
|
|
|
#define CONF_HTTP_PROXY_PASSWORD "http_proxy_password"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_CONN_TIMEOUT "connection_timeout"
|
|
|
|
#define CONF_MAX_CONN "max_connections"
|
|
|
|
#define CONF_MAX_PLAYLIST_LENGTH "max_playlist_length"
|
|
|
|
#define CONF_MAX_COMMAND_LIST_SIZE "max_command_list_size"
|
|
|
|
#define CONF_MAX_OUTPUT_BUFFER_SIZE "max_output_buffer_size"
|
|
|
|
#define CONF_FS_CHARSET "filesystem_charset"
|
2006-07-27 21:10:08 +02:00
|
|
|
#define CONF_ID3V1_ENCODING "id3v1_encoding"
|
2006-08-28 22:47:50 +02:00
|
|
|
#define CONF_METADATA_TO_USE "metadata_to_use"
|
|
|
|
#define CONF_SAVE_ABSOLUTE_PATHS "save_absolute_paths_in_playlists"
|
2006-12-23 19:00:15 +01:00
|
|
|
#define CONF_GAPLESS_MP3_PLAYBACK "gapless_mp3_playback"
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2007-09-06 01:59:33 +02:00
|
|
|
#define CONF_BOOL_UNSET -1
|
|
|
|
#define CONF_BOOL_INVALID -2
|
|
|
|
|
2009-01-25 13:53:16 +01:00
|
|
|
#define DEFAULT_PLAYLIST_MAX_LENGTH (1024*16)
|
|
|
|
#define DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS false
|
|
|
|
|
2009-01-17 20:23:27 +01:00
|
|
|
struct block_param {
|
2006-07-20 18:02:40 +02:00
|
|
|
char *name;
|
|
|
|
char *value;
|
2004-10-28 07:14:55 +02:00
|
|
|
int line;
|
2009-01-17 20:23:27 +01:00
|
|
|
};
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2009-01-17 20:23:27 +01:00
|
|
|
struct config_param {
|
2006-07-20 18:02:40 +02:00
|
|
|
char *value;
|
2004-10-28 07:14:55 +02:00
|
|
|
unsigned int line;
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2009-01-17 20:23:27 +01:00
|
|
|
struct block_param *block_params;
|
|
|
|
int num_block_params;
|
|
|
|
};
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2009-01-17 20:23:27 +01:00
|
|
|
void config_global_init(void);
|
|
|
|
void config_global_finish(void);
|
|
|
|
|
|
|
|
void config_read_file(const char *file);
|
2004-10-28 07:14:55 +02:00
|
|
|
|
2009-01-25 17:37:45 +01:00
|
|
|
/**
|
|
|
|
* Adds a new configuration parameter. The name must be registered
|
|
|
|
* with registerConfigParam().
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
config_add_param(const char *name, struct config_param *param);
|
|
|
|
|
2004-10-28 07:14:55 +02:00
|
|
|
/* don't free the returned value
|
|
|
|
set _last_ to NULL to get first entry */
|
2009-01-17 20:23:27 +01:00
|
|
|
struct config_param *
|
2009-01-25 16:03:49 +01:00
|
|
|
config_get_next_param(const char *name, const struct config_param *last);
|
2004-10-28 07:14:55 +02:00
|
|
|
|
2009-01-17 20:23:27 +01:00
|
|
|
static inline struct config_param *
|
|
|
|
config_get_param(const char *name)
|
|
|
|
{
|
|
|
|
return config_get_next_param(name, NULL);
|
|
|
|
}
|
2004-10-28 07:14:55 +02:00
|
|
|
|
2009-01-17 20:23:58 +01:00
|
|
|
const char *
|
|
|
|
config_get_string(const char *name, const char *default_value);
|
2004-10-28 07:14:55 +02:00
|
|
|
|
2009-01-18 17:54:46 +01:00
|
|
|
/**
|
|
|
|
* Returns an optional configuration variable which contains an
|
|
|
|
* absolute path. If there is a tilde prefix, it is expanded. Aborts
|
|
|
|
* MPD if the path is not a valid absolute path.
|
|
|
|
*/
|
|
|
|
const char *
|
|
|
|
config_get_path(const char *name);
|
|
|
|
|
2009-01-21 08:46:59 +01:00
|
|
|
unsigned
|
|
|
|
config_get_positive(const char *name, unsigned default_value);
|
|
|
|
|
2009-01-17 20:23:27 +01:00
|
|
|
struct block_param *
|
2009-01-25 16:03:49 +01:00
|
|
|
getBlockParam(const struct config_param *param, const char *name);
|
2004-10-28 07:14:55 +02:00
|
|
|
|
2008-11-27 19:19:34 +01:00
|
|
|
bool config_get_bool(const char *name, bool default_value);
|
|
|
|
|
2009-01-18 19:37:27 +01:00
|
|
|
const char *
|
2009-01-25 16:03:49 +01:00
|
|
|
config_get_block_string(const struct config_param *param, const char *name,
|
2009-01-18 19:37:27 +01:00
|
|
|
const char *default_value);
|
|
|
|
|
|
|
|
static inline char *
|
2009-01-25 16:03:49 +01:00
|
|
|
config_dup_block_string(const struct config_param *param, const char *name,
|
2009-01-18 19:37:27 +01:00
|
|
|
const char *default_value)
|
|
|
|
{
|
|
|
|
return g_strdup(config_get_block_string(param, name, default_value));
|
|
|
|
}
|
|
|
|
|
2009-01-18 19:45:51 +01:00
|
|
|
unsigned
|
2009-01-25 16:03:49 +01:00
|
|
|
config_get_block_unsigned(const struct config_param *param, const char *name,
|
2009-01-18 19:45:51 +01:00
|
|
|
unsigned default_value);
|
|
|
|
|
2009-01-17 20:23:56 +01:00
|
|
|
bool
|
2009-01-25 16:03:49 +01:00
|
|
|
config_get_block_bool(const struct config_param *param, const char *name,
|
2009-01-17 20:23:56 +01:00
|
|
|
bool default_value);
|
2007-09-06 01:59:33 +02:00
|
|
|
|
2009-01-17 20:23:27 +01:00
|
|
|
struct config_param *
|
|
|
|
newConfigParam(const char *value, int line);
|
2008-12-31 15:10:53 +01:00
|
|
|
|
2009-01-10 21:33:38 +01:00
|
|
|
void config_param_free(gpointer data, gpointer user_data);
|
|
|
|
|
2009-01-17 20:23:27 +01:00
|
|
|
void
|
|
|
|
addBlockParam(struct config_param *param, const char *name, const char *value, int line);
|
2008-12-31 15:10:53 +01:00
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
#endif
|