aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2007-06-03 19:25:25 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2007-06-03 19:25:25 +0000
commita6fecd6c05b07bd5238bbace2098105e9e1e8c66 (patch)
treeb85e269da129c9d4554e85ef190ddc1e121279a6 /src
parentd67737bc6499545e2a372b732a578ebc28128cc2 (diff)
downloadmpd-a6fecd6c05b07bd5238bbace2098105e9e1e8c66.tar.gz
mpd-a6fecd6c05b07bd5238bbace2098105e9e1e8c66.tar.xz
mpd-a6fecd6c05b07bd5238bbace2098105e9e1e8c66.zip
Making some bool options more consistent.
git-svn-id: https://svn.musicpd.org/mpd/trunk@6468 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/inputPlugins/mp3_plugin.c12
-rw-r--r--src/normalize.c8
-rw-r--r--src/playlist.c6
-rw-r--r--src/zeroconf.c17
4 files changed, 29 insertions, 14 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c
index a920b98a1..3c958705a 100644
--- a/src/inputPlugins/mp3_plugin.c
+++ b/src/inputPlugins/mp3_plugin.c
@@ -58,7 +58,7 @@
#define DEFAULT_GAPLESS_MP3_PLAYBACK 1
-static int gaplessPlayback;
+static int gaplessPlaybackEnabled;
/* this is stolen from mpg321! */
struct audio_dither {
@@ -120,9 +120,11 @@ static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample,
static int mp3_plugin_init(void)
{
- gaplessPlayback = getBoolConfigParam(CONF_GAPLESS_MP3_PLAYBACK);
- if (gaplessPlayback == -1) gaplessPlayback = DEFAULT_GAPLESS_MP3_PLAYBACK;
- else if (gaplessPlayback < 0) exit(EXIT_FAILURE);
+ gaplessPlaybackEnabled = getBoolConfigParam(CONF_GAPLESS_MP3_PLAYBACK);
+ if (gaplessPlaybackEnabled == -1)
+ gaplessPlaybackEnabled = DEFAULT_GAPLESS_MP3_PLAYBACK;
+ else if (gaplessPlaybackEnabled < 0)
+ exit(EXIT_FAILURE);
return 1;
}
@@ -692,7 +694,7 @@ static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc,
data->foundXing = 1;
data->muteFrame = MUTEFRAME_SKIP;
- if (gaplessPlayback && data->inStream->seekable &&
+ if (gaplessPlaybackEnabled && data->inStream->seekable &&
parse_lame(&lame, &ptr, &bitlen)) {
data->dropSamplesAtStart = lame.encoderDelay + DECODERDELAY;
data->dropSamplesAtEnd = lame.encoderPadding;
diff --git a/src/normalize.c b/src/normalize.c
index fb62e7a4e..504656c1d 100644
--- a/src/normalize.c
+++ b/src/normalize.c
@@ -22,13 +22,17 @@
#include <stdlib.h>
+#define DEFAULT_VOLUME_NORMALIZATION 0
+
int normalizationEnabled;
void initNormalization(void)
{
normalizationEnabled = getBoolConfigParam(CONF_VOLUME_NORMALIZATION);
- if (normalizationEnabled == -1) normalizationEnabled = 0;
- else if (normalizationEnabled < 0) exit(EXIT_FAILURE);
+ if (normalizationEnabled == -1)
+ normalizationEnabled = DEFAULT_VOLUME_NORMALIZATION;
+ else if (normalizationEnabled < 0)
+ exit(EXIT_FAILURE);
if (normalizationEnabled)
CompressCfg(0, ANTICLIP, TARGET, GAINMAX, GAINSMOOTH, BUCKETS);
diff --git a/src/playlist.c b/src/playlist.c
index d68033e1b..f6ae8ab51 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -141,8 +141,10 @@ void initPlaylist(void)
}
playlist_saveAbsolutePaths = getBoolConfigParam(CONF_SAVE_ABSOLUTE_PATHS);
- if (playlist_saveAbsolutePaths == -1) playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
- else if (playlist_saveAbsolutePaths < 0) exit(EXIT_FAILURE);
+ if (playlist_saveAbsolutePaths == -1)
+ playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
+ else if (playlist_saveAbsolutePaths < 0)
+ exit(EXIT_FAILURE);
playlist.songs = xmalloc(sizeof(Song *) * playlist_max_length);
playlist.songMod = xmalloc(sizeof(mpd_uint32) * playlist_max_length);
diff --git a/src/zeroconf.c b/src/zeroconf.c
index 6dca7e10b..cb2f8abc6 100644
--- a/src/zeroconf.c
+++ b/src/zeroconf.c
@@ -36,6 +36,10 @@
*/
#define SERVICE_NAME "Music Player"
+#define DEFAULT_ZEROCONF_ENABLED 1
+
+static zeroconfEnabled;
+
static struct ioOps zeroConfIo = {
};
@@ -549,9 +553,14 @@ void initZeroconf(void)
{
const char* serviceName = SERVICE_NAME;
ConfigParam *param;
- int enabled = getBoolConfigParam(CONF_ZEROCONF_ENABLED);
- if (enabled != -1 && enabled != 1)
+ zeroconfEnabled = getBoolConfigParam(CONF_ZEROCONF_ENABLED);
+ if (enabled == -1)
+ zeroconfEnabled = DEFAULT_ZEROCONF_ENABLED;
+ else if (enabled < 0)
+ exit(EXIT_FAILURE);
+
+ if (!zeroconfEnabled)
return;
param = getConfigParam(CONF_ZEROCONF_NAME);
@@ -570,9 +579,7 @@ void initZeroconf(void)
void finishZeroconf(void)
{
- int enabled = getBoolConfigParam(CONF_ZEROCONF_ENABLED);
-
- if (enabled != -1 && enabled != 1)
+ if (!zeroconfEnabled)
return;
#ifdef HAVE_AVAHI