summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/plugin.c16
2 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 38eaa25..38c60b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ slv2 (9999) unstable; urgency=low
* NOT YET RELEASED
* Add slv2_port_get_value (analogous to slv2_plugin_get_value).
* Add slv2_instance_get_extension_data.
+ * Fix slv2_plugin_get_supported_features (previously non-functional).
-- Dave Robillard <dave@drobilla.net> Sun, 01 Jan 9999 00:00:00 -0400
diff --git a/src/plugin.c b/src/plugin.c
index cb98d69..25ddd5c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -663,14 +663,26 @@ slv2_plugin_has_feature(SLV2Plugin p,
SLV2Values
slv2_plugin_get_supported_features(SLV2Plugin p)
{
- const char* const query =
+ /* Work around broken UNION in Redland :( */
+ /*const char* const query =
"SELECT DISTINCT ?feature WHERE {\n"
" { <> lv2:optionalFeature ?feature }\n"
" UNION\n"
" { <> lv2:requiredFeature ?feature }\n"
"}\n";
+
+ SLV2Values result = slv2_plugin_query_variable(p, query, 0);*/
- SLV2Values result = slv2_plugin_query_variable(p, query, 0);
+ SLV2Values optional = slv2_plugin_get_optional_features(p);
+ SLV2Values required = slv2_plugin_get_required_features(p);
+
+ SLV2Values result = slv2_values_new();
+ unsigned n_optional = slv2_values_size(optional);
+ unsigned i = 0;
+ for ( ; i < n_optional; ++i)
+ slv2_values_set_at(result, i, slv2_values_get_at(optional, i));
+ for ( ; i < n_optional + slv2_values_size(required); ++i)
+ slv2_values_set_at(result, i, slv2_values_get_at(required, i - n_optional));
return result;
}