diff options
author | David Robillard <d@drobilla.net> | 2012-05-27 23:05:45 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-27 23:05:45 +0000 |
commit | 3696f98e6f1ac44f8ebfe975405cf82f6d0f8a72 (patch) | |
tree | f9730df592b31d3660aecf7639643921f6c315a1 /libs/ardour/ardour/uri_map.h | |
parent | 0b210042525b216acbbef2d10be99ffe5600c7c1 (diff) |
Re-implement URIMap to tolerate broken plugins that use the wrong context to
map MIDI event types (fix #4889).
All uri-map contexts are now just ignored, and equivalent to urid (which is
equivalent to uri-map with context NULL). We now just hope that no event types
are mapped after UINT16_MAX URIs have been mapped, and die horribly otherwise.
This is exceedingly unlikely to happen any time in the next several years, if
ever.
git-svn-id: svn://localhost/ardour2/branches/3.0@12462 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/uri_map.h')
-rw-r--r-- | libs/ardour/ardour/uri_map.h | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/libs/ardour/ardour/uri_map.h b/libs/ardour/ardour/uri_map.h index a6c9dc7a8b..18008f0df2 100644 --- a/libs/ardour/ardour/uri_map.h +++ b/libs/ardour/ardour/uri_map.h @@ -30,8 +30,10 @@ namespace ARDOUR { - /** Implementation of the LV2 uri-map and urid extensions. + * + * 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. */ class URIMap : public boost::noncopyable { public: @@ -44,26 +46,15 @@ public: LV2_URID_Map* urid_map() { return &_urid_map_feature_data; } LV2_URID_Unmap* urid_unmap() { return &_urid_unmap_feature_data; } - uint32_t uri_to_id(const char* map, const char* uri); - - const char* id_to_uri(const char* map, uint32_t id); + uint32_t uri_to_id(const char* uri); + const char* id_to_uri(uint32_t id) const; private: - static uint32_t uri_map_uri_to_id(LV2_URI_Map_Callback_Data callback_data, - const char* map, - const char* uri); - - static LV2_URID urid_map(LV2_URID_Map_Handle handle, - const char* uri); + typedef std::map<const std::string, uint32_t> Map; + typedef std::map<uint32_t, const std::string> Unmap; - static const char* urid_unmap(LV2_URID_Unmap_Handle handle, - LV2_URID urid); - - typedef std::map<uint16_t, uint32_t> EventToGlobal; - typedef std::map<uint32_t, uint16_t> GlobalToEvent; - - EventToGlobal _event_to_global; - GlobalToEvent _global_to_event; + Map _map; + Unmap _unmap; LV2_Feature _uri_map_feature; LV2_URI_Map_Feature _uri_map_feature_data; @@ -73,7 +64,6 @@ private: LV2_URID_Unmap _urid_unmap_feature_data; }; - } // namespace ARDOUR #endif // __ardour_uri_map_h__ |