diff options
Diffstat (limited to 'ns/ext/dynmanifest')
-rw-r--r-- | ns/ext/dynmanifest/dynmanifest.h | 144 | ||||
-rw-r--r-- | ns/ext/dynmanifest/dynmanifest.ttl | 122 | ||||
l--------- | ns/ext/dynmanifest/ext.pc.in | 1 | ||||
-rw-r--r-- | ns/ext/dynmanifest/lv2-dynmanifest.doap.ttl | 43 | ||||
-rw-r--r-- | ns/ext/dynmanifest/manifest.ttl | 9 | ||||
l--------- | ns/ext/dynmanifest/waf | 1 | ||||
l--------- | ns/ext/dynmanifest/wscript | 1 |
7 files changed, 321 insertions, 0 deletions
diff --git a/ns/ext/dynmanifest/dynmanifest.h b/ns/ext/dynmanifest/dynmanifest.h new file mode 100644 index 0000000..56d829e --- /dev/null +++ b/ns/ext/dynmanifest/dynmanifest.h @@ -0,0 +1,144 @@ +/* + Dynamic manifest specification for LV2 + Copyright 2008-2011 Stefano D'Angelo <zanga.mail@gmail.com> + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +/** + @file dynmanifest.h + C header for the LV2 Dynamic Manifest extension + <http://lv2plug.in/ns/ext/dynmanifest>. + Revision: 1.1 +*/ + +#ifndef LV2_DYN_MANIFEST_H_INCLUDED +#define LV2_DYN_MANIFEST_H_INCLUDED + +#include <stdio.h> + +#include "lv2/lv2plug.in/ns/lv2core/lv2.h" + +#define LV2_DYN_MANIFEST_URI "http://lv2plug.in/ns/ext/dynmanifest" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + Dynamic manifest generator handle. + + This handle indicates a particular status of a dynamic manifest generator. + The host MUST NOT attempt to interpret it and, unlikely LV2_Handle, it is + NOT even valid to compare this to NULL. The dynamic manifest generator MAY + use it to reference internal data. +*/ +typedef void * LV2_Dyn_Manifest_Handle; + +/** + Generate the dynamic manifest. + + @param handle Pointer to an uninitialized dynamic manifest generator handle. + + @param features NULL terminated array of LV2_Feature structs which represent + the features the host supports. The dynamic manifest generator may refuse to + (re)generate the dynamic manifest if required features are not found here + (however hosts SHOULD NOT use this as a discovery mechanism, instead of + reading the static manifest file). This array must always exist; if a host + has no features, it MUST pass a single element array containing NULL. + + @return 0 on success, otherwise a non-zero error code. The host SHOULD + evaluate the result of the operation by examining the returned value and + MUST NOT try to interpret the value of handle. +*/ +int lv2_dyn_manifest_open(LV2_Dyn_Manifest_Handle * handle, + const LV2_Feature *const * features); + +/** + Fetch a "list" of subject URIs described in the dynamic manifest. + + The dynamic manifest generator has to fill the resource only with the needed + triples to make the host aware of the "objects" it wants to expose. For + example, if the plugin library exposes a regular LV2 plugin, it should + output only a triple like the following: + + <http://www.example.com/plugin/uri> a lv2:Plugin . + + The objects that are elegible for exposure are those that would need to be + represented by a subject node in a static manifest. + + @param handle Dynamic manifest generator handle. + + @param fp FILE * identifying the resource the host has to set up for the + dynamic manifest generator. The host MUST pass a writable, empty resource to + this function, and the dynamic manifest generator MUST ONLY perform write + operations on it at the end of the stream (e.g., using only fprintf(), + fwrite() and similar). + + @return 0 on success, otherwise a non-zero error code. +*/ +int lv2_dyn_manifest_get_subjects(LV2_Dyn_Manifest_Handle handle, + FILE * fp); + +/** + Function that fetches data related to a specific URI. + + The dynamic manifest generator has to fill the resource with data related to + object represented by the given URI. For example, if the library exposes a + regular LV2 plugin whose URI, as retrieved by the host using + lv2_dyn_manifest_get_subjects() is http://www.example.com/plugin/uri, it + should output something like: + + <pre> + <http://www.example.com/plugin/uri> + a lv2:Plugin ; + doap:name "My Plugin" ; + lv2:binary <mylib.so> ; + etc:etc "..." . + </pre> + + @param handle Dynamic manifest generator handle. + + @param fp FILE * identifying the resource the host has to set up for the + dynamic manifest generator. The host MUST pass a writable resource to this + function, and the dynamic manifest generator MUST ONLY perform write + operations on it at the current position of the stream (e.g. using only + fprintf(), fwrite() and similar). + + @param uri URI to get data about (in the "plain" form, i.e., absolute URI + without Turtle prefixes). + + @return 0 on success, otherwise a non-zero error code. +*/ +int lv2_dyn_manifest_get_data(LV2_Dyn_Manifest_Handle handle, + FILE * fp, + const char * uri); + +/** + Function that ends the operations on the dynamic manifest generator. + + This function SHOULD be used by the dynamic manifest generator to perform + cleanup operations, etc. + + Once this function is called, referring to handle will cause undefined + behavior. + + @param handle Dynamic manifest generator handle. +*/ +void lv2_dyn_manifest_close(LV2_Dyn_Manifest_Handle handle); + +#ifdef __cplusplus +} +#endif + +#endif /* LV2_DYN_MANIFEST_H_INCLUDED */ diff --git a/ns/ext/dynmanifest/dynmanifest.ttl b/ns/ext/dynmanifest/dynmanifest.ttl new file mode 100644 index 0000000..591cb11 --- /dev/null +++ b/ns/ext/dynmanifest/dynmanifest.ttl @@ -0,0 +1,122 @@ +# LV2 Dynamic Manifest Extension +# Copyright 2008-2011 Stefano D'Angelo <zanga.mail@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +@prefix dman: <http://lv2plug.in/ns/ext/dynmanifest#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix owl: <http://www.w3.org/2002/07/owl#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://lv2plug.in/ns/ext/dynmanifest> + a doap:Project , + lv2:Specification ; + doap:license <http://opensource.org/licenses/isc-license> ; + doap:name "LV2 Dynamic Manifest" ; + doap:homepage <http://naspro.atheme.org> ; + doap:created "2009-06-13" ; + doap:shortdesc "An LV2-based specification for dynamic data generation." ; + doap:programming-language "C" ; + doap:release [ + doap:revision "1.1" ; + doap:created "2011-11-17" + ] ; + doap:maintainer [ + a foaf:Person ; + foaf:name "Stefano D'Angelo" + ] ; + lv2:documentation """ +<p>The LV2 API, on its own, cannot be used to write plugin libraries where data +is dynamically generated at runtime (e.g. API wrappers), since LV2 requires +needed information to be provided in one or more static data (RDF) files. This +API addresses this limitation by extending the LV2 API.</p> + +<p>To detect that a plugin library implements a dynamic manifest generator, +the host checks its static manifest for a description like:</p> + +<pre class="turtle-code"> +<http://example.org/my-dynamic-manifest> + a dman:DynManifest ; + lv2:binary <mydynmanifest.so> . +</pre> + +<p>To load the data, the host loads the library +(e.g. <code>mydynmanifest.so</code>) as usual and fetches the dynamic Turtle +data from it using this API.</p> + +<p>The host is allowed to request regeneration of the dynamic manifest multiple +times, and the plugin library is expected to provide updated data if/when +possible. All data and references provided via this API before the last +regeneration of the dynamic manifest is to be considered invalid by the host, +including plugin descriptors whose URIs were discovered using this API.</p> + +<h3>Accessing Data</h3> + +<p>Whenever a host wants to access data using this API, it could:</p> + +<ol> +<li>Call lv2_dyn_manifest_open().</li> +<li>Create a FILE for functions to write data to (e.g. using tmpfile()).</li> +<li>Get a <q>list</q> of exposed subject URIs using + lv2_dyn_manifest_get_subjects().</li> +<li>Call lv2_dyn_manifest_get_data() for each URI of interest to + get the data related to that URI (which can be written to any FILE).</li> +<li>Call lv2_dyn_manifest_close().</li> +<li>Parse the content of the FILE(s).</li> +<li>Free/delete/unlink the FILE(s).</li> +</ol> + +<p>Each call to the above mentioned dynamic manifest functions MUST write a +complete, valid Turtle document (including all needed prefix definitions) to +the output FILE.</p> + +<p>Each call to lv2_dyn_manifest_open() causes the (re)generation of the +dynamic manifest data, and invalidates all data fetched before the call.</p> + +<p>In case the plugin library uses this same API to access other dynamic +manifests, it MUST implement some mechanism to avoid potentially endless loops +(such as A loads B, B loads A, etc.) and, in case such a loop is detected, the +operation MUST fail. For this purpose, use of a static boolean flag is +suggested.</p> + +<h3>Threading Rules</h3> + +<p>All of the functions defined by this specification belong to the Discovery +class.</p> +""" . + +dman:DynManifest + a rdfs:Class ; + rdfs:subClassOf lv2:Resource ; + rdfs:label "Dynamic manifest generator" ; + rdfs:subClassOf [ + a owl:Restriction ; + owl:onProperty lv2:binary ; + owl:minCardinality 1 ; + rdfs:comment """A DynManifest has at least 1 lv2:binary. +The binary must be a library with at least the functions described in +lv2_dyn_manifest.h implemented. +""" + ] ; + rdfs:comment """ +The class which represents a dynamic manifest generator. + +There MUST NOT be any instances of :DynManifest in the generated manifest. + +All relative URIs in the generated data MUST be relative to the base path +that would be used to parse a normal LV2 manifest (the bundle path). +""" . diff --git a/ns/ext/dynmanifest/ext.pc.in b/ns/ext/dynmanifest/ext.pc.in new file mode 120000 index 0000000..1cdad2a --- /dev/null +++ b/ns/ext/dynmanifest/ext.pc.in @@ -0,0 +1 @@ +../../../ext.pc.in
\ No newline at end of file diff --git a/ns/ext/dynmanifest/lv2-dynmanifest.doap.ttl b/ns/ext/dynmanifest/lv2-dynmanifest.doap.ttl new file mode 100644 index 0000000..f47c381 --- /dev/null +++ b/ns/ext/dynmanifest/lv2-dynmanifest.doap.ttl @@ -0,0 +1,43 @@ +@prefix dcs: <http://ontologi.es/doap-changeset#> . +@prefix doap: <http://usefulinc.com/ns/doap#> . +@prefix foaf: <http://xmlns.com/foaf/0.1/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://drobilla.net/drobilla#me> + a foaf:Person ; + foaf:name "David Robillard" ; + foaf:homepage <http://drobilla.net/> ; + foaf:mbox <mailto:d@drobilla.net> ; + rdfs:seeAlso <http://drobilla.net/drobilla> . + +<http://lv2plug.in/ns/ext/dynmanifest> + a doap:Project ; + doap:license <http://opensource.org/licenses/isc-license> ; + doap:name "LV2 Dynamic Manifest" ; + doap:homepage <http://naspro.atheme.org> ; + doap:created "2009-06-13" ; + doap:shortdesc "An LV2-based specification for dynamic data generation." ; + doap:programming-language "C" ; + doap:developer [ + a foaf:Person ; + foaf:name "Stefano D'Angelo" + ] ; + doap:release [ + doap:revision "1.1" ; + doap:created "2011-11-17" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Improve documentation." + ] + ] + ] , [ + doap:revision "1.0" ; + doap:created "2010-04-10" ; + dcs:blame <http://drobilla.net/drobilla#me> ; + dcs:changeset [ + dcs:item [ + rdfs:label "Initial release." + ] + ] + ] . diff --git a/ns/ext/dynmanifest/manifest.ttl b/ns/ext/dynmanifest/manifest.ttl new file mode 100644 index 0000000..6718092 --- /dev/null +++ b/ns/ext/dynmanifest/manifest.ttl @@ -0,0 +1,9 @@ +@prefix lv2: <http://lv2plug.in/ns/lv2core#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + +<http://lv2plug.in/ns/ext/dynmanifest> + a lv2:Specification ; + lv2:minorVersion 1 ; + lv2:microVersion 1 ; + rdfs:seeAlso <dynmanifest.ttl> , + <lv2-dynmanifest.doap.ttl> . diff --git a/ns/ext/dynmanifest/waf b/ns/ext/dynmanifest/waf new file mode 120000 index 0000000..917d5c5 --- /dev/null +++ b/ns/ext/dynmanifest/waf @@ -0,0 +1 @@ +../../../waf
\ No newline at end of file diff --git a/ns/ext/dynmanifest/wscript b/ns/ext/dynmanifest/wscript new file mode 120000 index 0000000..cf8cbae --- /dev/null +++ b/ns/ext/dynmanifest/wscript @@ -0,0 +1 @@ +../../../ext.wscript
\ No newline at end of file |