diff options
author | David Robillard <d@drobilla.net> | 2012-02-27 23:30:54 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-02-27 23:30:54 +0000 |
commit | d175e2de6d3b51dfa1af5ea95bdad6e8c97df795 (patch) | |
tree | c074ce18bfd52b18d374fb5c59a1369a65576f2e /src | |
parent | 72e3c06d3a6b2558e5e156f917e1c28441819417 (diff) | |
download | lilv-d175e2de6d3b51dfa1af5ea95bdad6e8c97df795.tar.gz lilv-d175e2de6d3b51dfa1af5ea95bdad6e8c97df795.tar.bz2 lilv-d175e2de6d3b51dfa1af5ea95bdad6e8c97df795.zip |
Implement lv2:relation.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4002 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/lilv_internal.h | 1 | ||||
-rw-r--r-- | src/plugin.c | 28 | ||||
-rw-r--r-- | src/world.c | 1 |
3 files changed, 28 insertions, 2 deletions
diff --git a/src/lilv_internal.h b/src/lilv_internal.h index 18aaed5..a6d53f7 100644 --- a/src/lilv_internal.h +++ b/src/lilv_internal.h @@ -150,6 +150,7 @@ struct LilvWorldImpl { SordNode* lv2_Plugin; SordNode* lv2_port; SordNode* lv2_portProperty; + SordNode* lv2_relation; SordNode* lv2_reportsLatency; SordNode* lv2_requiredFeature; SordNode* lv2_Specification; diff --git a/src/plugin.c b/src/plugin.c index c6d36a7..df113a0 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -585,8 +585,7 @@ lilv_plugin_has_latency(const LilvPlugin* p) return ret; } -LILV_API -LilvPort* +static LilvPort* lilv_plugin_get_port_by_property(const LilvPlugin* plugin, const LilvNode* port_property) { @@ -611,6 +610,31 @@ lilv_plugin_get_port_by_property(const LilvPlugin* plugin, } LILV_API +LilvPort* +lilv_plugin_get_port_by_relation(const LilvPlugin* plugin, + const LilvNode* relation) +{ + lilv_plugin_load_ports_if_necessary(plugin); + for (uint32_t i = 0; i < plugin->num_ports; ++i) { + LilvPort* port = plugin->ports[i]; + SordIter* iter = lilv_world_query_internal( + plugin->world, + port->node, + plugin->world->uris.lv2_relation, + relation->val.uri_val); + + const bool found = !lilv_matches_end(iter); + lilv_match_end(iter); + + if (found) { + return port; + } + } + + return NULL; +} + +LILV_API uint32_t lilv_plugin_get_latency_port_index(const LilvPlugin* p) { diff --git a/src/world.c b/src/world.c index 28a58c5..198a02a 100644 --- a/src/world.c +++ b/src/world.c @@ -62,6 +62,7 @@ lilv_world_new(void) world->uris.lv2_Plugin = NEW_URI(LILV_NS_LV2 "Plugin"); world->uris.lv2_port = NEW_URI(LILV_NS_LV2 "port"); world->uris.lv2_portProperty = NEW_URI(LILV_NS_LV2 "portProperty"); + world->uris.lv2_relation = NEW_URI(LILV_NS_LV2 "relation"); world->uris.lv2_reportsLatency = NEW_URI(LILV_NS_LV2 "reportsLatency"); world->uris.lv2_requiredFeature = NEW_URI(LILV_NS_LV2 "requiredFeature"); world->uris.lv2_Specification = NEW_URI(LILV_NS_LV2 "Specification"); |