+2004-07-29 Benjamin Otte <otte@gnome.org>
+
+ * gst/gstpad.c: (gst_pad_set_explicit_caps):
+ check that caps are fixed
+ * gst/gstpad.c: (gst_pad_template_new):
+ don't try to simplify caps, costs too much time on gst_init
+ * gst/gstplugin.c: (gst_plugin_add_feature):
+ G_ERROR if features are added twice
+ * gst/gsttypefind.c: (gst_type_find_register):
+ * gst/gstelementfactory.c: (gst_element_register):
+ don't add features twice
+ * docs/random/ds/0.9-suggested-changes:
+ add note about possible gst_init optimization
+
2004-07-28 David Schleef <ds@schleef.org>
* testsuite/elements/Makefile.am:
- make this explicit by having a list of keywords instead of a fixed string
with slashes
- fix the editor/el browser to display this nicely
+
+- optimization:
+ - delay parsing caps from the registry until after startup (until they're
+ first requested or maybe an idle handler for the main loop)
factory = gst_element_factory_find (name);
if (!factory) {
- klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
factory =
GST_ELEMENT_FACTORY (g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL));
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE (factory), name);
GST_LOG_OBJECT (factory, "Created new elementfactory for type %s",
g_type_name (type));
+ gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
} else {
g_return_val_if_fail (factory->type == 0, FALSE);
- klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
gst_element_factory_cleanup (factory);
GST_LOG_OBJECT (factory, "Reuse existing elementfactory for type %s",
g_type_name (type));
}
+ klass = GST_ELEMENT_CLASS (g_type_class_ref (type));
factory->type = type;
__gst_element_details_copy (&factory->details, &klass->details);
factory->padtemplates = g_list_copy (klass->padtemplates);
g_free (interfaces);
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE (factory), rank);
- gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
GstPadLinkReturn link_ret;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
+ g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
GST_CAT_DEBUG (GST_CAT_PADS,
"setting explicit caps on %s:%s to %" GST_PTR_FORMAT,
g_return_val_if_fail (name_template != NULL, NULL);
g_return_val_if_fail (caps != NULL, NULL);
+ g_return_val_if_fail (direction == GST_PAD_SRC
+ || direction == GST_PAD_SINK, NULL);
+ g_return_val_if_fail (presence == GST_PAD_ALWAYS
+ || presence == GST_PAD_SOMETIMES || presence == GST_PAD_REQUEST, NULL);
if (!name_is_valid (name_template, presence))
return NULL;
GST_PAD_TEMPLATE_NAME_TEMPLATE (new) = g_strdup (name_template);
GST_PAD_TEMPLATE_DIRECTION (new) = direction;
GST_PAD_TEMPLATE_PRESENCE (new) = presence;
- gst_caps_do_simplify (caps);
GST_PAD_TEMPLATE_CAPS (new) = caps;
return new;
{
GstPluginFeature *oldfeature;
+ /* FIXME 0.9: get reference counting somewhat right in here, GstPluginFeatures
+ * should probably be GstObjects that are sinked when adding them to a plugin */
g_return_if_fail (plugin != NULL);
g_return_if_fail (GST_IS_PLUGIN_FEATURE (feature));
g_return_if_fail (feature != NULL);
oldfeature = gst_plugin_find_feature (plugin,
GST_PLUGIN_FEATURE_NAME (feature), G_OBJECT_TYPE (feature));
- if (!oldfeature) {
+ if (oldfeature == feature) {
+ GST_ERROR ("feature %s has already been added",
+ GST_PLUGIN_FEATURE_NAME (feature));
+ /* g_object_unref (feature); */
+ } else if (oldfeature) {
+ GST_ERROR ("feature %s already present in plugin",
+ GST_PLUGIN_FEATURE_NAME (feature));
+ /* g_object_unref (feature); */
+ } else {
feature->manager = plugin;
plugin->features = g_list_prepend (plugin->features, feature);
plugin->numfeatures++;
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);
+ gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
} else {
GST_DEBUG_OBJECT (factory, "using old typefind factory for %s", name);
}
factory->function = func;
factory->user_data = data;
- gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
-
return TRUE;
}