Index: configure.in
===================================================================
RCS file: /cvs/gnome/gnome-applets/configure.in,v
retrieving revision 1.404
diff -u -p -r1.404 configure.in
--- configure.in	7 Jan 2006 15:53:52 -0000	1.404
+++ configure.in	9 Jan 2006 16:56:24 -0000
@@ -319,19 +319,35 @@ P_MIXER=
 MIXER_CFLAGS=
 MIXER_LIBS=
 
-GST_MAJORMINOR=0.8
-GST_REQ=0.8.2
-PKG_CHECK_MODULES(MIXER, gstreamer-interfaces-$GST_MAJORMINOR >= $GST_REQ \
-			 gstreamer-$GST_MAJORMINOR >= $GST_REQ,
+dnl *** FIXME: change to 0.10.2 once released. We need gst-plugins-base
+dnl *** from CVS as of 09-Jan-2006 for the mixerutils stuff.
+GST_MAJORMINOR=0.10
+GST_REQ=0.10.1.1
+PKG_CHECK_MODULES(MIXER, gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQ,
 		  HAVE_GST="yes", HAVE_GST="no")
 if test "x$HAVE_GST" = "xyes"; then
   P_MIXER=mixer
+
+  OLD_CPPFLAGS=$CPPFLAGS
+  CPPFLAGS="$CPPFLAGS $MIXER_CFLAGS"
+  AC_CHECK_HEADER(gst/audio/mixerutils.h, , P_MIXER="")
+  if test "x$P_MIXER" != "x"; then
+    MIXER_LIBS="$MIXER_LIBS -lgstinterfaces-$GST_MAJORMINOR -lgstaudio-$GST_MAJORMINOR"
+  else
+    AC_MSG_WARN([
+                 Your gst-plugins-base installation is too old. Please update.
+                 The mixer plugin will not be built.
+    ])
+    sleep 5 2>/dev/null
+  fi
+  CPPFLAGS=$OLD_CPPFLAGS
 fi
 
 AC_SUBST(MIXER_CFLAGS)
 AC_SUBST(MIXER_LIBS)
 
 AM_CONDITIONAL(APPLET_MIXER, test "$P_MIXER" = "mixer")
+AC_MSG_CHECKING([whether to build the mixer applet])
 if test x"$P_MIXER" == x"mixer"; then
 	AC_MSG_RESULT(yes)
 else
Index: mixer/applet.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/mixer/applet.c,v
retrieving revision 1.46
diff -u -p -r1.46 applet.c
--- mixer/applet.c	20 Dec 2005 14:21:47 -0000	1.46
+++ mixer/applet.c	9 Jan 2006 16:56:26 -0000
@@ -265,7 +265,8 @@ select_tracks (GstElement *element,
   active_track_name_list = NULL;
 
   if (reset_state) {
-    if (gst_element_set_state (element, GST_STATE_READY) != GST_STATE_SUCCESS)
+    gst_element_set_state (element, GST_STATE_READY);
+    if (gst_element_get_state (element, NULL, NULL, -1) != GST_STATE_CHANGE_SUCCESS)
       return NULL;
   }
 
@@ -464,9 +465,7 @@ gnome_volume_applet_dispose (GObject *ob
       GstElement *element = GST_ELEMENT (item->data);
 
       gst_element_set_state (element, GST_STATE_NULL);
-      g_free (g_object_get_data (G_OBJECT (element),
-				 "gnome-volume-applet-name"));
-      gst_object_unref (GST_OBJECT (element));
+      gst_object_unref (element);
     }
     g_list_free (applet->elements);
     applet->elements = NULL;
@@ -1174,8 +1173,8 @@ cb_gconf (GConfClient *client,
 
           if (new_element != old_element) {
             /* change element */
-            if (gst_element_set_state (item->data,
-				       GST_STATE_READY) != GST_STATE_SUCCESS)
+            gst_element_set_state (item->data, GST_STATE_READY);
+            if (gst_element_get_state (item->data, NULL, NULL, -1) != GST_STATE_CHANGE_SUCCESS)
               continue;
 	    
             /* save */
Index: mixer/applet.h
===================================================================
RCS file: /cvs/gnome/gnome-applets/mixer/applet.h,v
retrieving revision 1.10
diff -u -p -r1.10 applet.h
--- mixer/applet.h	17 Dec 2005 16:48:54 -0000	1.10
+++ mixer/applet.h	9 Jan 2006 16:56:26 -0000
@@ -31,7 +31,7 @@
 #include <gconf/gconf-client.h>
 #include <panel-applet-gconf.h>
 #include <gst/gst.h>
-#include <gst/mixer/mixer.h>
+#include <gst/interfaces/mixer.h>
 
 #include "dock.h"
 
Index: mixer/dock.h
===================================================================
RCS file: /cvs/gnome/gnome-applets/mixer/dock.h,v
retrieving revision 1.2
diff -u -p -r1.2 dock.h
--- mixer/dock.h	20 Mar 2005 10:30:18 -0000	1.2
+++ mixer/dock.h	9 Jan 2006 16:56:26 -0000
@@ -28,7 +28,7 @@
 #include <gtk/gtkrange.h>
 #include <gtk/gtkwindow.h>
 #include <gst/gst.h>
-#include <gst/mixer/mixer.h>
+#include <gst/interfaces/mixer.h>
 
 G_BEGIN_DECLS
 
Index: mixer/load.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/mixer/load.c,v
retrieving revision 1.8
diff -u -p -r1.8 load.c
--- mixer/load.c	17 Dec 2005 16:59:12 -0000	1.8
+++ mixer/load.c	9 Jan 2006 16:56:26 -0000
@@ -26,157 +26,114 @@
 #include <string.h>
 
 #include <glib/glist.h>
-#include <gst/propertyprobe/propertyprobe.h>
+#include <gst/audio/mixerutils.h>
 
 #include "applet.h"
 
-static gint
-sort_by_rank (GstElement * a, GstElement * b)
+typedef struct _FilterHelper {
+  GList *names_list;
+  gint count;
+} FilterHelper;
+
+static gboolean
+mixer_filter_func (GstMixer * mixer, gpointer user_data)
 {
-#define gst_element_rank(x) \
-  gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE ( \
-      gst_element_get_factory (x)))
-  return gst_element_rank (b) - gst_element_rank (a);
+  GstElementFactory *factory;
+  const gchar *long_name;
+  FilterHelper *helper = (FilterHelper *) user_data;
+  gchar *devname = NULL;
+  gchar *name, *orig_name;
+
+  /* fetch name */
+  if (g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (mixer)),
+                                    "device-name")) {
+    g_object_get (mixer, "device-name", &devname, NULL);
+    GST_DEBUG ("device name: %s", GST_STR_NULL (devname));
+  } else {
+    devname = NULL;
+    GST_DEBUG ("device name unknown, no 'device-name' property");
+  }
+    
+  factory = gst_element_get_factory (GST_ELEMENT (mixer));
+  long_name = gst_element_factory_get_longname (factory);
+
+  if (devname) {
+	GList *l;
+    gint samenamenr;
+
+    name = g_strdup_printf ("%s (%s)", devname, long_name);
+    g_free (devname);
+
+    /* there may be devices with the same name, and since we sort based
+     * on unique names, we need to make sure they really are. */
+    samenamenr = 0;
+    for (l = helper->names_list; l != NULL; l = l->next) {
+      if (strcmp ((const gchar *) l->data, name) == 0)
+        samenamenr++;
+    }
+    if (samenamenr > 0) {
+      /* name already exists, so append a number to make it unique */
+      orig_name = name;
+      name = g_strdup_printf ("%s #%d", name, samenamenr + 1);
+    } else {
+      orig_name = g_strdup (name);
+    }
+  } else {
+    gchar *title;
+
+    ++helper->count;
+
+    title = g_strdup_printf (_("Unknown Volume Control %d"),  helper->count);
+    name = g_strdup_printf ("%s (%s)", title, long_name);
+    orig_name = g_strdup (name);
+    g_free (title);
+  }
+
+  helper->names_list = g_list_prepend (helper->names_list, name);
+
+  g_object_set_data_full (G_OBJECT (mixer),
+                          "gnome-volume-applet-name",
+                          name,
+                          (GDestroyNotify) g_free);
+
+  /* FIXME: this does not seem to be used anywhere? (tpm) */
+  g_object_set_data_full (G_OBJECT (mixer),
+                          "gnome-volume-applet-origname",
+                          orig_name,
+                          (GDestroyNotify) g_free);
+
+  GST_DEBUG ("Adding '%s' to list of available mixers", name);
+
+  gst_element_set_state (GST_ELEMENT (mixer), GST_STATE_NULL);
+
+  return TRUE; /* add mixer to list */
 }
 
 /*
  * Probe for mixer elements. Set up GList * with elements,
  * where each element has a GObject data node set of the
- * name "gnome-volume-control-name" with the value being
+ * name "gnome-volume-applet-name" with the value being
  * the human-readable name of the element.
  *
  * All elements in the returned GList * are in state
  * GST_STATE_NULL.
  */
-
 static GList *
 create_mixer_collection (void)
 {
-  const GList *elements, *item;
-  GList *collection = NULL;
-  gint num = 0;
-
-  /* go through all elements of a certain class and check whether
-   * they implement a mixer. If so, add it to the list. */
-  elements = gst_registry_pool_feature_list (GST_TYPE_ELEMENT_FACTORY);
-  for ( ; elements != NULL; elements = elements->next) {
-    GstElementFactory *factory = GST_ELEMENT_FACTORY (elements->data);
-    gchar *title = NULL, *name;
-    const gchar *klass;
-    GstElement *element = NULL;
-    const GParamSpec *devspec;
-    GstPropertyProbe *probe;
-    GValueArray *array = NULL;
-    gint n, samenamenr;
-
-    /* check category */
-    klass = gst_element_factory_get_klass (factory);
-    if (strcmp (klass, "Generic/Audio"))
-      goto next;
-
-    /* FIXME:
-     * - maybe we want to rename the element to its actual name
-     *     if we've found that?
-     */
-#define _label N_("Unknown Volume Control %d")
-
-    /* create element */
-    title = g_strdup_printf (gettext("Unknown Volume Control %d"), num);
-    element = gst_element_factory_create (factory, title);
-    if (!element)
-      goto next;
-
-    if (!GST_IS_PROPERTY_PROBE (element))
-      goto next;
-
-    probe = GST_PROPERTY_PROBE (element);
-    if (!(devspec = gst_property_probe_get_property (probe, "device")))
-      goto next;
-    if (!(array = gst_property_probe_probe_and_get_values (probe, devspec)))
-      goto next;
-
-    /* set all devices and test for mixer */
-    for (n = 0; n < array->n_values; n++) {
-      GValue *device = g_value_array_get_nth (array, n);
-
-      /* set this device */
-      g_object_set_property (G_OBJECT (element), "device", device);
-      if (gst_element_set_state (element,
-				 GST_STATE_READY) == GST_STATE_FAILURE)
-        continue;
-
-      /* is this device a mixer? */
-      if (!GST_IS_MIXER (element)) {
-        gst_element_set_state (element, GST_STATE_NULL);
-        continue;
-      }
-
-      /* any tracks? */
-      if (!gst_mixer_list_tracks (GST_MIXER (element))) {
-        gst_element_set_state (element, GST_STATE_NULL);
-        continue;
-      }
-
-      /* fetch name */
-      if (g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (element)),
-					"device-name")) {
-        gchar *devname;
-        g_object_get (element, "device-name", &devname, NULL);
-        name = g_strdup_printf ("%s (%s)", devname,
-				gst_element_factory_get_longname (factory));
-      } else {
-        name = g_strdup_printf ("%s (%s)", title,
-				gst_element_factory_get_longname (factory));
-      }
-
-      /* there may be devices with the same name, and since we sort based
-       * on unique names, we need to make sure they really are. */
-      samenamenr = 0;
-      for (item = collection; item != NULL; item = item->next) {
-        const gchar *tname;
-
-        tname = g_object_get_data (G_OBJECT (item->data),
-				   "gnome-volume-applet-origname");
-        if (!strcmp (tname, name)) {
-          samenamenr++;
-        }
-      }
-      if (samenamenr) {
-        gchar *tname;
-
-        /* name already exists, so append a number to make it unique */
-        tname = g_strdup_printf ("%s #%d", name, samenamenr + 1);
-        g_object_set_data (G_OBJECT (element), "gnome-volume-applet-origname",
-			   name);
-        name = tname;
-      } else {
-        g_object_set_data (G_OBJECT (element), "gnome-volume-applet-origname",
-			   name);
-      }
-
-      g_object_set_data (G_OBJECT (element), "gnome-volume-applet-name",
-			 name);
-
-      /* add to list */
-      gst_element_set_state (element, GST_STATE_NULL);
-      collection = g_list_append (collection, element);
-      num++;
-
-      /* and recreate this object, since we give it to the mixer */
-      g_free (title);
-      title = g_strdup_printf (gettext("Unknown Volume Control %d"), num);
-      element = gst_element_factory_create (factory, title);
-    }
+  FilterHelper helper;
+  GList *mixer_list;
 
-next:
-    if (element)
-      gst_object_unref (GST_OBJECT (element));
-    if (array)
-      g_value_array_free (array);
-    g_free (title);
-  }
+  helper.count = 0;
+  helper.names_list = NULL;
+
+  mixer_list = gst_audio_default_registry_mixer_filter (mixer_filter_func,
+                                                        FALSE,
+                                                        &helper);
+
+  g_list_free (helper.names_list);
 
-  return g_list_sort (collection, (GCompareFunc) sort_by_rank);
+  return mixer_list;
 }
 
 static gboolean
Index: mixer/preferences.c
===================================================================
RCS file: /cvs/gnome/gnome-applets/mixer/preferences.c,v
retrieving revision 1.10
diff -u -p -r1.10 preferences.c
--- mixer/preferences.c	16 Nov 2005 15:50:42 -0000	1.10
+++ mixer/preferences.c	9 Jan 2006 16:56:27 -0000
@@ -41,7 +41,7 @@
 #include <gtk/gtktreeselection.h>
 #include <gtk/gtkvbox.h>
 
-#include <gst/mixer/mixer.h>
+#include <gst/interfaces/mixer.h>
 
 #include "applet.h"
 #include "preferences.h"
@@ -345,7 +345,7 @@ cb_dev_selected (GtkComboBox *box,
 		 gpointer    data)
 {
   GnomeVolumeAppletPreferences *prefs = data;
-  GnomeVolumeApplet *applet = (GnomeVolumeApplet *) prefs->applet;
+/*  GnomeVolumeApplet *applet = (GnomeVolumeApplet *) prefs->applet; */
   GtkTreeIter iter;
   const gchar *label;
 
Index: mixer/preferences.h
===================================================================
RCS file: /cvs/gnome/gnome-applets/mixer/preferences.h,v
retrieving revision 1.3
diff -u -p -r1.3 preferences.h
--- mixer/preferences.h	10 Jun 2005 10:22:15 -0000	1.3
+++ mixer/preferences.h	9 Jan 2006 16:56:27 -0000
@@ -26,7 +26,7 @@
 #include <gtk/gtkdialog.h>
 #include <panel-applet.h>
 #include <panel-applet-gconf.h>
-#include <gst/mixer/mixer.h>
+#include <gst/interfaces/mixer.h>
 
 G_BEGIN_DECLS
 
