Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
4.2KB

  1. /*
  2. Copyright 2008-2016 David Robillard <http://drobilla.net>
  3. Copyright 2011 Gabriel M. Beddingfield <gabrbedd@gmail.com>
  4. Permission to use, copy, modify, and/or distribute this software for any
  5. purpose with or without fee is hereby granted, provided that the above
  6. copyright notice and this permission notice appear in all copies.
  7. THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  10. ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  12. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  13. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  14. */
  15. /**
  16. @defgroup urid URID
  17. Features for mapping URIs to and from integers, see
  18. <http://lv2plug.in/ns/ext/urid> for details.
  19. @{
  20. */
  21. #ifndef LV2_URID_H
  22. #define LV2_URID_H
  23. #define LV2_URID_URI "http://lv2plug.in/ns/ext/urid" ///< http://lv2plug.in/ns/ext/urid
  24. #define LV2_URID_PREFIX LV2_URID_URI "#" ///< http://lv2plug.in/ns/ext/urid#
  25. #define LV2_URID__map LV2_URID_PREFIX "map" ///< http://lv2plug.in/ns/ext/urid#map
  26. #define LV2_URID__unmap LV2_URID_PREFIX "unmap" ///< http://lv2plug.in/ns/ext/urid#unmap
  27. #define LV2_URID_MAP_URI LV2_URID__map ///< Legacy
  28. #define LV2_URID_UNMAP_URI LV2_URID__unmap ///< Legacy
  29. #include <stdint.h>
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /**
  34. Opaque pointer to host data for LV2_URID_Map.
  35. */
  36. typedef void* LV2_URID_Map_Handle;
  37. /**
  38. Opaque pointer to host data for LV2_URID_Unmap.
  39. */
  40. typedef void* LV2_URID_Unmap_Handle;
  41. /**
  42. URI mapped to an integer.
  43. */
  44. typedef uint32_t LV2_URID;
  45. /**
  46. URID Map Feature (LV2_URID__map)
  47. */
  48. typedef struct _LV2_URID_Map {
  49. /**
  50. Opaque pointer to host data.
  51. This MUST be passed to map_uri() whenever it is called.
  52. Otherwise, it must not be interpreted in any way.
  53. */
  54. LV2_URID_Map_Handle handle;
  55. /**
  56. Get the numeric ID of a URI.
  57. If the ID does not already exist, it will be created.
  58. This function is referentially transparent; any number of calls with the
  59. same arguments is guaranteed to return the same value over the life of a
  60. plugin instance. Note, however, that several URIs MAY resolve to the
  61. same ID if the host considers those URIs equivalent.
  62. This function is not necessarily very fast or RT-safe: plugins SHOULD
  63. cache any IDs they might need in performance critical situations.
  64. The return value 0 is reserved and indicates that an ID for that URI
  65. could not be created for whatever reason. However, hosts SHOULD NOT
  66. return 0 from this function in non-exceptional circumstances (i.e. the
  67. URI map SHOULD be dynamic).
  68. @param handle Must be the callback_data member of this struct.
  69. @param uri The URI to be mapped to an integer ID.
  70. */
  71. LV2_URID (*map)(LV2_URID_Map_Handle handle,
  72. const char* uri);
  73. } LV2_URID_Map;
  74. /**
  75. URI Unmap Feature (LV2_URID__unmap)
  76. */
  77. typedef struct _LV2_URID_Unmap {
  78. /**
  79. Opaque pointer to host data.
  80. This MUST be passed to unmap() whenever it is called.
  81. Otherwise, it must not be interpreted in any way.
  82. */
  83. LV2_URID_Unmap_Handle handle;
  84. /**
  85. Get the URI for a previously mapped numeric ID.
  86. Returns NULL if `urid` is not yet mapped. Otherwise, the corresponding
  87. URI is returned in a canonical form. This MAY not be the exact same
  88. string that was originally passed to LV2_URID_Map::map(), but it MUST be
  89. an identical URI according to the URI syntax specification (RFC3986). A
  90. non-NULL return for a given `urid` will always be the same for the life
  91. of the plugin. Plugins that intend to perform string comparison on
  92. unmapped URIs SHOULD first canonicalise URI strings with a call to
  93. map_uri() followed by a call to unmap_uri().
  94. @param handle Must be the callback_data member of this struct.
  95. @param urid The ID to be mapped back to the URI string.
  96. */
  97. const char* (*unmap)(LV2_URID_Unmap_Handle handle,
  98. LV2_URID urid);
  99. } LV2_URID_Unmap;
  100. #ifdef __cplusplus
  101. } /* extern "C" */
  102. #endif
  103. #endif /* LV2_URID_H */
  104. /**
  105. @}
  106. */