[gst-devel] Fix for warning in gst_type_find_register...

Brett Kosinski brettk at frodo.dyn.gno.org
Mon Nov 17 15:19:06 CET 2003


Basically, if the factory returned from gst_registry_pool_find_feature was
NULL, a warning would get emitted, since this NULL value was casted to
a GstTypeFindFactory.  This patch fixes that bug.

Brett.
-------------- next part --------------
Index: gsttypefind.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gsttypefind.c,v
retrieving revision 1.40
diff -u -r1.40 gsttypefind.c
--- gsttypefind.c	31 Oct 2003 19:32:45 -0000	1.40
+++ gsttypefind.c	17 Nov 2003 23:16:13 -0000
@@ -214,6 +214,7 @@
 			GstTypeFindFunction func, gchar **extensions, GstCaps *possible_caps,
 			gpointer data)
 {
+  GstPluginFeature *feature;
   GstTypeFindFactory *factory;
   
   g_return_val_if_fail (plugin != NULL, FALSE);
@@ -221,13 +222,16 @@
   g_return_val_if_fail (func != NULL, FALSE);
 
   GST_INFO ("registering typefind function for %s", name);
-  factory = GST_TYPE_FIND_FACTORY (gst_registry_pool_find_feature (name, GST_TYPE_TYPE_FIND_FACTORY));
-  if (!factory) {
+
+  feature = gst_registry_pool_find_feature (name, GST_TYPE_TYPE_FIND_FACTORY);
+
+  if (!feature) {
     factory = g_object_new (GST_TYPE_TYPE_FIND_FACTORY, NULL);
     GST_DEBUG_OBJECT (factory, "using new typefind factory for %s", name);
     g_assert (GST_IS_TYPE_FIND_FACTORY (factory));
     gst_plugin_feature_set_name (GST_PLUGIN_FEATURE (factory), name);
   } else {
+    factory = GST_TYPE_FIND_FACTORY(feature);
     GST_DEBUG_OBJECT (factory, "using old typefind factory for %s", name);
   }
 


More information about the gstreamer-devel mailing list