From: <bi...@ke...> - 2009-10-22 10:35:38
|
Module: gstreamer Branch: master Commit: 4b13520b6188ed755a22bf52bd3a4f442e8442b9 URL: http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=4b13520b6188ed755a22bf52bd3a4f442e8442b9 Author: Edward Hervey <bi...@bi...> Date: Mon Oct 19 09:06:16 2009 +0200 gstregistry: Use hash table when finding a feature. Fixes #598895 --- gst/gstregistry.c | 18 ++++-------------- 1 files changed, 4 insertions(+), 14 deletions(-) diff --git a/gst/gstregistry.c b/gst/gstregistry.c index 9fdb392..23f61ad 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -659,25 +659,15 @@ gst_registry_find_feature (GstRegistry * registry, const gchar * name, GType type) { GstPluginFeature *feature = NULL; - GList *walk; - GstTypeNameData data; g_return_val_if_fail (GST_IS_REGISTRY (registry), NULL); g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (g_type_is_a (type, GST_TYPE_PLUGIN_FEATURE), NULL); - data.name = name; - data.type = type; - - walk = gst_registry_feature_filter (registry, - (GstPluginFeatureFilter) gst_plugin_feature_type_name_filter, - TRUE, &data); - - if (walk) { - feature = GST_PLUGIN_FEATURE_CAST (walk->data); - - gst_object_ref (feature); - gst_plugin_feature_list_free (walk); + feature = gst_registry_lookup_feature (registry, name); + if (feature && !g_type_is_a (G_TYPE_FROM_INSTANCE (feature), type)) { + gst_object_unref (feature); + feature = NULL; } return feature; |