Fix the case where a typefind function could not be loaded.
authorWim Taymans <wim.taymans@gmail.com>
Thu, 23 Jan 2003 19:03:02 +0000 (19:03 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 23 Jan 2003 19:03:02 +0000 (19:03 +0000)
Original commit message from CVS:
Fix the case where a typefind function could not be loaded.

gst/gsttype.c

index f5dd2f7..fc1ac6a 100644 (file)
@@ -318,17 +318,20 @@ gst_type_factory_unload_thyself (GstPluginFeature *feature)
 static GstCaps*
 gst_type_type_find_dummy (GstBuffer *buffer, gpointer priv)
 {
+  GstCaps *res = NULL;
   GstTypeFactory *factory = (GstTypeFactory *)priv;
 
   GST_DEBUG (GST_CAT_TYPES,"gsttype: need to load typefind function for %s", factory->mime);
 
   if (gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) {
-    if (factory->typefindfunc) {
-       GstCaps *res = factory->typefindfunc (buffer, factory);
-       if (res) 
-         return res;
+    if (factory->typefindfunc == gst_type_type_find_dummy) {
+      /* looks like we didn't get a real typefind function */
+      g_warning ("could not load valid typefind function for %s\n", factory->mime);
+    }
+    else if (factory->typefindfunc) {
+      res = factory->typefindfunc (buffer, factory);
     }
   }
 
-  return NULL;
+  return res;
 }