--- gst-plugins-base0.10-0.10.0.old/ext/alsa/gstalsaplugin.c	2006-01-03 14:22:58.000000000 +0100
+++ gst-plugins-base0.10-0.10.0/ext/alsa/gstalsaplugin.c	2006-01-03 16:09:30.000000000 +0100
@@ -62,9 +62,12 @@
   if (!gst_element_register (plugin, "alsasrc", GST_RANK_PRIMARY,
           GST_TYPE_ALSA_SRC))
     return FALSE;
-  if (!gst_element_register (plugin, "alsasink", GST_RANK_PRIMARY,
+  if (!gst_element_register (plugin, "alsasink", GST_RANK_PRIMARY-2,
           GST_TYPE_ALSA_SINK))
     return FALSE;
+  if (!gst_element_register (plugin, "alsadmixsink", GST_RANK_PRIMARY,
+          GST_TYPE_ALSADMIX_SINK))
+    return FALSE;
 
   GST_DEBUG_CATEGORY_INIT (alsa_debug, "alsa", 0, "alsa plugins");
   err = snd_lib_error_set_handler (gst_alsa_error_wrapper);
--- gst-plugins-base0.10-0.10.0.old/ext/alsa/gstalsasink.c	2006-01-03 14:22:58.000000000 +0100
+++ gst-plugins-base0.10-0.10.0/ext/alsa/gstalsasink.c	2006-01-03 16:04:12.000000000 +0100
@@ -747,3 +747,84 @@
   }
 #endif
 }
+
+/*
+ * alsadmix 
+ */
+
+/* elementfactory information */
+static GstElementDetails gst_alsadmixsink_details =
+GST_ELEMENT_DETAILS ("Audio Sink (ALSA with dmix)",
+    "Sink/Audio",
+    "Output to a sound card via ALSA (with enabled dmix)",
+    "Martin Pitt <martin.pitt@ubuntu.com>");
+
+static void gst_alsadmixsink_base_init (gpointer g_class);
+static void gst_alsadmixsink_class_init (GstAlsaSinkClass * klass);
+static gboolean gst_alsadmixsink_open (GstAudioSink * asink);
+static gint gst_alsadmixsink_test_dmix(const char* device);
+
+GType
+gst_alsadmixsink_get_type (void)
+{
+  static GType alsadmixsink_type = 0;
+
+  if (!alsadmixsink_type) {
+    static const GTypeInfo alsadmixsink_info = {
+      sizeof (GstAlsaSinkClass),
+      gst_alsadmixsink_base_init,
+      NULL,
+      (GClassInitFunc) gst_alsadmixsink_class_init,
+      NULL,
+      NULL,
+      sizeof (GstAlsaSink),
+      0,
+      (GInstanceInitFunc) gst_alsasink_init,
+    };
+
+    alsadmixsink_type =
+        g_type_register_static (GST_TYPE_ALSA_SINK, "GstAlsaDmixSink",
+        &alsadmixsink_info, 0);
+  }
+
+  return alsadmixsink_type;
+}
+
+static void
+gst_alsadmixsink_base_init (gpointer g_class)
+{
+  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
+  gst_element_class_set_details (element_class, &gst_alsadmixsink_details);
+}
+
+static void
+gst_alsadmixsink_class_init (GstAlsaSinkClass * klass)
+{
+  GstAudioSinkClass *gstaudiosink_class;
+  gstaudiosink_class = (GstAudioSinkClass *) klass;
+  gstaudiosink_class->open = GST_DEBUG_FUNCPTR (gst_alsadmixsink_open);
+}
+
+static gboolean
+gst_alsadmixsink_open (GstAudioSink * asink)
+{
+  snd_pcm_t* pcm;
+  int snderr;
+  gboolean result;
+
+  /* open the device */
+  GstAlsaSink* alsasink;
+  alsasink = GST_ALSA_SINK(asink);
+  snderr = snd_pcm_open(&pcm, alsasink->device ? alsasink->device : "default",
+          SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
+  if (snderr < 0)
+    return FALSE;
+
+  /* if alsasink can open it again, then we have multiple channels (i. e. dmix
+   * or hardware support */
+  result = gst_alsasink_open (asink);
+
+  snd_pcm_close(pcm);
+  return result;
+}
--- gst-plugins-base0.10-0.10.0.old/ext/alsa/gstalsasink.h	2006-01-03 14:22:58.000000000 +0100
+++ gst-plugins-base0.10-0.10.0/ext/alsa/gstalsasink.h	2006-01-03 15:08:43.000000000 +0100
@@ -67,6 +67,16 @@
 
 GType gst_alsasink_get_type(void);
 
+/* alsadmix */
+
+#define GST_TYPE_ALSADMIX_SINK          (gst_alsadmixsink_get_type())
+#define GST_ALSADMIX_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSADMIX_SINK,GstAlsaSink))
+#define GST_ALSADMIX_SINK_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSADMIX_SINK,GstAlsaSinkClass))
+#define GST_IS_ALSADMIX_SINK(obj)       (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSADMIX_SINK))
+#define GST_IS_ALSADMIX_SINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSADMIX_SINK))
+
+GType gst_alsadmixsink_get_type(void);
+
 G_END_DECLS
 
 #endif /* __GST_ALSASINK_H__ */
