diff options
author | David Robillard <d@drobilla.net> | 2011-11-11 23:10:03 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-11-11 23:10:03 +0000 |
commit | 588cc25cc9c80ba8b1aafe5f65746d80f9ef54a5 (patch) | |
tree | faf9c2025e26ed0e1ddf3cc556a9cb39c2b187d2 /src | |
parent | 9370aabc30ac2498b499eac4c26d3580f5ecddfa (diff) | |
download | lilv-588cc25cc9c80ba8b1aafe5f65746d80f9ef54a5.tar.gz lilv-588cc25cc9c80ba8b1aafe5f65746d80f9ef54a5.tar.bz2 lilv-588cc25cc9c80ba8b1aafe5f65746d80f9ef54a5.zip |
Add lilv_plugin_has_extension_data.
Add tests for extension data functions.
Tolerate (ignore) plugins with broken data with "gaps" in port indices.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3611 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/plugin.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/plugin.c b/src/plugin.c index 9fba6f4..88732d1 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -268,6 +268,17 @@ lilv_plugin_load_ports_if_necessary(const LilvPlugin* const_p) } } lilv_match_end(ports); + + // Check sanity + for (uint32_t i = 0; i < p->num_ports; ++i) { + if (!p->ports[i]) { + LILV_ERRORF("Plugin <%s> is missing port %d/%d\n", + lilv_node_as_uri(p->plugin_uri), i, p->num_ports); + free(p->ports); + p->ports = NULL; + p->num_ports = 0; + } + } } } @@ -645,6 +656,30 @@ lilv_plugin_get_required_features(const LilvPlugin* p) } LILV_API +bool +lilv_plugin_has_extension_data(const LilvPlugin* p, + const LilvNode* uri) +{ + if (!lilv_node_is_uri(uri)) { + LILV_ERRORF("Extension data `%s' is not a URI\n", uri->str_val); + return false; + } + + SordIter* iter = lilv_world_query_internal( + p->world, + p->plugin_uri->val.uri_val, + p->world->lv2_extensionData_val->val.uri_val, + uri->val.uri_val); + + if (iter) { + sord_iter_free(iter); + return true; + } else { + return false; + } +} + +LILV_API LilvNodes* lilv_plugin_get_extension_data(const LilvPlugin* p) { |