diff --git a/ext/resindvd/resindvdbin.c b/ext/resindvd/resindvdbin.c
index e5f2828..53a0e08 100644
--- a/ext/resindvd/resindvdbin.c
+++ b/ext/resindvd/resindvdbin.c
@@ -39,7 +39,7 @@ GST_DEBUG_CATEGORY_EXTERN (resindvd_debug);
 
 #define USE_VIDEOQ 0
 #define USE_HARDCODED_VIDEODEC 1
-#define USE_HARDCODED_AUDIODEC 1
+#define USE_HARDCODED_AUDIODEC 0
 
 #define DVDBIN_LOCK(d) g_mutex_lock((d)->dvd_lock)
 #define DVDBIN_UNLOCK(d) g_mutex_unlock((d)->dvd_lock)
@@ -693,6 +693,9 @@ demux_pad_added (GstElement * element, GstPad * pad, RsnDvdBin * dvdbin)
     return;
   }
 
+  GST_DEBUG_OBJECT (dvdbin,
+      "Pad %" GST_PTR_FORMAT " has caps: %" GST_PTR_FORMAT, pad, caps);
+
   s = gst_caps_get_structure (caps, 0);
   g_return_if_fail (s != NULL);
 
@@ -704,7 +707,9 @@ demux_pad_added (GstElement * element, GstPad * pad, RsnDvdBin * dvdbin)
         gst_element_get_request_pad (dvdbin->pieces[DVD_ELEM_SPU_SELECT],
         "sink%d");
     skip_mq = TRUE;
-  } else if (g_str_equal (gst_structure_get_name (s), "audio/x-private1-ac3")) {
+  } else if (g_str_equal (gst_structure_get_name (s), "audio/x-private1-ac3") ||
+      g_str_equal (gst_structure_get_name (s), "audio/x-private1-dts") ||
+      g_str_equal (gst_structure_get_name (s), "audio/x-private1-lpcm")) {
     dest_pad =
         gst_element_get_request_pad (dvdbin->pieces[DVD_ELEM_AUD_SELECT],
         "sink%d");
diff --git a/ext/resindvd/rsnaudiodec.c b/ext/resindvd/rsnaudiodec.c
index 0118ef2..e5f7ffb 100644
--- a/ext/resindvd/rsnaudiodec.c
+++ b/ext/resindvd/rsnaudiodec.c
@@ -90,6 +90,9 @@ static gboolean rsn_audiodec_proxy_src_event (GstPad * pad, GstEvent * event);
 static void rsn_audiodec_dispose (GObject * gobj);
 static void cleanup_child (RsnAudioDec * self);
 
+static GList *decoder_factories = NULL;
+static GstCaps *decoder_caps = NULL;
+
 static void
 rsn_audiodec_class_init (RsnAudioDecClass * klass)
 {
@@ -165,13 +168,14 @@ error:
 static GstCaps *
 rsn_audiodec_get_sink_caps (GstPad * sinkpad)
 {
-  /* FIXME: Calculate set of allowed caps for all discovered decoders */
   RsnAudioDec *self = (RsnAudioDec *) gst_pad_get_parent (sinkpad);
   GstCaps *res;
   if (self == NULL || self->child_sink == NULL)
     goto error;
 
-  res = gst_pad_get_caps (self->child_sink);
+  /* FIXME: Can't get the caps of the child as this
+   * will deadlock! */
+  res = gst_caps_copy (decoder_caps);
   GST_INFO_OBJECT (self, "Returning caps %" GST_PTR_FORMAT, res);
 
   gst_object_unref (self);
@@ -205,12 +209,9 @@ error:
 static gboolean
 rsn_audiodec_sink_event (GstPad * pad, GstEvent * event)
 {
-  GstPad *sinkpad = GST_PAD (gst_pad_get_parent (pad));
-  RsnAudioDec *self = (RsnAudioDec *) gst_pad_get_parent (sinkpad);
+  RsnAudioDec *self = RSN_AUDIODEC (gst_pad_get_parent (pad));
   gboolean res;
 
-  gst_object_unref (sinkpad);
-
   if (self == NULL)
     goto error;
 
@@ -388,18 +389,60 @@ cleanup_child (RsnAudioDec * self)
   }
 }
 
+static gpointer
+_get_decoder_factories (gpointer arg)
+{
+  GstElementFactory *factory;
+
+  decoder_caps = gst_caps_new_empty ();
+
+  factory = gst_element_factory_find ("a52dec");
+  if (factory) {
+    gst_caps_append (decoder_caps,
+        gst_caps_from_string ("audio/x-private1-ac3;" "audio/ac3;"
+            "audio/x-ac3;"));
+    decoder_factories = g_list_prepend (decoder_factories, factory);
+  }
+
+  factory = gst_element_factory_find ("dtsdec");
+  if (factory) {
+    gst_caps_append (decoder_caps,
+        gst_caps_from_string ("audio/x-private1-dts;"));
+    decoder_factories = g_list_prepend (decoder_factories, factory);
+  }
+
+  factory = gst_element_factory_find ("dvdlpcmdec");
+  if (factory) {
+    gst_caps_append (decoder_caps,
+        gst_caps_from_string ("audio/x-private1-lpcm;"));
+    decoder_factories = g_list_prepend (decoder_factories, factory);
+  }
+
+  factory = gst_element_factory_find ("mad");
+  if (factory) {
+    gst_caps_append (decoder_caps,
+        gst_caps_from_string ("audio/mpeg,mpegversion=(int)1;"));
+    decoder_factories = g_list_prepend (decoder_factories, factory);
+  }
+
+  return NULL;
+}
+
 static GstStateChangeReturn
 rsn_audiodec_change_state (GstElement * element, GstStateChange transition)
 {
   GstStateChangeReturn ret;
   RsnAudioDec *self = RSN_AUDIODEC (element);
+  static GOnce gonce = G_ONCE_INIT;
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:{
       GstElement *new_child;
       create_proxy_pads (self);
       GST_DEBUG_OBJECT (self, "Created proxy pads");
-      new_child = gst_element_factory_make ("a52dec", NULL);
+      new_child = gst_element_factory_make ("autoconvert", NULL);
+      g_once (&gonce, _get_decoder_factories, NULL);
+      g_object_set (G_OBJECT (new_child), "factories", decoder_factories, NULL);
       if (new_child == NULL || !rsn_audiodec_set_child (self, new_child))
         ret = GST_STATE_CHANGE_FAILURE;
       break;
