aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs/audioOutput_alsa.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-12 11:47:33 +0200
committerMax Kellermann <max@duempel.org>2008-10-12 11:47:33 +0200
commit1a74d7be4143c8afb51cd2c2a338ac165866d047 (patch)
tree65f4dbb68dc758eb2b31cf8941f76872e8691cea /src/audioOutputs/audioOutput_alsa.c
parent0d3a6ff669049c05d81ff38ce13416cdb047808e (diff)
downloadmpd-1a74d7be4143c8afb51cd2c2a338ac165866d047.tar.gz
mpd-1a74d7be4143c8afb51cd2c2a338ac165866d047.tar.xz
mpd-1a74d7be4143c8afb51cd2c2a338ac165866d047.zip
alsa: moved code to alsa_configure()
Move code which loads configuration to alsa_configure(). This removes one indent level.
Diffstat (limited to 'src/audioOutputs/audioOutput_alsa.c')
-rw-r--r--src/audioOutputs/audioOutput_alsa.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index 8e3cbb9d6..ab6e888b2 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -66,6 +66,22 @@ static void freeAlsaData(AlsaData * ad)
free(ad);
}
+static void
+alsa_configure(AlsaData *ad, ConfigParam *param)
+{
+ BlockParam *bp;
+
+ if ((bp = getBlockParam(param, "device")))
+ ad->device = xstrdup(bp->value);
+ ad->useMmap = getBoolBlockParam(param, "use_mmap", 1);
+ if (ad->useMmap == CONF_BOOL_UNSET)
+ ad->useMmap = 0;
+ if ((bp = getBlockParam(param, "buffer_time")))
+ ad->buffer_time = atoi(bp->value);
+ if ((bp = getBlockParam(param, "period_time")))
+ ad->period_time = atoi(bp->value);
+}
+
static void *alsa_initDriver(mpd_unused struct audio_output *ao,
mpd_unused const struct audio_format *audio_format,
ConfigParam * param)
@@ -79,19 +95,8 @@ static void *alsa_initDriver(mpd_unused struct audio_output *ao,
free_global_registered = 1;
}
- if (param) {
- BlockParam *bp;
-
- if ((bp = getBlockParam(param, "device")))
- ad->device = xstrdup(bp->value);
- ad->useMmap = getBoolBlockParam(param, "use_mmap", 1);
- if (ad->useMmap == CONF_BOOL_UNSET)
- ad->useMmap = 0;
- if ((bp = getBlockParam(param, "buffer_time")))
- ad->buffer_time = atoi(bp->value);
- if ((bp = getBlockParam(param, "period_time")))
- ad->period_time = atoi(bp->value);
- }
+ if (param)
+ alsa_configure(ad, param);
return ad;
}