13
0

lilv-backwards compatible min buffer-size implementation

This commit is contained in:
Robin Gareus 2013-06-03 19:34:14 +02:00
parent 1ee8f5c2e4
commit cc8dafad4f

View File

@ -445,13 +445,12 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
flags |= PORT_POSITION; flags |= PORT_POSITION;
} }
} }
#ifdef HAVE_NEW_LV2 LilvNodes* min_size_v = lilv_port_get_value(_impl->plugin, port, _world.rsz_minimumSize);
LilvNode* min_size = lilv_port_get(_impl->plugin, port, _world.rsz_minimumSize); LilvNode* min_size = min_size_v ? lilv_nodes_get_first(min_size_v) : NULL;
if (min_size && lilv_node_is_int(min_size)) { if (min_size && lilv_node_is_int(min_size)) {
minimumSize = lilv_node_as_int(min_size); minimumSize = lilv_node_as_int(min_size);
} }
lilv_node_free(min_size); lilv_nodes_free(min_size_v);
#endif
lilv_nodes_free(buffer_types); lilv_nodes_free(buffer_types);
lilv_nodes_free(atom_supports); lilv_nodes_free(atom_supports);
} else { } else {
@ -1437,13 +1436,12 @@ LV2Plugin::allocate_atom_event_buffers()
if (lilv_port_is_a(p, port, _world.lv2_OutputPort)) { if (lilv_port_is_a(p, port, _world.lv2_OutputPort)) {
count_atom_out++; count_atom_out++;
} }
#ifdef HAVE_NEW_LV2 LilvNodes* min_size_v = lilv_port_get_value(_impl->plugin, port, _world.rsz_minimumSize);
LilvNode* min_size = lilv_port_get(_impl->plugin, port, _world.rsz_minimumSize); LilvNode* min_size = min_size_v ? lilv_nodes_get_first(min_size_v) : NULL;
if (min_size && lilv_node_is_int(min_size)) { if (min_size && lilv_node_is_int(min_size)) {
minimumSize = std::max(minimumSize, lilv_node_as_int(min_size)); minimumSize = std::max(minimumSize, lilv_node_as_int(min_size));
} }
lilv_node_free(min_size); lilv_nodes_free(min_size_v);
#endif
} }
lilv_nodes_free(buffer_types); lilv_nodes_free(buffer_types);
lilv_nodes_free(atom_supports); lilv_nodes_free(atom_supports);