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,20 +66,9 @@ static void freeAlsaData(AlsaData * ad)
free(ad);
}
static void *alsa_initDriver(mpd_unused struct audio_output *ao,
mpd_unused const struct audio_format *audio_format,
ConfigParam * param)
static void
alsa_configure(AlsaData *ad, ConfigParam *param)
{
/* no need for pthread_once thread-safety when reading config */
static int free_global_registered;
AlsaData *ad = newAlsaData();
if (!free_global_registered) {
atexit((void(*)(void))snd_config_update_free_global);
free_global_registered = 1;
}
if (param) {
BlockParam *bp;
if ((bp = getBlockParam(param, "device")))
......@@ -91,8 +80,24 @@ static void *alsa_initDriver(mpd_unused struct audio_output *ao,
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)
{
/* no need for pthread_once thread-safety when reading config */
static int free_global_registered;
AlsaData *ad = newAlsaData();
if (!free_global_registered) {
atexit((void(*)(void))snd_config_update_free_global);
free_global_registered = 1;
}
if (param)
alsa_configure(ad, param);
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