aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-25 16:04:03 +0100
committerMax Kellermann <max@duempel.org>2009-01-25 16:04:03 +0100
commit3635c93acbc3da87880e886d924020c427d1774a (patch)
tree4143b680e78794866744b3ac1d0a721d738872c2 /src/output
parent5f7791009790dc40f2d76be310ffeab55c242ced (diff)
downloadmpd-3635c93acbc3da87880e886d924020c427d1774a.tar.gz
mpd-3635c93acbc3da87880e886d924020c427d1774a.tar.xz
mpd-3635c93acbc3da87880e886d924020c427d1774a.zip
conf: allow param==NULL
Return the default value in the conf_get_block_*() functions when param==NULL was passed. This simplifies a lot of code, because all initialization can be done in one code path, regardless whether configuration is present.
Diffstat (limited to '')
-rw-r--r--src/output/alsa_plugin.c7
-rw-r--r--src/output/jack_plugin.c14
-rw-r--r--src/output/oss_plugin.c16
3 files changed, 10 insertions, 27 deletions
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c
index 536d399d1..23a9089cd 100644
--- a/src/output/alsa_plugin.c
+++ b/src/output/alsa_plugin.c
@@ -85,13 +85,9 @@ alsa_data_new(void)
{
struct alsa_data *ret = g_new(struct alsa_data, 1);
- ret->device = NULL;
ret->mode = 0;
ret->pcm = NULL;
ret->writei = snd_pcm_writei;
- ret->use_mmap = false;
- ret->buffer_time = MPD_ALSA_BUFFER_TIME_US;
- ret->period_time = MPD_ALSA_PERIOD_TIME_US;
//use alsa mixer by default
mixer_init(&ret->mixer, &alsa_mixer);
@@ -149,8 +145,9 @@ alsa_init(G_GNUC_UNUSED struct audio_output *ao,
free_global_registered = 1;
}
+ alsa_configure(ad, param);
+
if (param) {
- alsa_configure(ad, param);
mixer_configure(&ad->mixer, param);
}
diff --git a/src/output/jack_plugin.c b/src/output/jack_plugin.c
index 8d09dd1d9..8e4be218d 100644
--- a/src/output/jack_plugin.c
+++ b/src/output/jack_plugin.c
@@ -60,16 +60,6 @@ mpd_jack_name(const struct jack_data *jd)
return audio_output_get_name(jd->ao);
}
-static struct jack_data *
-mpd_jack_new(void)
-{
- struct jack_data *ret = g_new(struct jack_data, 1);
-
- ret->ringbuffer_size = 32768;
-
- return ret;
-}
-
static void
mpd_jack_client_free(struct jack_data *jd)
{
@@ -188,12 +178,10 @@ mpd_jack_init(struct audio_output *ao,
struct jack_data *jd;
const char *value;
- jd = mpd_jack_new();
+ jd = g_new(struct jack_data, 1);
jd->ao = ao;
g_debug("mpd_jack_init (pid=%d)", getpid());
- if (param == NULL)
- return jd;
value = config_get_block_string(param, "ports", NULL);
if (value != NULL) {
diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c
index b27aa1b77..b80024b29 100644
--- a/src/output/oss_plugin.c
+++ b/src/output/oss_plugin.c
@@ -392,16 +392,14 @@ oss_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput,
G_GNUC_UNUSED const struct audio_format *audio_format,
const struct config_param *param)
{
- if (param) {
- const char *device =
- config_get_block_string(param, "device", NULL);
- if (device != NULL) {
- OssData *od = newOssData();
- od->device = device;
- mixer_configure(&od->mixer, param);
- return od;
- }
+ const char *device = config_get_block_string(param, "device", NULL);
+ if (device != NULL) {
+ OssData *od = newOssData();
+ od->device = device;
+ mixer_configure(&od->mixer, param);
+ return od;
}
+
return oss_open_default(param);
}