Remove support for the long-deprecated LV2 uri-map extension

This has been supplanted by the urid extension.
This commit is contained in:
David Robillard 2020-07-08 20:53:37 +02:00
parent 3c85fe252a
commit 80a22953b0
3 changed files with 7 additions and 39 deletions

View File

@ -28,14 +28,13 @@
#include <glibmm/threads.h>
#include "lv2.h"
#include "lv2/lv2plug.in/ns/ext/uri-map/uri-map.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include "ardour/libardour_visibility.h"
namespace ARDOUR {
/** Implementation of the LV2 uri-map and urid extensions.
/** Implementation of the LV2 urid extension.
*
* This just uses a pair of std::map and is not so great in the space overhead
* department, but it's fast enough and not really performance critical anyway.
@ -46,7 +45,6 @@ public:
URIMap();
LV2_Feature* uri_map_feature() { return &_uri_map_feature; }
LV2_Feature* urid_map_feature() { return &_urid_map_feature; }
LV2_Feature* urid_unmap_feature() { return &_urid_unmap_feature; }
@ -107,8 +105,6 @@ private:
Map _map;
Unmap _unmap;
LV2_Feature _uri_map_feature;
LV2_URI_Map_Feature _uri_map_feature_data;
LV2_Feature _urid_map_feature;
LV2_URID_Map _urid_map_feature_data;
LV2_Feature _urid_unmap_feature;

View File

@ -496,12 +496,11 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
_features[0] = &_instance_access_feature;
_features[1] = &_data_access_feature;
_features[2] = &_make_path_feature;
_features[3] = _uri_map.uri_map_feature();
_features[4] = _uri_map.urid_map_feature();
_features[5] = _uri_map.urid_unmap_feature();
_features[6] = &_log_feature;
_features[3] = _uri_map.urid_map_feature();
_features[4] = _uri_map.urid_unmap_feature();
_features[5] = &_log_feature;
unsigned n_features = 7;
unsigned n_features = 6;
_features[n_features++] = &_def_state_feature;
lv2_atom_forge_init(&_impl->forge, _uri_map.urid_map());
@ -2867,7 +2866,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
*/
else if (atom->type == _uri_map.urids.atom_Blank ||
atom->type == _uri_map.urids.atom_Object) {
LV2_Atom_Object* obj = (LV2_Atom_Object*)atom;
const LV2_Atom_Object* obj = (const LV2_Atom_Object*)atom;
if (obj->body.otype == _uri_map.urids.patch_Set) {
const LV2_Atom* property = NULL;
const LV2_Atom* value = NULL;
@ -3083,7 +3082,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
_property_values[prop_id] = Variant(Variant::PATH, path);
}
if (value->type == _uri_map.urids.atom_Float) {
const float* val = (float*)LV2_ATOM_BODY_CONST(value);
const float* val = (const float*)LV2_ATOM_BODY_CONST(value);
_property_values[prop_id] = Variant(Variant::FLOAT, *val);
}
// TODO add support for other props (Int, Bool, ..)

View File

@ -85,28 +85,6 @@ URIMap::instance()
return *URIMap::uri_map;
}
static uint32_t
c_uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data,
const char* map,
const char* uri)
{
URIMap* const me = (URIMap*)callback_data;
const uint32_t id = me->uri_to_id(uri);
/* The event context with the uri-map extension guarantees a value in the
range of uint16_t. Ardour used to map to a separate range to achieve
this, but unfortunately some plugins are broken and use the incorrect
context. To compensate, we simply use the same context for everything
and hope that anything in the event context gets mapped before
UINT16_MAX is reached (which will be fine unless something seriously
weird is going on). If this fails there is nothing we can do, die.
*/
assert(!map || strcmp(map, "http://lv2plug.in/ns/ext/event")
|| id < UINT16_MAX);
return id;
}
static LV2_URID
c_urid_map(LV2_URID_Map_Handle handle,
const char* uri)
@ -125,11 +103,6 @@ c_urid_unmap(LV2_URID_Unmap_Handle handle,
URIMap::URIMap()
{
_uri_map_feature_data.uri_to_id = c_uri_map_uri_to_id;
_uri_map_feature_data.callback_data = this;
_uri_map_feature.URI = LV2_URI_MAP_URI;
_uri_map_feature.data = &_uri_map_feature_data;
_urid_map_feature_data.map = c_urid_map;
_urid_map_feature_data.handle = this;
_urid_map_feature.URI = LV2_URID_MAP_URI;