registry: fill in elementfactory when registering element
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Sat, 29 Aug 2009 18:44:36 +0000 (20:44 +0200)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Mon, 31 Aug 2009 13:34:54 +0000 (15:34 +0200)
elementfactory field is filled in by gst_element_base_class_init,
but it needs some info set on the element's type, so have it
available prior to class structure creation spinning up.
This affects elements that have a well-known/public type (e.g. pipeline)
and can be created by other means than gst_element_factory_make
(which will also fill in the element's factory).

gst/gstelementfactory.c

index a4b1aa1..9c7701e 100644 (file)
@@ -286,6 +286,8 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
   GST_LOG_OBJECT (factory, "Created new elementfactory for type %s",
       g_type_name (type));
 
+  /* provide info needed during class structure setup */
+  g_type_set_qdata (type, _gst_elementclass_factory, factory);
   klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
   if ((klass->details.longname == NULL) ||
       (klass->details.klass == NULL) || (klass->details.author == NULL))
@@ -306,7 +308,6 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
         g_list_append (factory->staticpadtemplates, newt);
   }
   factory->numpadtemplates = klass->numpadtemplates;
-  g_type_set_qdata (type, _gst_elementclass_factory, factory);
 
   /* special stuff for URI handling */
   if (g_type_is_a (type, GST_TYPE_URI_HANDLER)) {