Commit 1a74d7be authored by Max Kellermann's avatar Max Kellermann

alsa: moved code to alsa_configure()

Move code which loads configuration to alsa_configure(). This removes one indent level.
parent 0d3a6ff6
...@@ -66,6 +66,22 @@ static void freeAlsaData(AlsaData * ad) ...@@ -66,6 +66,22 @@ static void freeAlsaData(AlsaData * ad)
free(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, static void *alsa_initDriver(mpd_unused struct audio_output *ao,
mpd_unused const struct audio_format *audio_format, mpd_unused const struct audio_format *audio_format,
ConfigParam * param) ConfigParam * param)
...@@ -79,19 +95,8 @@ static void *alsa_initDriver(mpd_unused struct audio_output *ao, ...@@ -79,19 +95,8 @@ static void *alsa_initDriver(mpd_unused struct audio_output *ao,
free_global_registered = 1; free_global_registered = 1;
} }
if (param) { if (param)
BlockParam *bp; alsa_configure(ad, param);
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);
}
return ad; return ad;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment