diff options
author | David Robillard <d@drobilla.net> | 2009-06-14 17:18:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-06-14 17:18:12 +0000 |
commit | edf989ee2de5b4644aaa981a165262c0b6438823 (patch) | |
tree | 2bdfe490d94e5cb6bdf29ca8b9fca58138f68fde | |
parent | ebaeb659cd43958f91bd93b29e2e0948f983c05b (diff) | |
download | lilv-edf989ee2de5b4644aaa981a165262c0b6438823.tar.gz lilv-edf989ee2de5b4644aaa981a165262c0b6438823.tar.bz2 lilv-edf989ee2de5b4644aaa981a165262c0b6438823.zip |
Updated lv2 dynamic manifest discovery (still discovery only).
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2103 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/world.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/world.c b/src/world.c index f0022ed..2c0bc8d 100644 --- a/src/world.c +++ b/src/world.c @@ -208,9 +208,12 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri) manifest_model); #ifdef SLV2_DYN_MANIFEST + LV2_Dyn_Manifest_Handle handle = NULL; + const LV2_Dyn_Manifest_Feature* const features = { NULL }; + const unsigned char* const query_str = (const unsigned char* const) "PREFIX : <http://lv2plug.in/ns/lv2core#>\n" - "PREFIX dynman: <http://naspro.atheme.org/rdf/dman#>\n" + "PREFIX dynman: <http://lv2plug.in/ns/ext/dynmanifest#>\n" "SELECT DISTINCT ?dynman ?binary WHERE {\n" "?dynman a dynman:DynManifest ;\n" " :binary ?binary .\n" @@ -228,14 +231,24 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri) if (lib_path) { void* lib = dlopen(lib_path, RTLD_NOW); - typedef int (*DynManifestGetFunc)(FILE*); - DynManifestGetFunc func = (DynManifestGetFunc)dlsym(lib, "lv2_dyn_manifest_write"); - if (func) { + + // Open dynamic manifest + typedef int (*OpenFunc)(LV2_Dyn_Manifest_Handle*, + const LV2_Dyn_Manifest_Feature *const *); + OpenFunc open_func = (OpenFunc)dlsym(lib, "lv2_dyn_manifest_open"); + open_func(&handle, &features); + + // Get subjects (what would be in the manifest) + typedef int (*GetSubjectsFunc)(LV2_Dyn_Manifest_Handle, FILE*); + GetSubjectsFunc get_subjects_func = (GetSubjectsFunc)dlsym(lib, + "lv2_dyn_manifest_get_subjects"); + if (get_subjects_func) { printf("DYNAMIC MANIFEST <%s> @ <%s> {\n", librdf_uri_as_string(librdf_node_get_uri(dynman_node)), librdf_uri_as_string(librdf_node_get_uri(binary_node))); - FILE* dyn_manifest = tmpfile(); - func(dyn_manifest); + //FILE* dyn_manifest = tmpfile(); + FILE* dyn_manifest = fopen("/tmp/naspro.ttl", "w+"); + get_subjects_func(handle, dyn_manifest); rewind(dyn_manifest); librdf_parser_parse_file_handle_into_model(world->parser, dyn_manifest, 0, manifest_uri, manifest_model); @@ -249,7 +262,7 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri) } librdf_free_query_results(query_results); librdf_free_query(query); -#endif +#endif // SLV2_DYN_MANIFEST /* ?plugin a lv2:Plugin */ librdf_statement* q = librdf_new_statement_from_nodes(world->world, |