summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-03-06 18:58:57 +0100
committerDavid Robillard <d@drobilla.net>2017-03-06 18:58:57 +0100
commit4dcdf46bf1a221ff8d2fa01a95dff43057ee6437 (patch)
tree232e2d0a348fbc4cc6dd755f64788cb85e50ef5a
parent112061493cae8a669df359fa929dfd3ff87d7d0e (diff)
downloadlilv-4dcdf46bf1a221ff8d2fa01a95dff43057ee6437.tar.gz
lilv-4dcdf46bf1a221ff8d2fa01a95dff43057ee6437.tar.bz2
lilv-4dcdf46bf1a221ff8d2fa01a95dff43057ee6437.zip
Fix lv2bench for some plugins with sequence ports
-rw-r--r--NEWS3
-rw-r--r--utils/lv2bench.c19
2 files changed, 19 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index fa3f424..3d04427 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,12 @@
lilv (0.24.3) unstable;
+ * Fix lv2bench for some plugins with sequence ports
* Gracefully handle plugins with missing binary URIs
* Remove use of deprecated readdir_r
* Install Python bindings when configured without tests
(thanks Clement Skau)
- -- David Robillard <d@drobilla.net> Mon, 06 Mar 2017 18:57:09 +0100
+ -- David Robillard <d@drobilla.net> Mon, 06 Mar 2017 18:58:42 +0100
lilv (0.24.2) stable;
diff --git a/utils/lv2bench.c b/utils/lv2bench.c
index 02f6e4e..5f293b4 100644
--- a/utils/lv2bench.c
+++ b/utils/lv2bench.c
@@ -82,11 +82,16 @@ bench(const LilvPlugin* p, uint32_t sample_count, uint32_t block_size)
return 0.0;
}
- LV2_Atom_Sequence seq = {
+ const size_t atom_capacity = 1024;
+
+ LV2_Atom_Sequence seq_in = {
{ sizeof(LV2_Atom_Sequence_Body),
uri_table_map(&uri_table, LV2_ATOM__Sequence) },
{ 0, 0 } };
+ LV2_Atom_Sequence* seq_out = (LV2_Atom_Sequence*)malloc(
+ sizeof(LV2_Atom_Sequence) + atom_capacity);
+
const char* uri = lilv_node_as_string(lilv_plugin_get_uri(p));
LilvNodes* required = lilv_plugin_get_required_features(p);
LILV_FOREACH(nodes, i, required) {
@@ -134,7 +139,11 @@ bench(const LilvPlugin* p, uint32_t sample_count, uint32_t block_size)
return 0.0;
}
} else if (lilv_port_is_a(p, port, atom_AtomPort)) {
- lilv_instance_connect_port(instance, index, &seq);
+ if (lilv_port_is_a(p, port, lv2_InputPort)) {
+ lilv_instance_connect_port(instance, index, &seq_in);
+ } else {
+ lilv_instance_connect_port(instance, index, seq_out);
+ }
} else {
fprintf(stderr, "<%s> port %d has unknown type, skipping\n",
uri, index);
@@ -150,12 +159,18 @@ bench(const LilvPlugin* p, uint32_t sample_count, uint32_t block_size)
struct timespec ts = bench_start();
for (uint32_t i = 0; i < (sample_count / block_size); ++i) {
+ seq_in.atom.size = sizeof(LV2_Atom_Sequence_Body);
+ seq_in.atom.type = uri_table_map(&uri_table, LV2_ATOM__Sequence);
+ seq_out->atom.size = atom_capacity;
+ seq_out->atom.type = uri_table_map(&uri_table, LV2_ATOM__Chunk);
+
lilv_instance_run(instance, block_size);
}
const double elapsed = bench_end(&ts);
lilv_instance_deactivate(instance);
lilv_instance_free(instance);
+ free(seq_out);
uri_table_destroy(&uri_table);