From: Jaroslav Kysela Date: Wed, 11 Oct 2006 11:31:47 +0000 (+0200) Subject: aplay/arecord - use snd_device_name_hint() for -L command X-Git-Tag: v1.0.14rc1~10 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=f6ed3aa3be196eda5c3470afd515882e9463ffd5;p=alsa-utils.git aplay/arecord - use snd_device_name_hint() for -L command --- diff --git a/aplay/aplay.c b/aplay/aplay.c index 665feb4..7630011 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -280,21 +280,21 @@ static void device_list(void) static void pcm_list(void) { - snd_config_t *conf; - snd_output_t *out; - int err = snd_config_update(); - if (err < 0) { - error("snd_config_update: %s", snd_strerror(err)); - return; - } - err = snd_output_stdio_attach(&out, stdout, 0); - assert(err >= 0); - err = snd_config_search(snd_config, "pcm", &conf); - if (err < 0) + char **hints, **n, *delim; + + if (snd_device_name_hint(-1, SND_CTL_ELEM_IFACE_PCM, &hints) < 0) return; - printf(_("PCM list:\n")); - snd_config_save(conf, out); - snd_output_close(out); + n = hints; + while (*n != NULL) { + delim = strchr(*n, '|'); + if (delim) + *delim = '\0'; + printf("%s\n", *n); + if (delim) + printf(" %s\n", delim + 1); + n++; + } + snd_device_name_free_hint(hints); } static void version(void)