summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-27 23:30:54 +0000
committerDavid Robillard <d@drobilla.net>2012-02-27 23:30:54 +0000
commitd175e2de6d3b51dfa1af5ea95bdad6e8c97df795 (patch)
treec074ce18bfd52b18d374fb5c59a1369a65576f2e /src/plugin.c
parent72e3c06d3a6b2558e5e156f917e1c28441819417 (diff)
downloadlilv-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/plugin.c')
-rw-r--r--src/plugin.c28
1 files changed, 26 insertions, 2 deletions
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)
{