[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src 3rdparty/slv2/config.h 3rdparty/sl...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src 3rdparty/slv2/config.h 3rdparty/sl... |
Date: |
Tue, 06 Nov 2007 18:22:43 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/11/06 18:22:42
Modified files:
src/3rdparty/slv2: config.h
src/3rdparty/slv2/slv2: plugin.h plugininstance.h port.h slv2.h
types.h value.h world.h
src/3rdparty/slv2/src: plugin.c pluginclasses.c plugininstance.c
plugins.c port.c query.c slv2_internal.h
value.c world.c
src/plugins/LV2: LV2Plugin.cpp
Log message:
* update slv2 code to version 0.2.0
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/config.h?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/slv2/plugin.h?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/slv2/plugininstance.h?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/slv2/port.h?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/slv2/slv2.h?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/slv2/types.h?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/slv2/value.h?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/slv2/world.h?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/plugin.c?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/pluginclasses.c?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/plugininstance.c?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/plugins.c?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/port.c?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/query.c?cvsroot=traverso&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/slv2_internal.h?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/value.c?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/3rdparty/slv2/src/world.c?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/LV2/LV2Plugin.cpp?cvsroot=traverso&r1=1.12&r2=1.13
Patches:
Index: 3rdparty/slv2/config.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/config.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- 3rdparty/slv2/config.h 8 Jun 2007 09:29:05 -0000 1.1
+++ 3rdparty/slv2/config.h 6 Nov 2007 18:22:41 -0000 1.2
@@ -1,5 +1,5 @@
-/* config.h. Generated from config.h.in by configure. */
-/* config.h.in. Generated from configure.ac by autoheader. */
+/* config/config.h. Generated from config.h.in by configure. */
+/* config/config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
@@ -13,9 +13,6 @@
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
-/* Define to 1 if stdbool.h conforms to C99. */
-#define HAVE_STDBOOL_H 1
-
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
@@ -37,9 +34,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
-/* Define to 1 if the system has the type `_Bool'. */
-#define HAVE__BOOL 1
-
/* Defined if we JACK MIDI functions need nframes parameter. */
#define JACK_MIDI_NEEDS_NFRAMES 1
@@ -56,28 +50,16 @@
#define PACKAGE_NAME "slv2"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "slv2 0.0.1"
+#define PACKAGE_STRING "slv2 0.2.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "slv2"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.0.1"
+#define PACKAGE_VERSION "0.2.0"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "0.0.1"
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
+#define VERSION "0.2.0"
Index: 3rdparty/slv2/slv2/plugin.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/slv2/plugin.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/slv2/plugin.h 8 Jun 2007 09:29:06 -0000 1.2
+++ 3rdparty/slv2/slv2/plugin.h 6 Nov 2007 18:22:41 -0000 1.3
@@ -80,8 +80,29 @@
slv2_plugin_get_uri(SLV2Plugin plugin);
+/** Get the (resolvable) URI of the plugins "main" bundle.
+ *
+ * This returns the URI of the bundle where the plugin itself was found.
+ * Note that the data for a plugin may be spread over many bundles, that is,
+ * slv2_plugin_get_data_uris may returns URIs which are not below this one.
+ *
+ * Typical hosts should not need to use this function.
+ *
+ * Note this always returns a fully qualified URI. If you want a local
+ * filesystem path, use slv2_uri_to_path.
+ *
+ * \return a shared string which must not be modified or freed.
+ *
+ * Time = O(1)
+ */
+const char*
+slv2_plugin_get_bundle_uri(SLV2Plugin plugin);
+
+
/** Get the (resolvable) URIs of the RDF data files that define a plugin.
*
+ * Typical hosts should not need to use this function.
+ *
* Note this always returns fully qualified URIs. If you want local
* filesystem paths, use slv2_uri_to_path.
*
@@ -321,6 +342,32 @@
const char* symbol);
+/** Get a list of all GUIs available for this plugin.
+ *
+ * Note this returns the URI of the GUI, and not the path/URI to its shared
+ * library, use slv2_plugin_gui_get_library_uri with the values returned
+ * here for that.
+ *
+ * \param plugin The plugin to get the GUIs for.
+ *
+ * Time = Query
+ */
+SLV2Values
+slv2_plugin_get_guis(SLV2Plugin plugin);
+
+
+/** Get the URI for a GUI library.
+ *
+ * \param plugin The plugin that the GUI is for.
+ * \param gui A GUI identifier as returned by slv2_plugin_get_guis() (with
type SLV2_VALUE_GUI).
+ *
+ * Time = Query
+ */
+SLV2Value
+slv2_plugin_get_gui_library_uri(SLV2Plugin plugin,
+ SLV2Value gui);
+
+
/** @} */
#ifdef __cplusplus
Index: 3rdparty/slv2/slv2/plugininstance.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/slv2/plugininstance.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/slv2/plugininstance.h 8 Jun 2007 09:29:06 -0000 1.2
+++ 3rdparty/slv2/slv2/plugininstance.h 6 Nov 2007 18:22:41 -0000 1.3
@@ -73,7 +73,7 @@
*/
SLV2Instance
slv2_plugin_instantiate(SLV2Plugin plugin,
- uint32_t sample_rate,
+ double sample_rate,
const LV2_Host_Feature** host_features);
Index: 3rdparty/slv2/slv2/port.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/slv2/port.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/slv2/port.h 8 Jun 2007 09:29:06 -0000 1.2
+++ 3rdparty/slv2/slv2/port.h 6 Nov 2007 18:22:42 -0000 1.3
@@ -60,6 +60,16 @@
slv2_port_get_hints(SLV2Plugin plugin,
SLV2Port port);
+#if 0
+/** Return whether a port has a certain hint.
+ *
+ * Time = Query
+ */
+bool
+slv2_port_has_hint(SLV2Plugin p,
+ SLV2Port port,
+ SLV2Value hint)
+#endif
/** Get the symbol of a port given the index.
*
@@ -87,12 +97,20 @@
SLV2Port port);
-/** Get the class (input/output, data type, rate...) of a port.
+/** Get the direction (input, output) of a port.
+ *
+ * Time = Query
+ */
+SLV2PortDirection
+slv2_port_get_direction(SLV2Plugin plugin,
+ SLV2Port port);
+
+/** Get the data type of a port.
*
* Time = Query
*/
-SLV2PortClass
-slv2_port_get_class(SLV2Plugin plugin,
+SLV2PortDataType
+slv2_port_get_data_type(SLV2Plugin plugin,
SLV2Port port);
Index: 3rdparty/slv2/slv2/slv2.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/slv2/slv2.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/slv2/slv2.h 8 Jun 2007 09:29:06 -0000 1.2
+++ 3rdparty/slv2/slv2/slv2.h 6 Nov 2007 18:22:42 -0000 1.3
@@ -24,14 +24,17 @@
#endif
#include <slv2/types.h>
+#include <slv2/gui.h>
#include <slv2/world.h>
#include <slv2/pluginclass.h>
#include <slv2/plugin.h>
#include <slv2/port.h>
#include <slv2/plugins.h>
+#include <slv2/pluginguiinstance.h>
#include <slv2/plugininstance.h>
#include <slv2/value.h>
#include <slv2/values.h>
+#include <slv2/util.h>
#ifdef __cplusplus
}
Index: 3rdparty/slv2/slv2/types.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/slv2/types.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/slv2/types.h 8 Jun 2007 09:29:07 -0000 1.2
+++ 3rdparty/slv2/slv2/types.h 6 Nov 2007 18:22:42 -0000 1.3
@@ -27,21 +27,35 @@
#endif
-/** Class (direction and type) of a port
+/** (Data) Type of a port
*
- * Note that ports may be of other classes not listed here, this is just
- * to make the most common case simple. Use slv2_port_get_value(p, "rdf:type")
- * if you need further class information.
+ * SLV2_UNKNOWN_PORT_TYPE means the Port is not of any type SLV2 understands
+ * (currently Control, Audio, MIDI, and OSC).
+ *
+ * Further class information can be using slv2_port_get_value(p, "rdf:type")
+ * or a custom query.
+ */
+typedef enum _SLV2PortDataType {
+ SLV2_PORT_DATA_TYPE_UNKNOWN,
+ SLV2_PORT_DATA_TYPE_CONTROL, /**< One float per block */
+ SLV2_PORT_DATA_TYPE_AUDIO, /**< One float per frame */
+ SLV2_PORT_DATA_TYPE_MIDI, /**< A buffer of MIDI data (LL extension)
*/
+ SLV2_PORT_DATA_TYPE_OSC, /**< A buffer of OSC data (DR extension) */
+} SLV2PortDataType;
+
+/** Direction (input or output) of a port
+ *
+ * SLV2_UNKNOWN_PORT_DIRECTION means the Port is only of type lv2:Port
+ * (neither lv2:Input or lv2:Output) as far as SLV2 understands.
+ *
+ * Further class information can be using slv2_port_get_value(p, "rdf:type")
+ * or a custom query.
*/
-typedef enum _SLV2PortClass {
- SLV2_UNKNOWN_PORT_CLASS,
- SLV2_CONTROL_INPUT, /**< One input float per block */
- SLV2_CONTROL_OUTPUT, /**< One output float per block */
- SLV2_AUDIO_INPUT, /**< One input float per frame */
- SLV2_AUDIO_OUTPUT, /**< One output float per frame */
- SLV2_MIDI_INPUT, /**< MIDI input (LL extension) */
- SLV2_MIDI_OUTPUT /**< MIDI output (LL extension) */
-} SLV2PortClass;
+typedef enum _SLV2PortDirection {
+ SLV2_PORT_DIRECTION_UNKNOWN, /**< Neither input or output */
+ SLV2_PORT_DIRECTION_INPUT, /**< Plugin reads from port when run */
+ SLV2_PORT_DIRECTION_OUTPUT, /**< Plugin writes to port when run */
+} SLV2PortDirection;
/** The format of a URI string.
@@ -55,6 +69,13 @@
} SLV2URIType;
+/** A type of plugin GUI (corresponding to some LV2 GUI extension).
+ */
+typedef enum _SLV2GUIType {
+ SLV2_GUI_TYPE_GTK2 ///< http://ll-plugins.nongnu.org/lv2/ext/gtk2gui
+} SLV2GUIType;
+
+
/** A port on a plugin. Opaque, but valid to compare to NULL. */
typedef struct _SLV2Port* SLV2Port;
@@ -87,6 +108,10 @@
typedef void* SLV2Values;
+/** A plugin GUI */
+typedef void* SLV2GUI;
+
+
#ifdef __cplusplus
}
#endif
Index: 3rdparty/slv2/slv2/value.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/slv2/value.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- 3rdparty/slv2/slv2/value.h 8 Jun 2007 09:29:07 -0000 1.1
+++ 3rdparty/slv2/slv2/value.h 6 Nov 2007 18:22:42 -0000 1.2
@@ -37,6 +37,12 @@
slv2_value_free(SLV2Value val);
+/** Duplicate an SLV2Value.
+ */
+SLV2Value
+slv2_value_duplicate(SLV2Value val);
+
+
/** Return whether two values are equivalent.
*/
bool
@@ -68,7 +74,7 @@
/** Return this value as a URI string, e.g. "http://example.org/foo".
*
* Valid to call only if slv2_value_is_uri(\a value) or
- * slv2_value_is_qname(\a value) returns true.
+ * slv2_value_is_gui(\a value) returns true.
* Returned value is owned by \a value and must not be freed by caller.
*
* Time = O(1)
@@ -166,6 +172,29 @@
slv2_value_as_int(SLV2Value value);
+/** Return whether this value is a GUI (URI and type).
+ *
+ * If this returns true, slv2_value_as_uri will return the URI of the GUI,
+ * and slv2_value_as_gui_type will return the SLV2GUIType (which can be
+ * used to find the URI of the corresponding GUI spec itself, with
+ * slv2_gui_type_get_uri).
+ *
+ * Time = O(1)
+ */
+bool
+slv2_value_is_gui(SLV2Value value);
+
+
+/** Return \a value as an SLV2GUIType.
+ *
+ * Valid to call only if slv2_value_is_gui(\a value) returns true.
+ *
+ * Time = O(1)
+ */
+SLV2GUIType
+slv2_value_as_gui_type(SLV2Value value);
+
+
/** @} */
#ifdef __cplusplus
Index: 3rdparty/slv2/slv2/world.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/slv2/world.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/slv2/world.h 8 Jun 2007 09:29:07 -0000 1.2
+++ 3rdparty/slv2/slv2/world.h 6 Nov 2007 18:22:42 -0000 1.3
@@ -48,6 +48,8 @@
/** Initialize a new, empty world.
+ *
+ * If initialization fails, NULL is returned.
*/
SLV2World
slv2_world_new();
@@ -68,6 +70,31 @@
void
slv2_world_free(SLV2World world);
+#if 0
+/** Set the RDF lock function.
+ *
+ * If set, this function will be called before any calls to librdf functions.
+ * This can be used to make SLV2 thread-safe.
+ *
+ * \a lock will be called with \a data as a parameter, whenever SLV2 is going
+ * to perform an RDF operation.
+ */
+void
+slv2_world_set_rdf_lock_function(SLV2World world, void (*lock)(void*), void*
data);
+
+
+/** Set the unlock function.
+ *
+ * This is the counterpart to the RDF lock function set with
+ * slv2_world_set_rdf_lock_function. Be sure to call this after locking,
+ * or a deadlock will occur.
+ *
+ * \a unlock will be called with the same data pointer set with
+ * slv2_world_set_rdf_lock_function.
+ */
+void
+slv2_world_set_rdf_unlock_function(SLV2World world, void (*unlock)(void*));
+#endif
/** Load all installed LV2 bundles on the system.
*
@@ -184,7 +211,7 @@
*
* \b Example: Get all plugins with at least 1 audio input and output:
<tt> \verbatim
-PREFIX : <http://lv2plug.in/ontology#>
+PREFIX : <http://lv2plug.in/ns/lv2core#>
SELECT DISTINCT ?plugin WHERE {
?plugin :port [ a :AudioPort; a :InputPort ] ;
:port [ a :AudioPort; a :OutputPort ] .
Index: 3rdparty/slv2/src/plugin.c
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/plugin.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/src/plugin.c 8 Jun 2007 09:29:07 -0000 1.2
+++ 3rdparty/slv2/src/plugin.c 6 Nov 2007 18:22:42 -0000 1.3
@@ -33,12 +33,13 @@
/* private */
SLV2Plugin
-slv2_plugin_new(SLV2World world, librdf_uri* uri, const char* binary_uri)
+slv2_plugin_new(SLV2World world, librdf_uri* uri, librdf_uri* bundle_uri,
librdf_uri* binary_uri)
{
struct _SLV2Plugin* plugin = malloc(sizeof(struct _SLV2Plugin));
plugin->world = world;
plugin->plugin_uri = librdf_new_uri_from_uri(uri);
- plugin->binary_uri = strdup(binary_uri);
+ plugin->bundle_uri = librdf_new_uri_from_uri(bundle_uri);
+ plugin->binary_uri = librdf_new_uri_from_uri(binary_uri);
plugin->plugin_class = NULL;
plugin->data_uris = slv2_values_new();
plugin->ports = raptor_new_sequence((void (*)(void*))&slv2_port_free,
NULL);
@@ -56,8 +57,11 @@
librdf_free_uri(p->plugin_uri);
p->plugin_uri = NULL;
- //free(p->bundle_url);
- free(p->binary_uri);
+ librdf_free_uri(p->bundle_uri);
+ p->bundle_uri = NULL;
+
+ librdf_free_uri(p->binary_uri);
+ p->binary_uri = NULL;
raptor_free_sequence(p->ports);
p->ports = NULL;
@@ -73,6 +77,7 @@
}
slv2_values_free(p->data_uris);
+ p->data_uris = NULL;
free(p);
}
@@ -184,7 +189,7 @@
// Load ports
query = (const unsigned char*)
- "PREFIX : <http://lv2plug.in/ontology#>\n"
+ "PREFIX : <http://lv2plug.in/ns/lv2core#>\n"
"SELECT DISTINCT ?port ?symbol ?index WHERE {\n"
"<> :port ?port .\n"
"?port :symbol ?symbol ;\n"
@@ -238,17 +243,24 @@
}
-SLV2Values
-slv2_plugin_get_data_uris(SLV2Plugin p)
+const char*
+slv2_plugin_get_bundle_uri(SLV2Plugin p)
{
- return p->data_uris;
+ return (const char*)librdf_uri_as_string(p->bundle_uri);
}
const char*
slv2_plugin_get_library_uri(SLV2Plugin p)
{
- return p->binary_uri;
+ return (const char*)librdf_uri_as_string(p->binary_uri);
+}
+
+
+SLV2Values
+slv2_plugin_get_data_uris(SLV2Plugin p)
+{
+ return p->data_uris;
}
@@ -290,7 +302,7 @@
librdf_node* license_node =
librdf_query_results_get_binding_value(results, 2);
librdf_node* port_node =
librdf_query_results_get_binding_value(results, 3);
- if (!strcmp(type_str, "http://lv2plug.in/ontology#Plugin"))
+ if (!strcmp(type_str, "http://lv2plug.in/ns/lv2core#Plugin"))
has_type = true;
if (name_node)
@@ -377,7 +389,7 @@
SLV2URIType predicate_type,
const char* predicate)
{
- if (subject->type != SLV2_VALUE_URI) {
+ if ( ! slv2_value_is_uri(subject)) {
fprintf(stderr, "slv2_plugin_get_value_for_subject error: "
"passed non-URI subject\n");
return NULL;
@@ -387,22 +399,25 @@
/* Hack around broken RASQAL, full URI predicates don't work :/ */
+ char* subject_token = slv2_value_get_turtle_token(subject);
+
if (predicate_type == SLV2_URI) {
query = slv2_strjoin(
"PREFIX slv2predicate: <", predicate, ">",
"SELECT DISTINCT ?value WHERE { \n",
- slv2_value_get_turtle_token(subject), " slv2predicate:
?value \n"
+ subject_token, " slv2predicate: ?value \n"
"}\n", NULL);
} else {
query = slv2_strjoin(
"SELECT DISTINCT ?value WHERE { \n",
- slv2_value_get_turtle_token(subject), " ", predicate, "
?value \n"
+ subject_token, " ", predicate, " ?value \n"
"}\n", NULL);
}
SLV2Values result = slv2_plugin_simple_query(p, query, 0);
free(query);
+ free(subject_token);
return result;
}
@@ -425,6 +440,9 @@
uint32_t
slv2_plugin_get_num_ports(SLV2Plugin p)
{
+ if (!p->rdf)
+ slv2_plugin_load(p);
+
return raptor_sequence_size(p->ports);
}
@@ -439,9 +457,11 @@
" lv2:index ?index .\n"
"}\n";
- SLV2Values result = slv2_plugin_simple_query(p, query, 0);
+ SLV2Values results = slv2_plugin_simple_query(p, query, 0);
+ const bool latent = (slv2_values_size(results) > 0);
+ slv2_values_free(results);
- return (slv2_values_size(result) > 0);
+ return latent;
}
@@ -514,6 +534,9 @@
slv2_plugin_get_port_by_index(SLV2Plugin p,
uint32_t index)
{
+ if (!p->rdf)
+ slv2_plugin_load(p);
+
return raptor_sequence_get_at(p->ports, (int)index);
}
@@ -522,6 +545,9 @@
slv2_plugin_get_port_by_symbol(SLV2Plugin p,
const char* symbol)
{
+ if (!p->rdf)
+ slv2_plugin_load(p);
+
// FIXME: sort plugins and do a binary search
for (int i=0; i < raptor_sequence_size(p->ports); ++i) {
SLV2Port port = raptor_sequence_get_at(p->ports, i);
@@ -532,3 +558,77 @@
return NULL;
}
+
+SLV2Values
+slv2_plugin_get_guis(SLV2Plugin plugin)
+{
+ if (!plugin->rdf)
+ slv2_plugin_load(plugin);
+
+ SLV2Values result = slv2_plugin_get_value(plugin, SLV2_URI,
+ "http://ll-plugins.nongnu.org/lv2/ext/gtk2gui#gui");
+
+ for (int i=0; i < raptor_sequence_size(result); ++i) {
+ SLV2Value val = (SLV2Value)raptor_sequence_get_at(result, i);
+ val->type = SLV2_VALUE_GUI;
+ val->val.gui_type_val = SLV2_GUI_TYPE_GTK2;
+ }
+
+ return result;
+}
+
+
+SLV2Value
+slv2_plugin_get_gui_library_uri(SLV2Plugin plugin,
+ SLV2Value gui)
+{
+ assert(gui->type == SLV2_VALUE_GUI);
+
+ if (!plugin->rdf)
+ slv2_plugin_load(plugin);
+
+ SLV2Values values = slv2_plugin_get_value_for_subject(plugin, gui,
SLV2_URI,
+ "http://ll-plugins.nongnu.org/lv2/ext/gtk2gui#binary");
+
+ if (!values || slv2_values_size(values) == 0) {
+ slv2_values_free(values);
+ return NULL;
+ }
+
+ SLV2Value value = slv2_values_get_at(values, 0);
+ if (!slv2_value_is_uri(value)) {
+ slv2_values_free(values);
+ return NULL;
+ }
+
+ value = slv2_value_duplicate(value);
+ slv2_values_free(values);
+
+ return value;
+}
+
+
+const char*
+slv2_gui_type_get_uri(SLV2GUIType type)
+{
+ if (type == SLV2_GUI_TYPE_GTK2)
+ return "http://ll-plugins.nongnu.org/lv2/ext/gtk2gui";
+ else
+ return NULL;
+}
+
+
+void*
+slv2_plugin_load_gui(SLV2Plugin plugin,
+ SLV2Value gui)
+{
+ SLV2Value lib_uri = slv2_plugin_get_gui_library_uri(plugin, gui);
+
+ if (!lib_uri)
+ return NULL;
+
+ //LV2UI_Handle handle =
+ //
+ return NULL;
+}
+
Index: 3rdparty/slv2/src/pluginclasses.c
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/pluginclasses.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- 3rdparty/slv2/src/pluginclasses.c 8 Jun 2007 09:29:07 -0000 1.1
+++ 3rdparty/slv2/src/pluginclasses.c 6 Nov 2007 18:22:42 -0000 1.2
@@ -58,9 +58,6 @@
int upper = raptor_sequence_size(list) - 1;
int i;
- if (upper == 0)
- return NULL;
-
while (upper >= lower) {
i = lower + ((upper - lower) / 2);
Index: 3rdparty/slv2/src/plugininstance.c
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/plugininstance.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/src/plugininstance.c 8 Jun 2007 09:29:07 -0000 1.2
+++ 3rdparty/slv2/src/plugininstance.c 6 Nov 2007 18:22:42 -0000 1.3
@@ -32,7 +32,7 @@
SLV2Instance
slv2_plugin_instantiate(SLV2Plugin plugin,
- uint32_t sample_rate,
+ double sample_rate,
const LV2_Host_Feature** host_features)
{
struct _Instance* result = NULL;
@@ -67,10 +67,7 @@
// Search for plugin by URI
// FIXME: Kluge to get bundle path (containing directory of
binary)
- char* bundle_path = strdup(plugin->binary_uri);
- char* const bundle_path_end = strrchr(bundle_path, '/');
- if (bundle_path_end)
- *(bundle_path_end+1) = '\0';
+ const char* bundle_path =
slv2_uri_to_path(slv2_plugin_get_bundle_uri(plugin));
printf("Bundle path: %s\n", bundle_path);
for (uint32_t i=0; 1; ++i) {
@@ -100,11 +97,9 @@
break;
}
}
-
- free(bundle_path);
}
- assert(result);
+ if (result) {
assert(slv2_plugin_get_num_ports(plugin) > 0);
// Failed to instantiate
@@ -117,6 +112,7 @@
// "Connect" all ports to NULL (catches bugs)
for (uint32_t i=0; i < slv2_plugin_get_num_ports(plugin); ++i)
result->lv2_descriptor->connect_port(result->lv2_handle, i,
NULL);
+ }
if (local_host_features)
free(host_features);
@@ -128,6 +124,9 @@
void
slv2_instance_free(SLV2Instance instance)
{
+ if (!instance)
+ return;
+
struct _Instance* i = (struct _Instance*)instance;
i->lv2_descriptor->cleanup(i->lv2_handle);
i->lv2_descriptor = NULL;
Index: 3rdparty/slv2/src/plugins.c
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/plugins.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- 3rdparty/slv2/src/plugins.c 8 Jun 2007 09:29:07 -0000 1.1
+++ 3rdparty/slv2/src/plugins.c 6 Nov 2007 18:22:42 -0000 1.2
@@ -117,7 +117,7 @@
/* Get all plugins explicitly mentioned in the manifest (discovery pass
1) */
char* query_string =
- "PREFIX : <http://lv2plug.in/ontology#>\n\n"
+ "PREFIX : <http://lv2plug.in/ns/lv2core#>\n\n"
"SELECT DISTINCT ?plugin_uri FROM <>\n"
"WHERE { ?plugin_uri a :Plugin }\n";
@@ -157,7 +157,7 @@
/* Get all data files linked to plugins (discovery pass 2) */
query_string =
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
- "PREFIX : <http://lv2plug.in/ontology#>\n\n"
+ "PREFIX : <http://lv2plug.in/ns/lv2core#>\n\n"
"SELECT DISTINCT ?subject ?data_uri ?binary FROM <>\n"
"WHERE { ?subject rdfs:seeAlso ?data_uri\n"
"OPTIONAL { ?subject :binary ?binary } }\n";
@@ -281,9 +281,6 @@
int upper = raptor_sequence_size(list) - 1;
int i;
- if (upper == 0)
- return NULL;
-
while (upper >= lower) {
i = lower + ((upper - lower) / 2);
Index: 3rdparty/slv2/src/port.c
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/port.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/src/port.c 8 Jun 2007 09:29:07 -0000 1.2
+++ 3rdparty/slv2/src/port.c 6 Nov 2007 18:22:42 -0000 1.3
@@ -63,56 +63,99 @@
}
-SLV2PortClass
-slv2_port_get_class(SLV2Plugin p,
+SLV2PortDirection
+slv2_port_get_direction(SLV2Plugin p,
SLV2Port port)
{
- SLV2Values class = slv2_port_get_value(p, port, "rdf:type");
- assert(class);
+ SLV2Values direction = slv2_port_get_value(p, port, "rdf:type");
- SLV2PortClass ret = SLV2_UNKNOWN_PORT_CLASS;
+ SLV2PortDirection ret = SLV2_PORT_DIRECTION_UNKNOWN;
- int io = -1; // 0 = in, 1 = out
- enum { UNKNOWN, AUDIO, CONTROL, MIDI } type = UNKNOWN;
+ if (!direction)
+ return ret;
- for (unsigned i=0; i < slv2_values_size(class); ++i) {
- SLV2Value val = slv2_values_get_at(class, i);
+ for (unsigned i=0; i < slv2_values_size(direction); ++i) {
+ SLV2Value val = slv2_values_get_at(direction, i);
if (slv2_value_is_uri(val)) {
const char* uri = slv2_value_as_uri(val);
- if (!strcmp(uri,
"http://lv2plug.in/ontology#InputPort"))
- io = 0;
- else if (!strcmp(uri,
"http://lv2plug.in/ontology#OutputPort"))
- io = 1;
- else if (!strcmp(uri,
"http://lv2plug.in/ontology#ControlPort"))
- type = CONTROL;
- else if (!strcmp(uri,
"http://lv2plug.in/ontology#AudioPort"))
- type = AUDIO;
- else if (!strcmp(uri,
"http://ll-plugins.nongnu.org/lv2/ext/MidiPort"))
- type = MIDI;
+ if (!strcmp(uri,
"http://lv2plug.in/ns/lv2core#InputPort"))
+ ret = SLV2_PORT_DIRECTION_INPUT;
+ else if (!strcmp(uri,
"http://lv2plug.in/ns/lv2core#OutputPort"))
+ ret = SLV2_PORT_DIRECTION_OUTPUT;
}
}
- if (io == 0) {
- if (type == AUDIO)
- ret = SLV2_AUDIO_INPUT;
- else if (type == CONTROL)
- ret = SLV2_CONTROL_INPUT;
- else if (type == MIDI)
- ret = SLV2_MIDI_INPUT;
- } else if (io == 1) {
- if (type == AUDIO)
- ret = SLV2_AUDIO_OUTPUT;
- else if (type == CONTROL)
- ret = SLV2_CONTROL_OUTPUT;
- else if (type == MIDI)
- ret = SLV2_MIDI_OUTPUT;
+ slv2_values_free(direction);
+
+ return ret;
+}
+
+
+SLV2PortDataType
+slv2_port_get_data_type(SLV2Plugin p,
+ SLV2Port port)
+{
+ SLV2Values type = slv2_port_get_value(p, port, "rdf:type");
+
+ SLV2PortDataType ret = SLV2_PORT_DATA_TYPE_UNKNOWN;
+
+ if (!type)
+ return ret;
+
+ for (unsigned i=0; i < slv2_values_size(type); ++i) {
+ SLV2Value val = slv2_values_get_at(type, i);
+ if (slv2_value_is_uri(val)) {
+ const char* uri = slv2_value_as_uri(val);
+ if (!strcmp(uri,
"http://lv2plug.in/ns/lv2core#ControlPort"))
+ ret = SLV2_PORT_DATA_TYPE_CONTROL;
+ else if (!strcmp(uri,
"http://lv2plug.in/ns/lv2core#AudioPort"))
+ ret = SLV2_PORT_DATA_TYPE_AUDIO;
+ else if (!strcmp(uri,
"http://ll-plugins.nongnu.org/lv2/ext/MidiPort"))
+ ret = SLV2_PORT_DATA_TYPE_MIDI;
+ else if (!strcmp(uri,
"http://drobilla.net/ns/lv2ext/osc/0#OSCPort"))
+ ret = SLV2_PORT_DATA_TYPE_OSC;
+ }
}
- slv2_values_free(class);
+ slv2_values_free(type);
return ret;
}
+#if 0
+bool
+slv2_port_has_hint(SLV2Plugin p,
+ SLV2Port port,
+ SLV2Value hint)
+{
+ /* FIXME: Add SLV2Value QName stuff to make this not suck to use */
+
+ SLV2Values hints = slv2_port_get_value(p, port, "lv2:portHint");
+
+ if (!hints)
+ return false;
+
+ for (unsigned i=0; i < slv2_values_size(type); ++i) {
+ const SLV2Value val = slv2_values_get_at(type, i);
+ if (slv2_value_is_uri(val)) {
+ const char* uri = slv2_value_as_uri(val);
+ if (!strcmp(uri,
"http://lv2plug.in/ns/lv2core#connectionOptional"))
+ return true;
+ ret = SLV2_PORT_DATA_TYPE_CONTROL;
+ else if (!strcmp(uri,
"http://lv2plug.in/ns/lv2core#AudioPort"))
+ ret = SLV2_PORT_DATA_TYPE_AUDIO;
+ else if (!strcmp(uri,
"http://ll-plugins.nongnu.org/lv2/ext/MidiPort"))
+ ret = SLV2_PORT_DATA_TYPE_MIDI;
+ else if (!strcmp(uri,
"http://drobilla.net/ns/lv2ext/osc/0#OSCPort"))
+ ret = SLV2_PORT_DATA_TYPE_OSC;
+ }
+ }
+
+ slv2_values_free(type);
+
+ return ret;
+}
+#endif
SLV2Values
slv2_port_get_value(SLV2Plugin p,
Index: 3rdparty/slv2/src/query.c
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/query.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- 3rdparty/slv2/src/query.c 8 Jun 2007 09:29:07 -0000 1.2
+++ 3rdparty/slv2/src/query.c 6 Nov 2007 18:22:42 -0000 1.3
@@ -32,7 +32,7 @@
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
"PREFIX doap: <http://usefulinc.com/ns/doap#>\n"
- "PREFIX lv2: <http://lv2plug.in/ontology#>\n";
+ "PREFIX lv2: <http://lv2plug.in/ns/lv2core#>\n";
#if 0
char*
Index: 3rdparty/slv2/src/slv2_internal.h
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/slv2_internal.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- 3rdparty/slv2/src/slv2_internal.h 8 Jun 2007 09:29:08 -0000 1.1
+++ 3rdparty/slv2/src/slv2_internal.h 6 Nov 2007 18:22:42 -0000 1.2
@@ -28,6 +28,7 @@
#include <inttypes.h>
#include <librdf.h>
#include <slv2/types.h>
+#include <slv2/lv2-gtk2gui.h>
@@ -58,8 +59,8 @@
struct _SLV2Plugin {
struct _SLV2World* world;
librdf_uri* plugin_uri;
-// char* bundle_url; ///< Bundle directory plugin was loaded
from
- char* binary_uri; ///< lv2:binary
+ librdf_uri* bundle_uri; ///< Bundle directory plugin was loaded
from
+ librdf_uri* binary_uri; ///< lv2:binary
SLV2PluginClass plugin_class;
raptor_sequence* data_uris; ///< rdfs::seeAlso
raptor_sequence* ports;
@@ -67,7 +68,7 @@
librdf_model* rdf;
};
-SLV2Plugin slv2_plugin_new(SLV2World world, librdf_uri* uri, const char*
binary_uri);
+SLV2Plugin slv2_plugin_new(SLV2World world, librdf_uri* uri, librdf_uri*
bundle_uri, librdf_uri* binary_uri);
void slv2_plugin_load(SLV2Plugin p);
void slv2_plugin_free(SLV2Plugin plugin);
@@ -97,6 +98,14 @@
};
+/* ********* GUI Instance ********* */
+struct _SLV2GUIInstanceImpl {
+ void* lib_handle;
+ const LV2UI_Descriptor* lv2ui_descriptor;
+ LV2UI_Handle lv2ui_handle;
+ void* widget;
+};
+
/* ********* Plugin Class ********* */
@@ -110,7 +119,7 @@
SLV2PluginClass slv2_plugin_class_new(SLV2World world, const char* parent_uri,
const char* uri, const char* label);
-void slv2_plugin_class_free(SLV2PluginClass class);
+void slv2_plugin_class_free(SLV2PluginClass plugin_class);
@@ -124,18 +133,32 @@
/* ********* World ********* */
-
/** Model of LV2 (RDF) data loaded from bundles.
*/
struct _SLV2World {
+ bool local_world;
librdf_world* world;
librdf_storage* storage;
librdf_model* model;
librdf_parser* parser;
SLV2PluginClasses plugin_classes;
SLV2Plugins plugins;
+ librdf_node* lv2_specification_node;
+ librdf_node* lv2_plugin_node;
+ librdf_node* rdf_a_node;
+
+ void (*rdf_lock)(void*);
+ void (*rdf_unlock)(void*);
+ void* rdf_lock_data;
+ int rdf_lock_count;
};
+void
+slv2_world_lock_if_necessary(SLV2World world);
+
+void
+slv2_world_unlock_if_necessary(SLV2World world);
+
/** Load all bundles found in \a search_path.
*
* \param search_path A colon-delimited list of directories. These directories
@@ -150,6 +173,21 @@
const char* search_path);
+void
+slv2_world_load_specifications(SLV2World world);
+
+void
+slv2_world_load_file(SLV2World world, librdf_uri* file_uri);
+
+
+/* ********* GUI ********* */
+
+struct _SLV2GUI {
+ SLV2GUIType type;
+ char* uri;
+};
+
+
/* ********* Value ********* */
@@ -158,7 +196,8 @@
SLV2_VALUE_URI,
SLV2_VALUE_STRING,
SLV2_VALUE_INT,
- SLV2_VALUE_FLOAT
+ SLV2_VALUE_FLOAT,
+ SLV2_VALUE_GUI
} SLV2ValueType;
struct _SLV2Value {
@@ -167,12 +206,14 @@
union {
int int_val;
float float_val;
+ SLV2GUIType gui_type_val;
} val;
};
SLV2Value slv2_value_new(SLV2ValueType type, const char* val);
+
#ifdef __cplusplus
}
#endif
Index: 3rdparty/slv2/src/value.c
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/value.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- 3rdparty/slv2/src/value.c 8 Jun 2007 09:29:08 -0000 1.1
+++ 3rdparty/slv2/src/value.c 6 Nov 2007 18:22:42 -0000 1.2
@@ -50,11 +50,24 @@
}
+SLV2Value
+slv2_value_duplicate(SLV2Value val)
+{
+ SLV2Value result = (SLV2Value)malloc(sizeof(struct _SLV2Value));
+ result->str_val = strdup(val->str_val);
+ result->type = val->type;
+ result->val = val->val;
+ return result;
+}
+
+
void
slv2_value_free(SLV2Value val)
{
+ if (val) {
free(val->str_val);
free(val);
+ }
}
@@ -63,8 +76,10 @@
{
if (value->type != other->type)
return false;
- else
+ else if (value && other)
return ! strcmp(value->str_val, other->str_val);
+ else
+ return true;
}
@@ -75,6 +90,7 @@
char* result = NULL;
switch (value->type) {
+ case SLV2_VALUE_GUI:
case SLV2_VALUE_URI:
len = strlen(value->str_val) + 3;
result = calloc(len, sizeof(char));
@@ -103,14 +119,14 @@
bool
slv2_value_is_uri(SLV2Value value)
{
- return (value->type == SLV2_VALUE_URI);
+ return (value->type == SLV2_VALUE_URI || value->type == SLV2_VALUE_GUI);
}
const char*
slv2_value_as_uri(SLV2Value value)
{
- assert(slv2_value_is_uri(value));
+ assert(slv2_value_is_uri(value) || slv2_value_is_gui(value));
return value->str_val;
}
@@ -169,3 +185,18 @@
return (float)value->val.int_val;
}
+
+bool
+slv2_value_is_gui(SLV2Value value)
+{
+ return (value->type == SLV2_VALUE_GUI);
+}
+
+
+SLV2GUIType
+slv2_value_as_gui_type(SLV2Value value)
+{
+ assert(slv2_value_is_gui(value));
+ return value->val.gui_type_val;
+}
+
Index: 3rdparty/slv2/src/world.c
===================================================================
RCS file: /sources/traverso/traverso/src/3rdparty/slv2/src/world.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- 3rdparty/slv2/src/world.c 8 Jun 2007 09:29:08 -0000 1.3
+++ 3rdparty/slv2/src/world.c 6 Nov 2007 18:22:42 -0000 1.4
@@ -16,6 +16,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include "../config.h"
+
#define _XOPEN_SOURCE 500
#include <string.h>
#include <stdlib.h>
@@ -25,7 +27,6 @@
#include <slv2/world.h>
#include <slv2/slv2.h>
#include <slv2/util.h>
-#include "config.h"
#include "slv2_internal.h"
@@ -35,25 +36,54 @@
SLV2World world = (SLV2World)malloc(sizeof(struct _SLV2World));
world->world = librdf_new_world();
+ if (!world->world)
+ goto fail;
+
+ world->local_world = true;
+
librdf_world_open(world->world);
world->storage = librdf_new_storage(world->world, "hashes", NULL,
"hash-type='memory'");
+ if (!world->storage)
+ goto fail;
world->model = librdf_new_model(world->world, world->storage, NULL);
+ if (!world->model)
+ goto fail;
world->parser = librdf_new_parser(world->world, "turtle", NULL, NULL);
+ if (!world->parser)
+ goto fail;
world->plugin_classes = slv2_plugin_classes_new();
// Add the ever-present lv2:Plugin to classes
- static const char* lv2_plugin_uri = "http://lv2plug.in/ontology#Plugin";
+ static const char* lv2_plugin_uri =
"http://lv2plug.in/ns/lv2core#Plugin";
raptor_sequence_push(world->plugin_classes, slv2_plugin_class_new(
world, NULL, lv2_plugin_uri, "Plugin"));
world->plugins = slv2_plugins_new();
+ world->lv2_specification_node =
librdf_new_node_from_uri_string(world->world,
+ (unsigned
char*)"http://lv2plug.in/ns/lv2core#Specification");
+
+ world->lv2_plugin_node = librdf_new_node_from_uri_string(world->world,
+ (unsigned char*)"http://lv2plug.in/ns/lv2core#Plugin");
+
+ world->rdf_a_node = librdf_new_node_from_uri_string(world->world,
+ (unsigned
char*)"http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+
+ world->rdf_lock = NULL;
+ world->rdf_unlock = NULL;
+ world->rdf_lock_data = NULL;
+ world->rdf_lock_count = 0;
+
return world;
+
+fail:
+ free(world);
+ return NULL;
}
@@ -63,30 +93,65 @@
SLV2World world = (SLV2World)malloc(sizeof(struct _SLV2World));
world->world = rdf_world;
+ if (!world->world)
+ goto fail;
+
+ world->local_world = false;
world->storage = librdf_new_storage(world->world, "hashes", NULL,
"hash-type='memory'");
+ if (!world->storage)
+ goto fail;
world->model = librdf_new_model(world->world, world->storage, NULL);
+ if (!world->model)
+ goto fail;
world->parser = librdf_new_parser(world->world, "turtle", NULL, NULL);
+ if (!world->parser)
+ goto fail;
world->plugin_classes = slv2_plugin_classes_new();
// Add the ever-present lv2:Plugin to classes
- static const char* lv2_plugin_uri = "http://lv2plug.in/ontology#Plugin";
+ static const char* lv2_plugin_uri =
"http://lv2plug.in/ns/lv2core#Plugin";
raptor_sequence_push(world->plugin_classes, slv2_plugin_class_new(
world, NULL, lv2_plugin_uri, "Plugin"));
world->plugins = slv2_plugins_new();
+ world->lv2_specification_node =
librdf_new_node_from_uri_string(world->world,
+ (unsigned
char*)"http://lv2plug.in/ns/lv2core#Specification");
+
+ world->lv2_plugin_node = librdf_new_node_from_uri_string(rdf_world,
+ (unsigned char*)"http://lv2plug.in/ns/lv2core#Plugin");
+
+ world->rdf_a_node = librdf_new_node_from_uri_string(rdf_world,
+ (unsigned
char*)"http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+
+ world->rdf_lock = NULL;
+ world->rdf_unlock = NULL;
+ world->rdf_lock_data = NULL;
+ world->rdf_lock_count = 0;
+
return world;
+
+fail:
+ free(world);
+ return NULL;
}
void
slv2_world_free(SLV2World world)
{
+ if (world->rdf_lock)
+ world->rdf_lock(world->rdf_lock_data);
+
+ librdf_free_node(world->lv2_specification_node);
+ librdf_free_node(world->lv2_plugin_node);
+ librdf_free_node(world->rdf_a_node);
+
for (int i=0; i < raptor_sequence_size(world->plugins); ++i)
slv2_plugin_free(raptor_sequence_get_at(world->plugins, i));
raptor_free_sequence(world->plugins);
@@ -104,16 +169,92 @@
librdf_free_storage(world->storage);
world->storage = NULL;
+ if (world->local_world)
librdf_free_world(world->world);
+
world->world = NULL;
+ if (world->rdf_unlock)
+ world->rdf_unlock(world->rdf_lock_data);
+
free(world);
}
void
+slv2_world_set_rdf_lock_function(SLV2World world, void (*lock)(void*), void*
data)
+{
+ world->rdf_lock = lock;
+ world->rdf_lock_data = data;
+}
+
+
+void
+slv2_world_set_rdf_unlock_function(SLV2World world, void (*unlock)(void*))
+{
+ world->rdf_unlock = unlock;
+}
+
+
+void
+slv2_world_lock_if_necessary(SLV2World world)
+{
+ if (world->rdf_lock) {
+
+ if (world->rdf_lock_count == 0)
+ world->rdf_lock(world->rdf_lock_data);
+
+ ++world->rdf_lock_count;
+
+ }
+}
+
+
+void
+slv2_world_unlock_if_necessary(SLV2World world)
+{
+ if (world->rdf_lock && world->rdf_lock_count > 0) {
+
+ if (world->rdf_lock_count == 1 && world->rdf_unlock)
+ world->rdf_unlock(world->rdf_lock_data);
+
+ world->rdf_lock_count = 0;
+
+ }
+}
+
+
+/** Load the entire contents of a file into the world model.
+ */
+void
+slv2_world_load_file(SLV2World world, librdf_uri* file_uri)
+{
+ slv2_world_lock_if_necessary(world);
+
+ librdf_storage* storage = librdf_new_storage(world->world,
+ "memory", NULL, NULL);
+ librdf_model* model = librdf_new_model(world->world,
+ storage, NULL);
+ librdf_parser_parse_into_model(world->parser, file_uri, NULL,
+ model);
+
+ librdf_stream* stream = librdf_model_as_stream(model);
+ librdf_model_add_statements(world->model, stream);
+ librdf_free_stream(stream);
+
+ librdf_free_model(model);
+ librdf_free_storage(storage);
+
+ slv2_world_unlock_if_necessary(world);
+}
+
+
+
+void
slv2_world_load_bundle(SLV2World world, const char* bundle_uri_str)
{
+ slv2_world_lock_if_necessary(world);
+
librdf_uri* bundle_uri = librdf_new_uri(world->world,
(const unsigned char*)bundle_uri_str);
@@ -122,28 +263,24 @@
/* Parse the manifest into a temporary model */
librdf_storage* manifest_storage = librdf_new_storage(world->world,
- "hashes", NULL, "hash-type='memory'");
+ "memory", NULL, NULL);
librdf_model* manifest_model = librdf_new_model(world->world,
manifest_storage, NULL);
librdf_parser_parse_into_model(world->parser, manifest_uri, NULL,
manifest_model);
- /* Find any plugins declared in the manifest and add references
- * to their manifest files as one of their data files */
- unsigned char* query_string = (unsigned char*)
- "PREFIX : <http://lv2plug.in/ontology#>\n"
- "SELECT DISTINCT ?plugin\n"
- "WHERE { ?plugin a :Plugin }\n";
-
- librdf_query* q = librdf_new_query(world->world, "sparql",
- NULL, query_string, NULL);
+ /* Query statement: ?plugin a lv2:Plugin */
+ librdf_statement* q = librdf_new_statement_from_nodes(world->world,
+ NULL, world->rdf_a_node, world->lv2_plugin_node);
- librdf_query_results* results = librdf_query_execute(q, manifest_model);
+ librdf_stream* results = librdf_model_find_statements(manifest_model,
q);
- while (!librdf_query_results_finished(results)) {
+ while (!librdf_stream_end(results)) {
+ librdf_statement* s = librdf_stream_get_object(results);
- librdf_node* plugin_node =
librdf_query_results_get_binding_value(results, 0);
+ librdf_node* plugin_node =
librdf_new_node_from_node(librdf_statement_get_subject(s));
+ /* Add ?plugin rdfs:seeAlso <manifest.ttl>*/
librdf_node* subject = plugin_node;
librdf_node* predicate =
librdf_new_node_from_uri_string(world->world,
(unsigned
char*)"http://www.w3.org/2000/01/rdf-schema#seeAlso");
@@ -152,20 +289,64 @@
librdf_model_add(world->model, subject, predicate, object);
- librdf_query_results_next(results);
+ /* Add ?plugin slv2:bundleURI <file://some/path> */
+ subject = librdf_new_node_from_node(plugin_node);
+ predicate = librdf_new_node_from_uri_string(world->world,
+ (unsigned
char*)"http://drobilla.net/ns/slv2#bundleURI");
+ object = librdf_new_node_from_uri(world->world, bundle_uri);
+
+ librdf_model_add(world->model, subject, predicate, object);
+
+ librdf_stream_next(results);
}
+ librdf_free_stream(results);
+
+ /* Query statement: ?specification a lv2:Specification */
+ q = librdf_new_statement_from_nodes(world->world,
+ NULL, world->rdf_a_node, world->lv2_specification_node);
+
+ results = librdf_model_find_statements(manifest_model, q);
+
+ while (!librdf_stream_end(results)) {
+ librdf_statement* s = librdf_stream_get_object(results);
+
+ librdf_node* spec_node =
librdf_new_node_from_node(librdf_statement_get_subject(s));
+
+ /* Add ?specification rdfs:seeAlso <manifest.ttl> */
+ librdf_node* subject = spec_node;
+ librdf_node* predicate =
librdf_new_node_from_uri_string(world->world,
+ (unsigned
char*)"http://www.w3.org/2000/01/rdf-schema#seeAlso");
+ librdf_node* object = librdf_new_node_from_uri(world->world,
+ manifest_uri);
+
+ librdf_model_add(world->model, subject, predicate, object);
+
+ /* Add ?specification slv2:bundleURI <file://some/path> */
+ subject = librdf_new_node_from_node(spec_node);
+ predicate = librdf_new_node_from_uri_string(world->world,
+ (unsigned
char*)"http://drobilla.net/ns/slv2#bundleURI");
+ object = librdf_new_node_from_uri(world->world, bundle_uri);
+
+ librdf_model_add(world->model, subject, predicate, object);
+
+ librdf_stream_next(results);
+ }
+
+ librdf_free_stream(results);
+
/* Join the temporary model to the main model */
librdf_stream* manifest_stream = librdf_model_as_stream(manifest_model);
librdf_model_add_statements(world->model, manifest_stream);
librdf_free_stream(manifest_stream);
- librdf_free_query(q);
- librdf_free_query_results(results);
librdf_free_model(manifest_model);
+ free(q);
librdf_free_storage(manifest_storage);
librdf_free_uri(manifest_uri);
librdf_free_uri(bundle_uri);
+
+ slv2_world_unlock_if_necessary(world);
}
@@ -236,6 +417,39 @@
}
*/
+void
+slv2_world_load_specifications(SLV2World world)
+{
+ unsigned char* query_string = (unsigned char*)
+ "PREFIX : <http://lv2plug.in/ns/lv2core#>\n"
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
+ "SELECT DISTINCT ?spec ?data WHERE {\n"
+ " ?spec a :Specification ;\n"
+ " rdfs:seeAlso ?data .\n"
+ "}\n";
+
+ librdf_query* q = librdf_new_query(world->world, "sparql", NULL,
query_string, NULL);
+
+ librdf_query_results* results = librdf_query_execute(q, world->model);
+
+ while (!librdf_query_results_finished(results)) {
+ librdf_node* spec_node =
librdf_query_results_get_binding_value(results, 0);
+ //librdf_uri* spec_uri = librdf_node_get_uri(spec_node);
+ librdf_node* data_node =
librdf_query_results_get_binding_value(results, 1);
+ librdf_uri* data_uri = librdf_node_get_uri(data_node);
+
+ slv2_world_load_file(world, data_uri);
+
+ librdf_free_node(spec_node);
+ librdf_free_node(data_node);
+
+ librdf_query_results_next(results);
+ }
+
+ librdf_free_query_results(results);
+ librdf_free_query(q);
+}
+
void
slv2_world_load_plugin_classes(SLV2World world)
@@ -246,10 +460,10 @@
// FIXME: This loads things that aren't plugin categories
unsigned char* query_string = (unsigned char*)
- "PREFIX : <http://lv2plug.in/ontology#>\n"
+ "PREFIX : <http://lv2plug.in/ns/lv2core#>\n"
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
"SELECT DISTINCT ?class ?parent ?label WHERE {\n"
- //" ?plugin a :Plugin; a ?class .\n"
+ //" ?plugin a ?class .\n"
" ?class a rdfs:Class; rdfs:subClassOf ?parent;
rdfs:label ?label\n"
"} ORDER BY ?class\n";
@@ -266,8 +480,6 @@
librdf_node* label_node =
librdf_query_results_get_binding_value(results, 2);
const char* label = (const
char*)librdf_node_get_literal_value(label_node);
- //printf("CLASS: %s / %s\n", librdf_uri_as_string(parent_uri),
librdf_uri_as_string(class_uri));
-
SLV2PluginClass plugin_class = slv2_plugin_class_new(world,
(const char*)librdf_uri_as_string(parent_uri),
(const char*)librdf_uri_as_string(class_uri),
@@ -315,8 +527,12 @@
slv2_world_load_path(world, lv2_path);
} else {
const char* const home = getenv("HOME");
+ if (home) {
const char* const suffix =
"/.lv2:/usr/local/lib/lv2:/usr/lib/lv2";
lv2_path = slv2_strjoin(home, suffix, NULL);
+ } else {
+ lv2_path = strdup("/usr/local/lib/lv2:/usr/lib/lv2");
+ }
slv2_world_load_path(world, lv2_path);
@@ -326,14 +542,17 @@
/* 3. Query out things to cache */
+ slv2_world_load_specifications(world);
+
slv2_world_load_plugin_classes(world);
// Find all plugins and associated data files
unsigned char* query_string = (unsigned char*)
- "PREFIX : <http://lv2plug.in/ontology#>\n"
+ "PREFIX : <http://lv2plug.in/ns/lv2core#>\n"
"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
- "SELECT DISTINCT ?plugin ?data ?binary\n"
- "WHERE { ?plugin a :Plugin; rdfs:seeAlso ?data\n"
+ "PREFIX slv2: <http://drobilla.net/ns/slv2#>\n"
+ "SELECT DISTINCT ?plugin ?data ?bundle ?binary\n"
+ "WHERE { ?plugin a :Plugin; slv2:bundleURI ?bundle;
rdfs:seeAlso ?data\n"
"OPTIONAL { ?plugin :binary ?binary } }\n"
"ORDER BY ?plugin\n";
@@ -348,7 +567,9 @@
librdf_uri* plugin_uri = librdf_node_get_uri(plugin_node);
librdf_node* data_node =
librdf_query_results_get_binding_value(results, 1);
librdf_uri* data_uri = librdf_node_get_uri(data_node);
- librdf_node* binary_node =
librdf_query_results_get_binding_value(results, 2);
+ librdf_node* bundle_node =
librdf_query_results_get_binding_value(results, 2);
+ librdf_uri* bundle_uri = librdf_node_get_uri(bundle_node);
+ librdf_node* binary_node =
librdf_query_results_get_binding_value(results, 3);
librdf_uri* binary_uri = librdf_node_get_uri(binary_node);
SLV2Plugin plugin = slv2_plugins_get_by_uri(world->plugins,
@@ -356,8 +577,7 @@
// Create a new SLV2Plugin
if (!plugin) {
- plugin = slv2_plugin_new(world, plugin_uri,
- (const
char*)librdf_uri_as_string(binary_uri));
+ plugin = slv2_plugin_new(world, plugin_uri, bundle_uri,
binary_uri);
raptor_sequence_push(world->plugins, plugin);
}
@@ -369,6 +589,7 @@
librdf_free_node(plugin_node);
librdf_free_node(data_node);
+ librdf_free_node(bundle_node);
librdf_free_node(binary_node);
librdf_query_results_next(results);
@@ -389,7 +610,7 @@
slv2_world_serialize(const char* filename)
{
librdf_uri* lv2_uri = librdf_new_uri(slv2_rdf_world,
- (unsigned char*)"http://lv2plug.in/ontology#");
+ (unsigned char*)"http://lv2plug.in/ns/lv2core#");
librdf_uri* rdfs_uri = librdf_new_uri(slv2_rdf_world,
(unsigned
char*)"http://www.w3.org/2000/01/rdf-schema#");
Index: plugins/LV2/LV2Plugin.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/LV2/LV2Plugin.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- plugins/LV2/LV2Plugin.cpp 8 Jun 2007 22:44:29 -0000 1.12
+++ plugins/LV2/LV2Plugin.cpp 6 Nov 2007 18:22:42 -0000 1.13
@@ -259,25 +259,34 @@
/* Get the port symbol (label) for console printing */
char* symbol = slv2_port_get_symbol(m_slv2plugin, slvport);
- /* Get the 'class' of the port (control input, audio output, etc) */
- SLV2PortClass portClass = slv2_port_get_class(m_slv2plugin, slvport);
+ /* Get the 'direction' of the port (input, output) */
+ SLV2PortDirection portDirection = slv2_port_get_direction(m_slv2plugin,
slvport);
- /* Create the port based on it's 'class' */
- switch (portClass) {
- case SLV2_CONTROL_INPUT:
+ /* Get the 'data type' of the port (control, audio) */
+ SLV2PortDataType portDataType = slv2_port_get_data_type(m_slv2plugin,
slvport);
+
+ /* Create the port based on it's 'direction' and 'data type' */
+ switch (portDataType) {
+ case SLV2_PORT_DATA_TYPE_CONTROL:
+ switch (portDirection) {
+ case SLV2_PORT_DIRECTION_INPUT:
ctrlport = new LV2ControlPort(this, portIndex,
slv2_port_get_default_value(m_slv2plugin, slvport));
break;
- case SLV2_CONTROL_OUTPUT:
+ case SLV2_PORT_DIRECTION_OUTPUT:
ctrlport = new LV2ControlPort(this, portIndex, 0);
break;
- case SLV2_AUDIO_INPUT:
+ }
+ case SLV2_PORT_DATA_TYPE_AUDIO:
+ switch (portDirection) {
+ case SLV2_PORT_DIRECTION_INPUT:
m_audioInputPorts.append(new AudioInputPort(this,
portIndex));
break;
- case SLV2_AUDIO_OUTPUT:
+ case SLV2_PORT_DIRECTION_OUTPUT:
m_audioOutputPorts.append(new AudioOutputPort(this,
portIndex));
break;
+ }
default:
- PERROR("ERROR: Unknown port type!");
+ PERROR("ERROR: Unknown port data type!");
}
free(symbol);
@@ -317,9 +326,9 @@
void LV2ControlPort::init()
{
foreach(QString string, get_hints()) {
- if (string == "http://lv2plug.in/ontology#logarithmic") {
+ if (string == "http://lv2plug.in/ns/lv2core#logarithmic") {
m_hint = LOG_CONTROL;
- } else if (string == "http://lv2plug.in/ontology#integer") {
+ } else if (string == "http://lv2plug.in/ns/lv2core#integer") {
m_hint = INT_CONTROL;
}
}
@@ -403,27 +412,30 @@
for (int i=0; i < portcount; ++i) {
SLV2Port slvport = slv2_plugin_get_port_by_index(plugin, i);
- SLV2PortClass portClass = slv2_port_get_class(plugin, slvport);
- switch (portClass) {
- case SLV2_AUDIO_INPUT:
+ SLV2PortDirection portDirection =
slv2_port_get_direction(plugin, slvport);
+ SLV2PortDataType portDataType = slv2_port_get_data_type(plugin,
slvport);
+ switch (portDataType) {
+ case SLV2_PORT_DATA_TYPE_AUDIO:
+ switch (portDirection) {
+ case SLV2_PORT_DIRECTION_INPUT:
info.audioPortInCount++;
continue;
- case SLV2_AUDIO_OUTPUT:
+ case SLV2_PORT_DIRECTION_OUTPUT:
info.audioPortOutCount++;
continue;
- case SLV2_CONTROL_INPUT: break;
- case SLV2_CONTROL_OUTPUT: break;
- case SLV2_MIDI_INPUT: break;
- case SLV2_MIDI_OUTPUT: break;
- case SLV2_UNKNOWN_PORT_CLASS: break;
+ }
+ case SLV2_PORT_DATA_TYPE_CONTROL: break;
+ case SLV2_PORT_DATA_TYPE_MIDI: break;
+ case SLV2_PORT_DATA_TYPE_OSC: break;
+ case SLV2_PORT_DATA_TYPE_UNKNOWN: break;
}
}
SLV2Values values = slv2_plugin_get_value(plugin, SLV2_QNAME, "a");
for (unsigned i=0; i < slv2_values_size(values); ++i) {
QString type = slv2_value_as_string(slv2_values_get_at(values,
i));
- if (type.contains("http://lv2plug.in/ontology#")) {
- info.type = type.remove("http://lv2plug.in/ontology#");
+ if (type.contains("http://lv2plug.in/ns/lv2core#")) {
+ info.type =
type.remove("http://lv2plug.in/ns/lv2core#");
break;
}
}
@@ -441,8 +453,8 @@
SLV2Values values = slv2_plugin_get_value(plugin, SLV2_QNAME, "a");
for (unsigned i=0; i < slv2_values_size(values); ++i) {
QString type = slv2_value_as_string(slv2_values_get_at(values,
i));
- if (type.contains("http://lv2plug.in/ontology#")) {
- return type.remove("http://lv2plug.in/ontology#");
+ if (type.contains("http://lv2plug.in/ns/lv2core#")) {
+ return type.remove("http://lv2plug.in/ns/lv2core#");
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src 3rdparty/slv2/config.h 3rdparty/sl...,
Remon Sijrier <=