]> git.alsa-project.org Git - alsa-utils.git/commitdiff
aplay/arecord - use snd_device_name_hint() for -L command
authorJaroslav Kysela <perex@perex.cz>
Wed, 11 Oct 2006 11:31:47 +0000 (13:31 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Oct 2006 11:31:47 +0000 (13:31 +0200)
aplay/aplay.c

index 665feb47abedf049c6866cf1efc1e79d540105c6..763001130c20baa68366b08c55eb85a84f8010a9 100644 (file)
@@ -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)