Index: metadata/rb-metadata-gst.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/metadata/rb-metadata-gst.c,v
retrieving revision 1.61
diff -u -u -p -r1.61 rb-metadata-gst.c
--- metadata/rb-metadata-gst.c	31 Jan 2006 15:38:04 -0000	1.61
+++ metadata/rb-metadata-gst.c	1 Feb 2006 03:25:36 -0000
@@ -137,66 +137,53 @@ rb_add_flac_tagger (GstBin *pipeline, Gs
 	return tagger;
 }
 
-static GstElement *
-rb_add_id3_tagger (GstBin *pipeline, GstElement *element)
+
+static void
+id3_pad_added_cb (GstElement *demux, GstPad *pad, GstElement *mux)
 {
-        GstElement *tagger = NULL;
-	GstElement *spider = NULL;
-	GstElement *identity = NULL;
+	GstPad *mux_pad;
+
+#ifdef HAVE_GSTREAMER_0_8
+	mux_pad = gst_element_get_compatible_pad (mux, pad);
+#endif
 #ifdef HAVE_GSTREAMER_0_10
-	GstElement *filter = NULL;
+	mux_pad = gst_element_get_compatible_pad (mux, pad, NULL);
 #endif
-	GstCaps *filtercaps = NULL;
+	if (gst_pad_link (pad, mux_pad) != GST_PAD_LINK_OK)
+		rb_debug ("unable to link pad from id3demux to id3mux");
+	else
+		rb_debug ("linked pad from id3de to id3mux");
+}
 
-        if (!(tagger = gst_element_factory_make("id3tag", "tagger"))) 
-                return NULL;
+static GstElement *
+rb_add_id3_tagger (GstBin *pipeline, GstElement *element)
+{
+	GstElement *demux = NULL;
+	GstElement *mux = NULL;
 
-        if (!(identity = gst_element_factory_make("identity", "identity"))) {
-                gst_object_unref( GST_OBJECT(tagger) );
-                return NULL;
-        }
-	if (!(spider = gst_element_factory_make ("spider", "spider")) ||
-	    !(tagger = gst_element_factory_make ("id3mux", "id3mux")) ||
-	    !(filtercaps = gst_caps_new_simple ("application/x-id3", NULL))) {
-		gst_object_unref (GST_OBJECT (spider));
-		gst_object_unref (GST_OBJECT (tagger));
-		gst_caps_unref (filtercaps);
-		return NULL;
-	}
+	demux = gst_element_factory_make ("id3demux", NULL);
+	mux =  gst_element_factory_make ("id3mux", NULL);
 
-#ifdef HAVE_GSTREAMER_0_10
-	if (! (filter = gst_element_factory_make ("capsfilter", NULL))) {
-		gst_object_unref (GST_OBJECT (spider));
-		gst_object_unref (GST_OBJECT (tagger));
-		gst_caps_unref (filtercaps);
-		return NULL;
-	}
-	g_object_set (GST_OBJECT (tagger), "v1-tag", TRUE, NULL);
-#else
-	gst_element_set (tagger, "v1-tag", TRUE, NULL);
-#endif
-        
-        gst_bin_add_many (GST_BIN (pipeline), tagger, identity, NULL);
+	if (demux == NULL || mux == NULL)
+		goto error;
+
+	gst_bin_add_many (pipeline, demux, mux, NULL);
+	if (!gst_element_link (element, demux))
+		goto error;
 
 #ifdef HAVE_GSTREAMER_0_8
-	if (!gst_element_link_filtered (tagger, identity, filtercaps)) {
+	g_signal_connect (demux, "new-pad", (GCallback)id3_pad_added_cb, mux);
 #endif
 #ifdef HAVE_GSTREAMER_0_10
-	g_object_set (G_OBJECT (filter), "filter-caps", filtercaps, NULL);
-	if (!gst_element_link_many (tagger, filter, identity, NULL)) {
+	g_signal_connect (demux, "pad-added", (GCallback)id3_pad_added_cb, mux);
 #endif
 
-		g_warning("Linking id3tag and identity failed");
-                gst_caps_unref(filtercaps);
-                gst_object_unref(GST_OBJECT(tagger));
-                gst_object_unref(GST_OBJECT(identity));
-                return NULL;
-        }
-	gst_caps_unref (filtercaps);
+	return mux;
 
-        gst_element_link_many (element, tagger, NULL);
-        
-	return identity;
+error:
+	g_object_unref (demux);
+	g_object_unref (mux);
+	return NULL;
 }
 
 static void
@@ -234,7 +221,8 @@ rb_metadata_init (RBMetaData *md)
  	 */
 	has_gnomevfssink = (gst_element_factory_find ("gnomevfssrc") != NULL &&
 			    gst_element_factory_find ("gnomevfssink") != NULL);
-	has_id3 = (gst_element_factory_find ("id3tag") != NULL);
+	has_id3 = (gst_element_factory_find ("id3mux") != NULL &&
+		   gst_element_factory_find ("id3demux") != NULL);
 
 	tagger = (has_gnomevfssink && has_id3) ?  rb_add_id3_tagger : NULL;
 	add_supported_type (md, "application/x-id3", tagger, "MP3");
