comparison DPF-Prymula-audioplugins/dpf/distrho/src/lv2/uri-map.h @ 3:84e66ea83026

DPF-Prymula-audioplugins-0.231015-2
author prymula <prymula76@outlook.com>
date Mon, 16 Oct 2023 21:53:34 +0200
parents
children
comparison
equal deleted inserted replaced
2:cf2cb71d31dd 3:84e66ea83026
1 /*
2 Copyright 2008-2016 David Robillard <http://drobilla.net>
3
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
8 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 /**
18 @defgroup uri-map URI Map
19
20 C API for the LV2 URI Map extension <http://lv2plug.in/ns/ext/uri-map>.
21
22 This extension defines a simple mechanism for plugins to map URIs to
23 integers, usually for performance reasons (e.g. processing events typed by
24 URIs in real time). The expected use case is for plugins to map URIs to
25 integers for things they 'understand' at instantiation time, and store those
26 values for use in the audio thread without doing any string comparison.
27 This allows the extensibility of RDF with the performance of integers (or
28 centrally defined enumerations).
29
30 @{
31 */
32
33 #ifndef LV2_URI_MAP_H
34 #define LV2_URI_MAP_H
35
36 #define LV2_URI_MAP_URI "http://lv2plug.in/ns/ext/uri-map" ///< http://lv2plug.in/ns/ext/uri-map
37 #define LV2_URI_MAP_PREFIX LV2_URI_MAP_URI "#" ///< http://lv2plug.in/ns/ext/uri-map#
38
39 #include <stdint.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /**
46 Opaque pointer to host data.
47 */
48 typedef void* LV2_URI_Map_Callback_Data;
49
50 /**
51 URI Map Feature.
52
53 To support this feature the host must pass an LV2_Feature struct to the
54 plugin's instantiate method with URI "http://lv2plug.in/ns/ext/uri-map"
55 and data pointed to an instance of this struct.
56 */
57 typedef struct {
58 /**
59 Opaque pointer to host data.
60
61 The plugin MUST pass this to any call to functions in this struct.
62 Otherwise, it must not be interpreted in any way.
63 */
64 LV2_URI_Map_Callback_Data callback_data;
65
66 /**
67 Get the numeric ID of a URI from the host.
68
69 @param callback_data Must be the callback_data member of this struct.
70 @param map The 'context' of this URI. Certain extensions may define a
71 URI that must be passed here with certain restrictions on the return
72 value (e.g. limited range). This value may be NULL if the plugin needs
73 an ID for a URI in general. Extensions SHOULD NOT define a context
74 unless there is a specific need to do so, e.g. to restrict the range of
75 the returned value.
76 @param uri The URI to be mapped to an integer ID.
77
78 This function is referentially transparent; any number of calls with the
79 same arguments is guaranteed to return the same value over the life of a
80 plugin instance (though the same URI may return different values with a
81 different map parameter). However, this function is not necessarily very
82 fast: plugins SHOULD cache any IDs they might need in performance
83 critical situations.
84
85 The return value 0 is reserved and indicates that an ID for that URI
86 could not be created for whatever reason. Extensions MAY define more
87 precisely what this means in a certain context, but in general plugins
88 SHOULD handle this situation as gracefully as possible. However, hosts
89 SHOULD NOT return 0 from this function in non-exceptional circumstances
90 (e.g. the URI map SHOULD be dynamic). Hosts that statically support only
91 a fixed set of URIs should not expect plugins to function correctly.
92 */
93 uint32_t (*uri_to_id)(LV2_URI_Map_Callback_Data callback_data,
94 const char* map,
95 const char* uri);
96 } LV2_URI_Map_Feature;
97
98 #ifdef __cplusplus
99 } /* extern "C" */
100 #endif
101
102 #endif /* LV2_URI_MAP_H */
103
104 /**
105 @}
106 */