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.

130 lines
4.0KB

  1. /*
  2. Copyright 2008-2012 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. @file urid.h
  17. C header for the LV2 URID extension <http://lv2plug.in/ns/ext/urid>
  18. */
  19. #ifndef LV2_URID_H
  20. #define LV2_URID_H
  21. #define LV2_URID_URI "http://lv2plug.in/ns/ext/urid"
  22. #define LV2_URID_PREFIX LV2_URID_URI "#"
  23. #define LV2_URID__map LV2_URID_PREFIX "map"
  24. #define LV2_URID__unmap LV2_URID_PREFIX "unmap"
  25. /* Legacy defines */
  26. #define LV2_URID_MAP_URI LV2_URID__map
  27. #define LV2_URID_UNMAP_URI LV2_URID__unmap
  28. #include <stdint.h>
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /**
  33. Opaque pointer to host data for LV2_URID_Map.
  34. */
  35. typedef void* LV2_URID_Map_Handle;
  36. /**
  37. Opaque pointer to host data for LV2_URID_Unmap.
  38. */
  39. typedef void* LV2_URID_Unmap_Handle;
  40. /**
  41. URI mapped to an integer.
  42. */
  43. typedef uint32_t LV2_URID;
  44. /**
  45. URID Map Feature (LV2_URID__map)
  46. */
  47. typedef struct _LV2_URID_Map {
  48. /**
  49. Opaque pointer to host data.
  50. This MUST be passed to map_uri() whenever it is called.
  51. Otherwise, it must not be interpreted in any way.
  52. */
  53. LV2_URID_Map_Handle handle;
  54. /**
  55. Get the numeric ID of a URI.
  56. If the ID does not already exist, it will be created.
  57. This function is referentially transparent; any number of calls with the
  58. same arguments is guaranteed to return the same value over the life of a
  59. plugin instance. Note, however, that several URIs MAY resolve to the
  60. same ID if the host considers those URIs equivalent.
  61. This function is not necessarily very fast or RT-safe: plugins SHOULD
  62. cache any IDs they might need in performance critical situations.
  63. The return value 0 is reserved and indicates that an ID for that URI
  64. could not be created for whatever reason. However, hosts SHOULD NOT
  65. return 0 from this function in non-exceptional circumstances (i.e. the
  66. URI map SHOULD be dynamic).
  67. @param handle Must be the callback_data member of this struct.
  68. @param uri The URI to be mapped to an integer ID.
  69. */
  70. LV2_URID (*map)(LV2_URID_Map_Handle handle,
  71. const char* uri);
  72. } LV2_URID_Map;
  73. /**
  74. URI Unmap Feature (LV2_URID__unmap)
  75. */
  76. typedef struct _LV2_URID_Unmap {
  77. /**
  78. Opaque pointer to host data.
  79. This MUST be passed to unmap() whenever it is called.
  80. Otherwise, it must not be interpreted in any way.
  81. */
  82. LV2_URID_Unmap_Handle handle;
  83. /**
  84. Get the URI for a previously mapped numeric ID.
  85. Returns NULL if @p urid is not yet mapped. Otherwise, the corresponding
  86. URI is returned in a canonical form. This MAY not be the exact same
  87. string that was originally passed to LV2_URID_Map::map(), but it MUST be
  88. an identical URI according to the URI syntax specification (RFC3986). A
  89. non-NULL return for a given @p urid will always be the same for the life
  90. of the plugin. Plugins that intend to perform string comparison on
  91. unmapped URIs SHOULD first canonicalise URI strings with a call to
  92. map_uri() followed by a call to unmap_uri().
  93. @param handle Must be the callback_data member of this struct.
  94. @param urid The ID to be mapped back to the URI string.
  95. */
  96. const char* (*unmap)(LV2_URID_Unmap_Handle handle,
  97. LV2_URID urid);
  98. } LV2_URID_Unmap;
  99. #ifdef __cplusplus
  100. } /* extern "C" */
  101. #endif
  102. #endif /* LV2_URID_H */