diff options
-rw-r--r-- | lilv/lilvmm.hpp | 2 | ||||
-rw-r--r-- | src/instance.c | 66 | ||||
-rw-r--r-- | src/world.c | 6 |
3 files changed, 37 insertions, 37 deletions
diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp index 5123a42..71f1a24 100644 --- a/lilv/lilvmm.hpp +++ b/lilv/lilvmm.hpp @@ -127,7 +127,7 @@ struct Nodes { LILV_WRAP_COLL(Nodes, Node, nodes); LILV_WRAP1(bool, nodes, contains, const Node, node); }; - + struct Port { inline Port(const LilvPlugin* p, const LilvPort* c_obj) : parent(p), me(c_obj) diff --git a/src/instance.c b/src/instance.c index c3dcb00..b12a7d3 100644 --- a/src/instance.c +++ b/src/instance.c @@ -72,40 +72,40 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, lib_path); dlclose(lib); break; // return NULL + } + + // Parse bundle URI to use as base URI + const LilvNode* bundle_uri = lilv_plugin_get_bundle_uri(plugin); + const char* bundle_uri_str = lilv_node_as_uri(bundle_uri); + SerdURI base_uri; + if (serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) { + dlclose(lib); + break; + } + + // Resolve library plugin URI against base URI + SerdURI abs_uri; + SerdNode abs_uri_node = serd_node_new_uri_from_string( + (const uint8_t*)ld->URI, &base_uri, &abs_uri); + if (!abs_uri_node.buf) { + LILV_ERRORF("Failed to parse plugin URI `%s'\n", ld->URI); + dlclose(lib); + break; + } + + if (!strcmp((const char*)abs_uri_node.buf, + lilv_node_as_uri(lilv_plugin_get_uri(plugin)))) { + // Create LilvInstance to return + result = malloc(sizeof(struct LilvInstanceImpl)); + result->lv2_descriptor = ld; + result->lv2_handle = ld->instantiate( + ld, sample_rate, (char*)bundle_path, + (features) ? features : local_features); + result->pimpl = lib; + serd_node_free(&abs_uri_node); + break; } else { - // Parse bundle URI to use as base URI - const LilvNode* bundle_uri = lilv_plugin_get_bundle_uri(plugin); - const char* bundle_uri_str = lilv_node_as_uri(bundle_uri); - SerdURI base_uri; - if (serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) { - dlclose(lib); - break; - } - - // Resolve library plugin URI against base URI - SerdURI abs_uri; - SerdNode abs_uri_node = serd_node_new_uri_from_string( - (const uint8_t*)ld->URI, &base_uri, &abs_uri); - if (!abs_uri_node.buf) { - LILV_ERRORF("Failed to parse plugin URI `%s'\n", ld->URI); - dlclose(lib); - break; - } - - if (!strcmp((const char*)abs_uri_node.buf, - lilv_node_as_uri(lilv_plugin_get_uri(plugin)))) { - // Create LilvInstance to return - result = malloc(sizeof(struct LilvInstanceImpl)); - result->lv2_descriptor = ld; - result->lv2_handle = ld->instantiate( - ld, sample_rate, (char*)bundle_path, - (features) ? features : local_features); - result->pimpl = lib; - serd_node_free(&abs_uri_node); - break; - } else { - serd_node_free(&abs_uri_node); - } + serd_node_free(&abs_uri_node); } } } diff --git a/src/world.c b/src/world.c index dc3c5b0..bbf1dab 100644 --- a/src/world.c +++ b/src/world.c @@ -332,7 +332,7 @@ lilv_world_add_plugin(LilvWorld* world, const SordNode* dyn_manifest_lib, const SordNode* bundle_node) { - LilvNode* plugin_uri = lilv_node_new_from_node(world, plugin_node); + LilvNode* plugin_uri = lilv_node_new_from_node(world, plugin_node); const LilvPlugin* last = lilv_plugins_get_by_uri(world->plugins, plugin_uri); if (last) { @@ -740,8 +740,8 @@ lilv_world_load_plugin_classes(LilvWorld* world) continue; } - const SordNode* label_node = lilv_match_object(labels); - const uint8_t* label = (const uint8_t*)sord_node_get_string(label_node); + const SordNode* label_node = lilv_match_object(labels); + const uint8_t* label = sord_node_get_string(label_node); lilv_match_end(labels); LilvPluginClasses* classes = world->plugin_classes; |