aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-09-30 22:05:57 +0000
committerDavid Robillard <d@drobilla.net>2012-09-30 22:05:57 +0000
commitf4712be632b28d3078fed22f845c1d3eae1f3ad0 (patch)
tree01430e38317fec3271d97eee003cf755cd303a9f
parent72886d138d8365d3ccd68e7dc0cec9ebd6ce8533 (diff)
downloadjalv-f4712be632b28d3078fed22f845c1d3eae1f3ad0.tar.gz
jalv-f4712be632b28d3078fed22f845c1d3eae1f3ad0.tar.bz2
jalv-f4712be632b28d3078fed22f845c1d3eae1f3ad0.zip
Refuse to instantiate plugins which require unsupported features.
Support LV2 buf-size extension (with all features). git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@4796 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--NEWS2
-rw-r--r--src/jalv.c34
2 files changed, 35 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index cd37a43..f417d7c 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ jalv (9999) unstable;
* Tolerate loading presets with port values that aren't xsd:decimal
* Notify plugins of Jack transport changes by sending events (an atom:Blank
with properties from the LV2 time extension)
+ * Refuse to instantiate plugins which require unsupported features
+ * Support LV2 buf-size extension (with all features)
* Add Gtk3 UI
* Port to Windows
* Fix Jack Session support
diff --git a/src/jalv.c b/src/jalv.c
index f4bb680..b88f1e3 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -121,15 +121,36 @@ static LV2_Feature schedule_feature = { LV2_WORKER__schedule, NULL };
static LV2_Feature log_feature = { LV2_LOG__log, NULL };
static LV2_Feature options_feature = { LV2_OPTIONS__options, NULL };
-const LV2_Feature* features[9] = {
+/** These features have no data */
+static LV2_Feature buf_size_features[3] = {
+ { LV2_BUF_SIZE__powerOf2BlockLength, NULL },
+ { LV2_BUF_SIZE__fixedBlockLength, NULL },
+ { LV2_BUF_SIZE__boundedBlockLength, NULL } };
+
+const LV2_Feature* features[12] = {
&uri_map_feature, &map_feature, &unmap_feature,
&make_path_feature,
&schedule_feature,
&log_feature,
&options_feature,
+ &buf_size_features[0],
+ &buf_size_features[1],
+ &buf_size_features[2],
NULL
};
+/** Return true iff Jalv supports the given feature. */
+static bool
+feature_is_supported(const char* uri)
+{
+ for (const LV2_Feature*const* f = features; *f; ++f) {
+ if (!strcmp(uri, (*f)->URI)) {
+ return true;
+ }
+ }
+ return false;
+}
+
/** Abort and exit on error */
static void
die(const char* msg)
@@ -865,6 +886,17 @@ main(int argc, char** argv)
return EXIT_FAILURE;
}
+ /* Check that any required features are supported */
+ LilvNodes* req_feats = lilv_plugin_get_required_features(jalv.plugin);
+ LILV_FOREACH(nodes, f, req_feats) {
+ const char* uri = lilv_node_as_uri(lilv_nodes_get(req_feats, f));
+ if (!feature_is_supported(uri)) {
+ fprintf(stderr, "Feature %s is not supported\n", uri);
+ lilv_world_free(world);
+ return EXIT_FAILURE;
+ }
+ }
+
/* Get a plugin UI */
const char* native_ui_type_uri = jalv_native_ui_type(&jalv);
if (!jalv.opts.generic_ui && native_ui_type_uri) {