]> git.alsa-project.org Git - alsa-utils.git/commitdiff
fix for recent namehint API (use get_hint function)
authorJaroslav Kysela <perex@perex.cz>
Thu, 30 Nov 2006 12:42:33 +0000 (13:42 +0100)
committerJaroslav Kysela <perex@perex.cz>
Thu, 30 Nov 2006 12:42:33 +0000 (13:42 +0100)
aplay/aplay.c

index 3b0bf9e9f9656ae7f576a5dd1e78712c2c009388..e9e0df2d7437b28433488e113e94bc5dca762bf2 100644 (file)
@@ -262,32 +262,39 @@ static void device_list(void)
 
 static void pcm_list(void)
 {
-       char **hints, **n, *delim, *filter;
+       void **hints, **n;
+       char *name, *descr, *descr1, *io;
+       const char *filter;
 
        if (snd_device_name_hint(-1, "pcm", &hints) < 0)
                return;
        n = hints;
-       filter = stream == SND_PCM_STREAM_CAPTURE ? "{Playback}" : "{Capture}";
+       filter = stream == SND_PCM_STREAM_CAPTURE ? "Input" : "Output";
        while (*n != NULL) {
-               delim = strchr(*n, '|');
-               if (delim) {
-                       *delim = '\0';
-                       if (strstr(delim + 1, filter) != NULL)
-                               goto __end;
-               }
-               printf("%s\n", *n);
-               if (delim++) {
+               name = snd_device_name_get_hint(*n, "NAME");
+               descr = snd_device_name_get_hint(*n, "DESC");
+               io = snd_device_name_get_hint(*n, "IOID");
+               printf("%s\n", name);
+               if (io != NULL && strcmp(io, filter) == 0)
+                       goto __end;
+               if ((descr1 = descr) != NULL) {
                        printf("    ");
-                       while (*delim) {
-                               if (*delim == '\n')
+                       while (*descr1) {
+                               if (*descr1 == '\n')
                                        printf("\n    ");
                                else
-                                       putchar(*delim);
-                               delim++;
+                                       putchar(*descr1);
+                               descr1++;
                        }
                        putchar('\n');
                }
              __end:
+               if (name != NULL)
+                       free(name);
+               if (descr != NULL)
+                       free(descr);
+               if (io != NULL)
+                       free(io);
                n++;
        }
        snd_device_name_free_hint(hints);