mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
gstregistry: Directly get list of plugin features
Previously this was: * iterating and referencing all plugin features in a GList * *then* filtering out the ones we want * Was doing that filtering by name (i.e. `strcmp`) instead of direct pointer comparision Instead, just create a private direct function to get the list of plugin features Uses 4 times less instructions ... Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/462>
This commit is contained in:
parent
32600b48a2
commit
973986f40b
3 changed files with 23 additions and 2 deletions
|
@ -92,6 +92,10 @@ struct _GstPluginPrivate {
|
|||
GstStructure *cache_data;
|
||||
};
|
||||
|
||||
/* Private function for getting plugin features directly */
|
||||
GList *
|
||||
_priv_plugin_get_features(GstRegistry *registry, GstPlugin *plugin);
|
||||
|
||||
/* Needed by GstMeta (to access meta seq) and GstBuffer (create/free/iterate) */
|
||||
typedef struct _GstMetaItem GstMetaItem;
|
||||
struct _GstMetaItem {
|
||||
|
|
|
@ -1429,6 +1429,24 @@ gst_registry_get_feature_list_by_plugin (GstRegistry * registry,
|
|||
_gst_plugin_feature_filter_plugin_name, FALSE, (gpointer) name);
|
||||
}
|
||||
|
||||
/* Private function for getting plugin features directly */
|
||||
GList *
|
||||
_priv_plugin_get_features (GstRegistry * registry, GstPlugin * plugin)
|
||||
{
|
||||
GList *res = NULL;
|
||||
GList *walk;
|
||||
|
||||
GST_OBJECT_LOCK (registry);
|
||||
for (walk = registry->priv->features; walk; walk = walk->next) {
|
||||
GstPluginFeature *feat = (GstPluginFeature *) walk->data;
|
||||
if (feat->plugin == plugin)
|
||||
res = g_list_prepend (res, gst_object_ref (feat));
|
||||
}
|
||||
GST_OBJECT_UNLOCK (registry);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Unref and delete the default registry */
|
||||
void
|
||||
_priv_gst_registry_cleanup (void)
|
||||
|
|
|
@ -460,8 +460,7 @@ _priv_gst_registry_chunks_save_plugin (GList ** list, GstRegistry * registry,
|
|||
}
|
||||
|
||||
/* pack plugin features */
|
||||
plugin_features =
|
||||
gst_registry_get_feature_list_by_plugin (registry, plugin->desc.name);
|
||||
plugin_features = _priv_plugin_get_features (registry, plugin);
|
||||
for (walk = plugin_features; walk; walk = g_list_next (walk), pe->nfeatures++) {
|
||||
GstPluginFeature *feature = GST_PLUGIN_FEATURE (walk->data);
|
||||
|
||||
|
|
Loading…
Reference in a new issue