summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-03-05 19:43:20 +0000
committerDavid Robillard <d@drobilla.net>2010-03-05 19:43:20 +0000
commitd8437709d6f69b4952993a6794313edb38361a53 (patch)
treedcae2a8475c3c8e90b3f8be776f2724aa4f2f400
parent4a901350fa4e786562a9c8f14446e3fa10678454 (diff)
downloadlilv-d8437709d6f69b4952993a6794313edb38361a53.tar.gz
lilv-d8437709d6f69b4952993a6794313edb38361a53.tar.bz2
lilv-d8437709d6f69b4952993a6794313edb38361a53.zip
Parse all files with correct base URI.
Support relative URIs returned from lv2_descriptor. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2529 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--ChangeLog7
-rw-r--r--src/plugin.c2
-rw-r--r--src/plugininstance.c38
-rw-r--r--src/world.c6
-rw-r--r--wscript5
5 files changed, 37 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index ebce3c9..b084e9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+slv2 (0.6.7) unstable; urgency=low
+ * Parse all files with their own URI as a base URI (allowing proper
+ reference to other things in the same bundle)
+ * Support relative URIs returned from lv2_descriptor in libraries
+
+ -- Dave Robillard <dave@drobilla.net> ?
+
slv2 (0.6.6) unstable; urgency=low
* Add manual pages for utilities
diff --git a/src/plugin.c b/src/plugin.c
index e6718ee..0be7c52 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -218,7 +218,7 @@ slv2_plugin_load(SLV2Plugin p)
for (unsigned i=0; i < slv2_values_size(p->data_uris); ++i) {
SLV2Value data_uri_val = slv2_values_get_at(p->data_uris, i);
librdf_uri* data_uri = slv2_value_as_librdf_uri(data_uri_val);
- librdf_parser_parse_into_model(p->world->parser, data_uri, NULL, p->rdf);
+ librdf_parser_parse_into_model(p->world->parser, data_uri, data_uri, p->rdf);
}
#ifdef SLV2_DYN_MANIFEST
diff --git a/src/plugininstance.c b/src/plugininstance.c
index 2089951..37d55aa 100644
--- a/src/plugininstance.c
+++ b/src/plugininstance.c
@@ -67,7 +67,6 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
} else {
// Search for plugin by URI
- // FIXME: Kludge to get bundle path (containing directory of binary)
const char* bundle_path = slv2_uri_to_path(slv2_value_as_uri(
slv2_plugin_get_bundle_uri(plugin)));
@@ -80,20 +79,29 @@ slv2_plugin_instantiate(SLV2Plugin plugin,
slv2_value_as_uri(slv2_plugin_get_uri(plugin)), lib_path);
dlclose(lib);
break; // return NULL
- } else if (!strcmp(ld->URI, slv2_value_as_uri(slv2_plugin_get_uri(plugin)))) {
- assert(plugin->plugin_uri);
- assert(ld->instantiate);
-
- // Create SLV2Instance to return
- result = malloc(sizeof(struct _Instance));
- result->lv2_descriptor = ld;
- result->lv2_handle = ld->instantiate(ld, sample_rate, (char*)bundle_path,
- (features) ? features : local_features);
- struct _InstanceImpl* impl = malloc(sizeof(struct _InstanceImpl));
- impl->lib_handle = lib;
- result->pimpl = impl;
-
- break;
+ } else {
+ librdf_uri* absolute_uri = librdf_new_uri_relative_to_base(
+ slv2_value_as_librdf_uri(slv2_plugin_get_bundle_uri(plugin)),
+ (const unsigned char*)ld->URI);
+ if (!strcmp((const char*)librdf_uri_as_string(absolute_uri),
+ slv2_value_as_uri(slv2_plugin_get_uri(plugin)))) {
+ assert(plugin->plugin_uri);
+ assert(ld->instantiate);
+
+ // Create SLV2Instance to return
+ result = malloc(sizeof(struct _Instance));
+ result->lv2_descriptor = ld;
+ result->lv2_handle = ld->instantiate(ld, sample_rate, (char*)bundle_path,
+ (features) ? features : local_features);
+ struct _InstanceImpl* impl = malloc(sizeof(struct _InstanceImpl));
+ impl->lib_handle = lib;
+ result->pimpl = impl;
+
+ librdf_free_uri(absolute_uri);
+ break;
+ } else {
+ librdf_free_uri(absolute_uri);
+ }
}
}
}
diff --git a/src/world.c b/src/world.c
index 35d006f..32ebd31 100644
--- a/src/world.c
+++ b/src/world.c
@@ -182,7 +182,7 @@ slv2_world_free(SLV2World world)
void
slv2_world_load_file(SLV2World world, librdf_uri* file_uri)
{
- librdf_parser_parse_into_model(world->parser, file_uri, NULL, world->model);
+ librdf_parser_parse_into_model(world->parser, file_uri, file_uri, world->model);
}
@@ -203,8 +203,8 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri)
librdf_model* manifest_model = librdf_new_model(world->world,
manifest_storage, NULL);
- librdf_parser_parse_into_model(world->parser, manifest_uri, NULL,
- manifest_model);
+ librdf_parser_parse_into_model(world->parser, manifest_uri,
+ manifest_uri, manifest_model);
#ifdef SLV2_DYN_MANIFEST
typedef void* LV2_Dyn_Manifest_Handle;
diff --git a/wscript b/wscript
index 5ad02eb..9270c17 100644
--- a/wscript
+++ b/wscript
@@ -3,7 +3,7 @@ import autowaf
import Options
# Version of this package (even if built as a child)
-SLV2_VERSION = '0.6.6'
+SLV2_VERSION = '0.6.7'
# Library version (UNIX style major, minor, micro)
# major increment <=> incompatible changes
@@ -28,7 +28,8 @@ SLV2_VERSION = '0.6.6'
# 0.6.2 = 9,1,1
# 0.6.4 = 9,2,0
# 0.6.6 = 9,2,0
-SLV2_LIB_VERSION = '9.2.0'
+# 0.6.7 = 9,2,1
+SLV2_LIB_VERSION = '9.2.1'
# Variables for 'waf dist'
APPNAME = 'slv2'