From d175e2de6d3b51dfa1af5ea95bdad6e8c97df795 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 27 Feb 2012 23:30:54 +0000 Subject: Implement lv2:relation. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4002 a436a847-0d15-0410-975c-d299462d15a1 --- src/plugin.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/plugin.c') 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) { @@ -610,6 +609,31 @@ lilv_plugin_get_port_by_property(const LilvPlugin* plugin, return NULL; } +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) -- cgit v1.2.1