pcm: introduce defaults.pcm.compat to change the params choose behaviour

Having getenv directly in the function is not a good idea. Allow
configuration of the behaviour change in snd_pcm_param_choose() function
using alsa.conf. Use the environment variable LIBASOUND_COMPAT only
as fallback.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2010-08-11 20:20:40 +02:00
parent 09879a4bb5
commit de606e9c25
4 changed files with 16 additions and 3 deletions

View file

@ -2192,6 +2192,18 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
}
}
if (err >= 0) {
err = snd_config_search(pcm_root, "defaults.pcm.compat", &tmp);
if (err >= 0) {
long i;
if (snd_config_get_integer(tmp, &i) >= 0) {
if (i > 0)
(*pcmp)->compat = 1;
}
} else {
char *str = getenv("LIBASOUND_COMPAT");
if (str && *str)
(*pcmp)->compat = 1;
}
err = snd_config_search(pcm_root, "defaults.pcm.minperiodtime", &tmp);
if (err >= 0)
snd_config_get_integer(tmp, &(*pcmp)->minperiodtime);