Lv2PluginProvider::Lv2PluginProvider() : m_lv2World(), m_lv2InfoMap() { qDebug( "Initializing Lv2 Plugin Provider" ); if (m_lv2World.world == NULL) { qWarning( "Failed to Initialize slv2_world" ); return; } // Do Lv2-Plugin discovery // slv2_world_load_all( m_world ); // No special path apart from LV2_PATH SLV2Plugins lv2PluginList = slv2_world_get_all_plugins( m_lv2World.world ); size_t lv2PluginListSize = slv2_plugins_size( lv2PluginList ); // TODO-NOW: Allow user to choose multiple paths for (unsigned i=0; i < lv2PluginListSize; ++i) { SLV2Plugin p = slv2_plugins_get_at( lv2PluginList, i ); addLv2Plugin( p ); } qDebug() << "Found" << lv2PluginListSize << "Lv2 plugins."; slv2_plugins_free( m_lv2World.world, lv2PluginList ); qDebug( "Done initializing Lv2 Plugin Provider" ); }
/* search the plugin path */ static gboolean lv2_plugin_discover (void) { unsigned i; SLV2Plugins plugins = slv2_world_get_all_plugins (world); for (i = 0; i < slv2_plugins_size (plugins); ++i) { SLV2Plugin lv2plugin = slv2_plugins_get_at (plugins, i); GTypeInfo typeinfo = { sizeof (GstLV2Class), (GBaseInitFunc) gst_lv2_base_init, NULL, (GClassInitFunc) gst_lv2_class_init, NULL, lv2plugin, sizeof (GstLV2), 0, (GInstanceInitFunc) gst_lv2_init, }; GType type; /* construct the type name from plugin URI */ gchar *type_name = g_strdup_printf ("%s", slv2_value_as_uri (slv2_plugin_get_uri (lv2plugin))); g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-'); /* if it's already registered, drop it */ if (g_type_from_name (type_name)) goto next; /* create the type */ type = g_type_register_static (GST_TYPE_SIGNAL_PROCESSOR, type_name, &typeinfo, 0); /* FIXME: not needed anymore when we can add pad templates, etc in class_init * as class_data contains the LADSPA_Descriptor too */ g_type_set_qdata (type, GST_SLV2_PLUGIN_QDATA, (gpointer) lv2plugin); if (!gst_element_register (gst_lv2_plugin, type_name, GST_RANK_NONE, type)) goto next; next: g_free (type_name); } return TRUE; }