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.

122 lines
3.9KB

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