diff options
Diffstat (limited to 'lv2/state')
-rw-r--r-- | lv2/state/lv2-state.doap.ttl | 15 | ||||
-rw-r--r-- | lv2/state/manifest.ttl | 5 | ||||
-rw-r--r-- | lv2/state/state.h | 46 | ||||
-rw-r--r-- | lv2/state/state.ttl | 30 |
4 files changed, 72 insertions, 24 deletions
diff --git a/lv2/state/lv2-state.doap.ttl b/lv2/state/lv2-state.doap.ttl index fd87a13..784946d 100644 --- a/lv2/state/lv2-state.doap.ttl +++ b/lv2/state/lv2-state.doap.ttl @@ -13,8 +13,18 @@ <http://drobilla.net/drobilla#me> ; doap:maintainer <http://drobilla.net/drobilla#me> ; doap:release [ - doap:revision "2.3" ; - doap:created "2016-10-19" ; + doap:revision "2.5" ; + doap:created "2019-06-03" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Add state:freePath feature." + ] + ] + ] , [ + doap:revision "2.4" ; + doap:created "2019-02-03" ; + doap:file-release <http://lv2plug.in/spec/lv2-1.16.0.tar.bz2> ; dcs:blame <http://drobilla.net/drobilla#me> ; dcs:changeset [ dcs:item [ @@ -64,3 +74,4 @@ ] ] ] . + diff --git a/lv2/state/manifest.ttl b/lv2/state/manifest.ttl index 2a54874..4bbee9a 100644 --- a/lv2/state/manifest.ttl +++ b/lv2/state/manifest.ttl @@ -1,8 +1,9 @@ -@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . <http://lv2plug.in/ns/ext/state> a lv2:Specification ; lv2:minorVersion 2 ; - lv2:microVersion 3 ; + lv2:microVersion 5 ; rdfs:seeAlso <state.ttl> . + diff --git a/lv2/state/state.h b/lv2/state/state.h index ffc40d1..cea4037 100644 --- a/lv2/state/state.h +++ b/lv2/state/state.h @@ -17,6 +17,7 @@ /** @defgroup state State + @ingroup lv2 An interface for LV2 plugins to save and restore state, see <http://lv2plug.in/ns/ext/state> for details. @@ -27,17 +28,19 @@ #ifndef LV2_STATE_H #define LV2_STATE_H +#include "lv2/core/lv2.h" + +#include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include "lv2/core/lv2.h" - #define LV2_STATE_URI "http://lv2plug.in/ns/ext/state" ///< http://lv2plug.in/ns/ext/state #define LV2_STATE_PREFIX LV2_STATE_URI "#" ///< http://lv2plug.in/ns/ext/state# #define LV2_STATE__State LV2_STATE_PREFIX "State" ///< http://lv2plug.in/ns/ext/state#State #define LV2_STATE__interface LV2_STATE_PREFIX "interface" ///< http://lv2plug.in/ns/ext/state#interface #define LV2_STATE__loadDefaultState LV2_STATE_PREFIX "loadDefaultState" ///< http://lv2plug.in/ns/ext/state#loadDefaultState +#define LV2_STATE__freePath LV2_STATE_PREFIX "freePath" ///< http://lv2plug.in/ns/ext/state#freePath #define LV2_STATE__makePath LV2_STATE_PREFIX "makePath" ///< http://lv2plug.in/ns/ext/state#makePath #define LV2_STATE__mapPath LV2_STATE_PREFIX "mapPath" ///< http://lv2plug.in/ns/ext/state#mapPath #define LV2_STATE__state LV2_STATE_PREFIX "state" ///< http://lv2plug.in/ns/ext/state#state @@ -46,11 +49,10 @@ #ifdef __cplusplus extern "C" { -#else -# include <stdbool.h> #endif typedef void* LV2_State_Handle; ///< Opaque handle for state save/restore +typedef void* LV2_State_Free_Path_Handle; ///< Opaque handle for state:freePath feature typedef void* LV2_State_Map_Path_Handle; ///< Opaque handle for state:mapPath feature typedef void* LV2_State_Make_Path_Handle; ///< Opaque handle for state:makePath feature @@ -193,7 +195,7 @@ typedef const void* (*LV2_State_Retrieve_Function)( authors should consider this possibility, and always store sensible data with meaningful types to avoid such problems in the future. */ -typedef struct _LV2_State_Interface { +typedef struct { /** Save plugin state using a host-provided `store` callback. @@ -293,8 +295,8 @@ typedef struct { not necessarily the same original path) using absolute_path(). This function may only be called within the context of - LV2_State_Interface methods. The caller is responsible for freeing the - returned value with free(). + LV2_State_Interface methods. The caller must free the returned value + with LV2_State_Free_Path.free_path(). */ char* (*abstract_path)(LV2_State_Map_Path_Handle handle, const char* absolute_path); @@ -309,8 +311,8 @@ typedef struct { use any paths loaded from plugin state. This function may only be called within the context of - LV2_State_Interface methods. The caller is responsible for freeing the - returned value with free(). + LV2_State_Interface methods. The caller must free the returned value + with LV2_State_Free_Path.free_path(). */ char* (*absolute_path)(LV2_State_Map_Path_Handle handle, const char* abstract_path); @@ -346,12 +348,36 @@ typedef struct { LV2_State_Interface.save(), it may only be called within the dynamic scope of that function call. - The caller is responsible for freeing the returned value with free(). + The caller must free the returned value with + LV2_State_Free_Path.free_path(). */ char* (*path)(LV2_State_Make_Path_Handle handle, const char* path); } LV2_State_Make_Path; +/** + Feature data for state:freePath (@ref LV2_STATE__freePath). +*/ +typedef struct { + /** + Opaque host data. + */ + LV2_State_Free_Path_Handle handle; + + /** + Free a path returned by a state feature. + + @param handle MUST be the `handle` member of this struct. + @param path The path previously returned by a state feature. + + This function can be used by plugins to free paths allocated by the host + and returned by state features (LV2_State_Map_Path.abstract_path(), + LV2_State_Map_Path.absolute_path(), and LV2_State_Make_Path.path()). + */ + void (*free_path)(LV2_State_Free_Path_Handle handle, + char* path); +} LV2_State_Free_Path; + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/lv2/state/state.ttl b/lv2/state/state.ttl index c86fea7..88981cd 100644 --- a/lv2/state/state.ttl +++ b/lv2/state/state.ttl @@ -1,6 +1,6 @@ -@prefix lv2: <http://lv2plug.in/ns/lv2core#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix state: <http://lv2plug.in/ns/ext/state#> . <http://lv2plug.in/ns/ext/state> @@ -44,9 +44,9 @@ single property. The host is free to implement property storage and retrieval in any way.</p> <p>Since value types are defined by URI, any type is possible. However, a set -of standard types is defined by the <a href="../atom/atom.html">LV2 Atom</a> +of standard types is defined by the <a href="atom.html">LV2 Atom</a> extension. Use of these types is recommended. Hosts MUST implement at least -<a href="../atom/atom.html#String">atom:String</a>, which is simply a C +<a href="atom.html#String">atom:String</a>, which is simply a C string.</p> <h3>Referring to Files</h3> @@ -55,7 +55,7 @@ string.</p> state. This is done by storing the file's path as a property just like any other value. However, there are some rules which MUST be followed when storing paths, see state:mapPath for details. Plugins MUST use the type <a -href="../atom/atom.html#Path">atom:Path</a> for all paths in their state.</p> +href="atom.html#Path">atom:Path</a> for all paths in their state.</p> <p>Plugins are strongly encouraged to avoid creating files, instead storing all state as properties. However, occasionally the ability to create files is @@ -204,9 +204,9 @@ plugins.</p> <q>Don't stop; set playing to false</q>.</p> <p>This extension does not define a dynamic mechanism for state access and -manipulation. The <a href="../patch/patch.html">LV2 Patch</a> extension +manipulation. The <a href="patch.html">LV2 Patch</a> extension defines a generic set of messages which can be used to access or manipulate -properties, and the <a href="../atom/atom.html">LV2 Atom</a> extension defines +properties, and the <a href="atom.html">LV2 Atom</a> extension defines a port type and data container capable of transmitting those messages.</p> """ . @@ -355,7 +355,7 @@ state:threadSafeRestore is thread-safe and may be called concurrently with audio class functions.</p> <p>To support this feature, the host MUST pass a <a -href="../worker/worker.html#schedule">work:schedule</a> feature to the restore +href="worker.html#schedule">work:schedule</a> feature to the restore method, which will be used to complete the state restoration. The usual mechanics of the worker apply: the host will call the plugin's work method, which emits a response which is later applied in the audio thread.</p> @@ -364,6 +364,15 @@ which emits a response which is later applied in the audio thread.</p> state, so this feature allows state to be restored without dropouts.</p> """ . +state:freePath + a lv2:Feature ; + rdfs:label "free a file path" ; + lv2:documentation """ +<p>This feature provides a function that can be used by plugins to free paths +that were allocated by the host via other state features (state:mapPath and +state:makePath).</p> +""" . + state:Changed a rdfs:Class ; rdfs:label "State changed" ; @@ -372,7 +381,7 @@ state:Changed way that the host can not otherwise know about.</p> <p>This is a one-way notification, intended to be used as the type of an <a -href="../atom/atom.html#Object">Object</a> sent from plugins when +href="atom.html#Object">Object</a> sent from plugins when necessary.</p> <p>Plugins SHOULD emit such an event whenever a change has occurred that would @@ -380,3 +389,4 @@ result in a different state being saved, but not when the host explicity makes a change which it knows is likely to have that effect, such as changing a parameter.</p> """ . + |