/* * Method: get_features(feature_type_or_plugin_name) * feature_type_or_plugin_name: a feature type or plugin name. * * Gets a list of all plugin features of the given type in the pool. * * Valid features types are Gst::AutoplugFactory, Gst::ElementFactory, * Gst::IndexFactory, Gst::SchedulerFactory and Gst::TypeFactory. * * Returns: an array of Gst::PluginFeature objects. */ static VALUE rb_gst_registry_get_features(VALUE self, VALUE type_or_plugin_name) { GList *list, *node; GType gtype; VALUE arr; if (RVAL2CBOOL(rb_obj_is_kind_of(type_or_plugin_name, rb_cString))) { list = gst_registry_get_feature_list_by_plugin(RGST_REGISTRY(self), RVAL2CSTR(type_or_plugin_name)); } else { gtype = CLASS2GTYPE(type_or_plugin_name); if (!is_valid_pluginfeature_type(gtype)) rb_raise (rb_eArgError, "Invalid feature type."); list = gst_registry_get_feature_list(RGST_REGISTRY(self), gtype); } arr = rb_ary_new(); for (node = list; node != NULL; node = g_list_next(node)) { rb_ary_push(arr, instanciate_pluginfeature(GST_PLUGIN_FEATURE(node->data))); } g_list_free (list); return arr; }
static void setup (void) { GList *features, *f; GList *plugins, *p; gchar **ignorelist = NULL; const gchar *STATE_IGNORE_ELEMENTS = NULL; GstRegistry *def; GST_DEBUG ("getting elements for package %s", PACKAGE); STATE_IGNORE_ELEMENTS = g_getenv ("GST_STATE_IGNORE_ELEMENTS"); if (!g_getenv ("GST_NO_STATE_IGNORE_ELEMENTS") && STATE_IGNORE_ELEMENTS) { GST_DEBUG ("Will ignore element factories: '%s'", STATE_IGNORE_ELEMENTS); ignorelist = g_strsplit (STATE_IGNORE_ELEMENTS, " ", 0); } def = gst_registry_get (); plugins = gst_registry_get_plugin_list (def); for (p = plugins; p; p = p->next) { GstPlugin *plugin = p->data; if (strcmp (gst_plugin_get_source (plugin), PACKAGE) != 0) continue; features = gst_registry_get_feature_list_by_plugin (def, gst_plugin_get_name (plugin)); for (f = features; f; f = f->next) { GstPluginFeature *feature = f->data; const gchar *name = gst_plugin_feature_get_name (feature); gboolean ignore = FALSE; if (!GST_IS_ELEMENT_FACTORY (feature)) continue; if (ignorelist) { gchar **s; for (s = ignorelist; s && *s; ++s) { if (g_str_has_prefix (name, *s)) { GST_DEBUG ("ignoring element %s", name); ignore = TRUE; } } if (ignore) continue; } GST_DEBUG ("adding element %s", name); elements = g_list_prepend (elements, (gpointer) g_strdup (name)); } gst_plugin_feature_list_free (features); } gst_plugin_list_free (plugins); g_strfreev (ignorelist); }
gint list_gaudieffects_features() { GList *list, *walk; g_print("Available gaudieffects features :\n"); list = gst_registry_get_feature_list_by_plugin(GET_PLUGIN_REGISTRY, "gaudieffects"); for (walk = list; walk != NULL; walk = g_list_next(walk)) g_print("feature: <%s>\n", gst_plugin_feature_get_name((GstPluginFeature *)walk->data)); gst_plugin_feature_list_free(list); return 0; }
void iterate_plugins (GHashTable *hashtable) { GList *plugins, *orig_plugins; orig_plugins = plugins = gst_default_registry_get_plugin_list (); while (plugins) { GList *features, *orig_features; GstPlugin *plugin; plugin = (GstPlugin *) (plugins->data); plugins = g_list_next (plugins); if (plugin->flags & GST_PLUGIN_FLAG_BLACKLISTED) { continue; } orig_features = features = gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), plugin->desc.name); while (features) { GstPluginFeature *feature; if (G_UNLIKELY (features->data == NULL)) goto next; feature = GST_PLUGIN_FEATURE (features->data); if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory; factory = GST_ELEMENT_FACTORY (feature); iterate_plugins_elements (factory, hashtable); } next: features = g_list_next (features); } gst_plugin_feature_list_free (orig_features); } gst_plugin_list_free (orig_plugins); }
static void print_plugin (const gchar * marker, GstRegistry * registry, GstPlugin * plugin) { const gchar *name; GList *features, *f; name = gst_plugin_get_name (plugin); GST_DEBUG ("%s: plugin %p %d %s file: %s", marker, plugin, GST_OBJECT_REFCOUNT (plugin), name, GST_STR_NULL (gst_plugin_get_filename (plugin))); features = gst_registry_get_feature_list_by_plugin (registry, name); for (f = features; f != NULL; f = f->next) { GstPluginFeature *feature; feature = GST_PLUGIN_FEATURE (f->data); GST_LOG ("%s: feature: %p %s", marker, feature, GST_OBJECT_NAME (feature)); } gst_plugin_feature_list_free (features); }
static void print_element_list (gboolean print_all) { int plugincount = 0, featurecount = 0, blacklistcount = 0; GList *plugins, *orig_plugins; orig_plugins = plugins = gst_registry_get_plugin_list (gst_registry_get ()); while (plugins) { GList *features, *orig_features; GstPlugin *plugin; plugin = (GstPlugin *) (plugins->data); plugins = g_list_next (plugins); plugincount++; if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED)) { blacklistcount++; continue; } orig_features = features = gst_registry_get_feature_list_by_plugin (gst_registry_get (), gst_plugin_get_name (plugin)); while (features) { GstPluginFeature *feature; if (G_UNLIKELY (features->data == NULL)) goto next; feature = GST_PLUGIN_FEATURE (features->data); featurecount++; if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory; factory = GST_ELEMENT_FACTORY (feature); if (print_all) print_element_info (factory, TRUE); else g_print ("%s: %s: %s\n", gst_plugin_get_name (plugin), GST_OBJECT_NAME (factory), gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME)); } else if (GST_IS_TYPE_FIND_FACTORY (feature)) { GstTypeFindFactory *factory; const gchar *const *extensions; factory = GST_TYPE_FIND_FACTORY (feature); if (!print_all) g_print ("%s: %s: ", gst_plugin_get_name (plugin), gst_plugin_feature_get_name (feature)); extensions = gst_type_find_factory_get_extensions (factory); if (extensions != NULL) { guint i = 0; while (extensions[i]) { if (!print_all) g_print ("%s%s", i > 0 ? ", " : "", extensions[i]); i++; } if (!print_all) g_print ("\n"); } else { if (!print_all) g_print ("no extensions\n"); } } else { if (!print_all) n_print ("%s: %s (%s)\n", gst_plugin_get_name (plugin), GST_OBJECT_NAME (feature), g_type_name (G_OBJECT_TYPE (feature))); } next: features = g_list_next (features); } gst_plugin_feature_list_free (orig_features); } gst_plugin_list_free (orig_plugins); g_print ("\n"); g_print (_("Total count: ")); g_print (ngettext ("%d plugin", "%d plugins", plugincount), plugincount); if (blacklistcount) { g_print (" ("); g_print (ngettext ("%d blacklist entry", "%d blacklist entries", blacklistcount), blacklistcount); g_print (" not shown)"); } g_print (", "); g_print (ngettext ("%d feature", "%d features", featurecount), featurecount); g_print ("\n"); }
static void print_plugin_features (GstPlugin * plugin) { GList *features, *origlist; gint num_features = 0; gint num_elements = 0; gint num_tracers = 0; gint num_typefinders = 0; gint num_devproviders = 0; gint num_other = 0; origlist = features = gst_registry_get_feature_list_by_plugin (gst_registry_get (), gst_plugin_get_name (plugin)); while (features) { GstPluginFeature *feature; feature = GST_PLUGIN_FEATURE (features->data); if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory; factory = GST_ELEMENT_FACTORY (feature); n_print (" %s: %s\n", GST_OBJECT_NAME (factory), gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME)); num_elements++; } else if (GST_IS_TYPE_FIND_FACTORY (feature)) { GstTypeFindFactory *factory; const gchar *const *extensions; factory = GST_TYPE_FIND_FACTORY (feature); extensions = gst_type_find_factory_get_extensions (factory); if (extensions) { guint i = 0; g_print (" %s: %s: ", gst_plugin_get_name (plugin), gst_plugin_feature_get_name (feature)); while (extensions[i]) { g_print ("%s%s", i > 0 ? ", " : "", extensions[i]); i++; } g_print ("\n"); } else g_print (" %s: %s: no extensions\n", gst_plugin_get_name (plugin), gst_plugin_feature_get_name (feature)); num_typefinders++; } else if (GST_IS_DEVICE_PROVIDER_FACTORY (feature)) { GstDeviceProviderFactory *factory; factory = GST_DEVICE_PROVIDER_FACTORY (feature); n_print (" %s: %s\n", GST_OBJECT_NAME (factory), gst_device_provider_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME)); num_devproviders++; } else if (GST_IS_TRACER_FACTORY (feature)) { n_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)), g_type_name (G_OBJECT_TYPE (feature))); num_tracers++; } else if (feature) { n_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)), g_type_name (G_OBJECT_TYPE (feature))); num_other++; } num_features++; features = g_list_next (features); } gst_plugin_feature_list_free (origlist); n_print ("\n"); n_print (" %d features:\n", num_features); if (num_elements > 0) n_print (" +-- %d elements\n", num_elements); if (num_typefinders > 0) n_print (" +-- %d typefinders\n", num_typefinders); if (num_devproviders > 0) n_print (" +-- %d device providers\n", num_devproviders); if (num_tracers > 0) n_print (" +-- %d tracers\n", num_tracers); if (num_other > 0) n_print (" +-- %d other objects\n", num_other); n_print ("\n"); }
static void print_all_uri_handlers (void) { GList *plugins, *p, *features, *f; plugins = gst_registry_get_plugin_list (gst_registry_get ()); for (p = plugins; p; p = p->next) { GstPlugin *plugin = (GstPlugin *) (p->data); features = gst_registry_get_feature_list_by_plugin (gst_registry_get (), gst_plugin_get_name (plugin)); for (f = features; f; f = f->next) { GstPluginFeature *feature = GST_PLUGIN_FEATURE (f->data); if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory; GstElement *element; factory = GST_ELEMENT_FACTORY (gst_plugin_feature_load (feature)); if (!factory) { g_print ("element plugin %s couldn't be loaded\n", gst_plugin_get_name (plugin)); continue; } element = gst_element_factory_create (factory, NULL); if (!element) { g_print ("couldn't construct element for %s for some reason\n", GST_OBJECT_NAME (factory)); gst_object_unref (factory); continue; } if (GST_IS_URI_HANDLER (element)) { const gchar *const *uri_protocols; const gchar *dir; gchar *joined; switch (gst_uri_handler_get_uri_type (GST_URI_HANDLER (element))) { case GST_URI_SRC: dir = "read"; break; case GST_URI_SINK: dir = "write"; break; default: dir = "unknown"; break; } uri_protocols = gst_uri_handler_get_protocols (GST_URI_HANDLER (element)); joined = g_strjoinv (", ", (gchar **) uri_protocols); g_print ("%s (%s, rank %u): %s\n", gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)), dir, gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (factory)), joined); g_free (joined); } gst_object_unref (element); gst_object_unref (factory); } } gst_plugin_feature_list_free (features); } gst_plugin_list_free (plugins); }
static void print_element_list (gboolean print_all) { int plugincount = 0, featurecount = 0; GList *plugins, *orig_plugins; orig_plugins = plugins = gst_default_registry_get_plugin_list (); while (plugins) { GList *features, *orig_features; GstPlugin *plugin; plugin = (GstPlugin *) (plugins->data); plugins = g_list_next (plugins); plugincount++; orig_features = features = gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), plugin->desc.name); while (features) { GstPluginFeature *feature; feature = GST_PLUGIN_FEATURE (features->data); featurecount++; if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory; factory = GST_ELEMENT_FACTORY (feature); if (print_all) print_element_info (factory, TRUE); else g_print ("%s: %s: %s\n", plugin->desc.name, GST_PLUGIN_FEATURE_NAME (factory), gst_element_factory_get_longname (factory)); } else if (GST_IS_INDEX_FACTORY (feature)) { GstIndexFactory *factory; factory = GST_INDEX_FACTORY (feature); if (!print_all) g_print ("%s: %s: %s\n", plugin->desc.name, GST_PLUGIN_FEATURE_NAME (factory), factory->longdesc); } else if (GST_IS_TYPE_FIND_FACTORY (feature)) { GstTypeFindFactory *factory; factory = GST_TYPE_FIND_FACTORY (feature); if (!print_all) g_print ("%s: %s: ", plugin->desc.name, gst_plugin_feature_get_name (feature)); if (factory->extensions) { guint i = 0; while (factory->extensions[i]) { if (!print_all) g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]); i++; } if (!print_all) g_print ("\n"); } else { if (!print_all) g_print ("no extensions\n"); } } else { if (!print_all) n_print ("%s: %s (%s)\n", plugin->desc.name, GST_PLUGIN_FEATURE_NAME (feature), g_type_name (G_OBJECT_TYPE (feature))); } features = g_list_next (features); } gst_plugin_feature_list_free (orig_features); } gst_plugin_list_free (orig_plugins); g_print ("\n"); g_print (_("Total count: ")); g_print (ngettext ("%d plugin", "%d plugins", plugincount), plugincount); g_print (", "); g_print (ngettext ("%d feature", "%d features", featurecount), featurecount); g_print ("\n"); }
static void print_plugin_features (GstPlugin * plugin) { GList *features; gint num_features = 0; gint num_elements = 0; gint num_types = 0; gint num_indexes = 0; gint num_other = 0; features = gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), plugin->desc.name); while (features) { GstPluginFeature *feature; feature = GST_PLUGIN_FEATURE (features->data); if (GST_IS_ELEMENT_FACTORY (feature)) { GstElementFactory *factory; factory = GST_ELEMENT_FACTORY (feature); n_print (" %s: %s\n", GST_PLUGIN_FEATURE_NAME (factory), gst_element_factory_get_longname (factory)); num_elements++; } else if (GST_IS_INDEX_FACTORY (feature)) { GstIndexFactory *factory; factory = GST_INDEX_FACTORY (feature); n_print (" %s: %s\n", GST_OBJECT_NAME (factory), factory->longdesc); num_indexes++; } else if (GST_IS_TYPE_FIND_FACTORY (feature)) { GstTypeFindFactory *factory; factory = GST_TYPE_FIND_FACTORY (feature); if (factory->extensions) { guint i = 0; g_print ("%s: %s: ", plugin->desc.name, gst_plugin_feature_get_name (feature)); while (factory->extensions[i]) { g_print ("%s%s", i > 0 ? ", " : "", factory->extensions[i]); i++; } g_print ("\n"); } else g_print ("%s: %s: no extensions\n", plugin->desc.name, gst_plugin_feature_get_name (feature)); num_types++; } else { n_print (" %s (%s)\n", gst_object_get_name (GST_OBJECT (feature)), g_type_name (G_OBJECT_TYPE (feature))); num_other++; } num_features++; features = g_list_next (features); } n_print ("\n"); n_print (" %d features:\n", num_features); if (num_elements > 0) n_print (" +-- %d elements\n", num_elements); if (num_types > 0) n_print (" +-- %d types\n", num_types); if (num_indexes > 0) n_print (" +-- %d indexes\n", num_indexes); if (num_other > 0) n_print (" +-- %d other objects\n", num_other); n_print ("\n"); }