Index: gsttypefindelement.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/plugins/elements/gsttypefindelement.c,v
retrieving revision 1.70
diff -u -r1.70 gsttypefindelement.c
--- gsttypefindelement.c	3 Mar 2006 11:42:40 -0000	1.70
+++ gsttypefindelement.c	6 Mar 2006 20:33:06 -0000
@@ -680,12 +680,40 @@
 
   typefind = GST_TYPE_FIND_ELEMENT (GST_PAD_PARENT (pad));
 
+  GST_DEBUG_OBJECT (typefind, "Inbound buffer: offset %d", (int)(GST_BUFFER_OFFSET(buffer)));
+
+#if 1
+  /* Shortcircuit typefinding if we already have non-any caps */
+  if (typefind->mode == MODE_TYPEFIND)
+  {
+    GstCaps *caps = gst_buffer_get_caps (buffer);
+
+    if (gst_caps_is_any (caps)) {
+      gst_caps_unref (caps);
+    }
+    else {
+      typefind->mode = MODE_NORMAL;
+      g_signal_emit (typefind, gst_type_find_element_signals[HAVE_TYPE], 0,
+          TYPE_FIND_MAX_SIZE, caps);
+/*
+      if (typefind->store) {
+        GST_DEBUG_OBJECT (typefind, "Pushing store: %d", GST_BUFFER_SIZE (typefind->store));
+        gst_buffer_set_caps (typefind->store, typefind->caps);
+        gst_pad_push (typefind->src, typefind->store);
+        typefind->store = NULL;
+      }
+*/
+    }
+  }
+#endif
+
   switch (typefind->mode) {
     case MODE_ERROR:
       /* we should already have called GST_ELEMENT_ERROR */
       return GST_FLOW_ERROR;
     case MODE_NORMAL:
       gst_buffer_set_caps (buffer, typefind->caps);
+      GST_DEBUG_OBJECT (typefind, "Pushing buffer of size %d, offset %d", (int)(GST_BUFFER_SIZE(buffer)), (int)(GST_BUFFER_OFFSET(buffer)));
       return gst_pad_push (typefind->src, buffer);
     case MODE_TYPEFIND:{
       gboolean done = TRUE;
