Index: ext/alsa/gstalsadeviceprobe.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/ext/alsa/gstalsadeviceprobe.c,v
retrieving revision 1.5
diff -u -p -r1.5 gstalsadeviceprobe.c
--- ext/alsa/gstalsadeviceprobe.c	24 Apr 2008 09:27:35 -0000	1.5
+++ ext/alsa/gstalsadeviceprobe.c	28 Dec 2008 17:36:38 -0000
@@ -49,20 +49,14 @@ gst_alsa_device_property_probe_get_prope
 }
 
 static GList *
-gst_alsa_get_device_list (snd_pcm_stream_t stream)
+gst_alsa_get_mixer_list (void)
 {
   snd_ctl_t *handle;
-  int card, err, dev;
+  int card, err;
   snd_ctl_card_info_t *info;
-  snd_pcm_info_t *pcminfo;
-  gboolean mixer = (stream == -1);
   GList *list = NULL;
 
-  if (stream == -1)
-    stream = 0;
-
   snd_ctl_card_info_malloc (&info);
-  snd_pcm_info_malloc (&pcminfo);
   card = -1;
 
   if (snd_card_next (&card) < 0 || card < 0) {
@@ -83,28 +77,7 @@ gst_alsa_get_device_list (snd_pcm_stream
       goto next_card;
     }
 
-    if (mixer) {
-      list = g_list_append (list, g_strdup (name));
-    } else {
-      dev = -1;
-      while (1) {
-        gchar *gst_device;
-
-        snd_ctl_pcm_next_device (handle, &dev);
-
-        if (dev < 0)
-          break;
-        snd_pcm_info_set_device (pcminfo, dev);
-        snd_pcm_info_set_subdevice (pcminfo, 0);
-        snd_pcm_info_set_stream (pcminfo, stream);
-        if ((err = snd_ctl_pcm_info (handle, pcminfo)) < 0) {
-          continue;
-        }
-
-        gst_device = g_strdup_printf ("hw:%d,%d", card, dev);
-        list = g_list_append (list, gst_device);
-      }
-    }
+    list = g_list_append (list, g_strdup (name));
     snd_ctl_close (handle);
   next_card:
     if (snd_card_next (&card) < 0) {
@@ -114,11 +87,47 @@ gst_alsa_get_device_list (snd_pcm_stream
 
 beach:
   snd_ctl_card_info_free (info);
-  snd_pcm_info_free (pcminfo);
 
   return list;
 }
 
+static GList *
+gst_alsa_get_device_list (snd_pcm_stream_t stream)
+{
+  GList *list = NULL;
+  void **hints, **n;
+
+  if (stream == -1)
+    return gst_alsa_get_mixer_list ();
+
+  if (snd_device_name_hint (-1, "pcm", &hints) < 0) {
+    GST_WARNING ("No soundcard found");
+    goto beach;
+  }
+
+  n = hints;
+  while (*n != NULL) {
+    gchar *name = snd_device_name_get_hint(*n, "NAME");
+    gchar *type = snd_device_name_get_hint (*n, "IOID");
+
+    if (name == NULL)
+      goto next_card;
+    else if (type == NULL)
+      list = g_list_append (list, g_strdup (name));
+    else if (strcmp (type, "Output") && stream == SND_PCM_STREAM_PLAYBACK)
+      list = g_list_append (list, g_strdup (name));
+    else if (strcmp (type, "Input") && stream == SND_PCM_STREAM_CAPTURE)
+      list = g_list_append (list, g_strdup (name));
+
+next_card:
+    n++;
+  }
+  snd_device_name_free_hint(hints);
+
+beach:
+  return list;
+}
+
 static void
 gst_alsa_device_property_probe_probe_property (GstPropertyProbe * probe,
     guint prop_id, const GParamSpec * pspec)
