summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-01-10 17:41:25 +0000
committerDavid Robillard <d@drobilla.net>2007-01-10 17:41:25 +0000
commit3f80f51ceb9d1d0e902cd2bb17858a8b2615cd33 (patch)
treec233f0841b3d21b6dcd18aa35e1de3b50ea99e7b /utils
parent3a6b07eca33cb6ae586c80141315958d1e348f38 (diff)
downloadlilv-3f80f51ceb9d1d0e902cd2bb17858a8b2615cd33.tar.gz
lilv-3f80f51ceb9d1d0e902cd2bb17858a8b2615cd33.tar.bz2
lilv-3f80f51ceb9d1d0e902cd2bb17858a8b2615cd33.zip
Moved RDFWriter to RAUL.
More work on LADSPA->LV2 converter (use RAUL's RDFWriter now). git-svn-id: http://svn.drobilla.net/lad/slv2@246 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile.am5
-rw-r--r--utils/ladspa2lv2.cc (renamed from utils/ladspa2lv2.c)54
2 files changed, 54 insertions, 5 deletions
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 4e4a984..8d23d38 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -2,7 +2,8 @@ if BUILD_UTILITIES
bin_PROGRAMS = ladspa2lv2
-ladspa2lv2_LDADD = -ldl @RAPTOR_LIBS@
-ladspa2lv2_SOURCES = ladspa2lv2.c
+ladspa2lv2_CXXFLAGS = @RAUL_CFLAGS@ @RAPTOR_CFLAGS@
+ladspa2lv2_LDADD = -ldl @RAUL_LIBS@ @RAPTOR_LIBS@
+ladspa2lv2_SOURCES = ladspa2lv2.cc
endif
diff --git a/utils/ladspa2lv2.c b/utils/ladspa2lv2.cc
index 4cdef50..3b989a1 100644
--- a/utils/ladspa2lv2.c
+++ b/utils/ladspa2lv2.cc
@@ -18,9 +18,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include <raptor.h>
#include <ladspa.h>
#include <dlfcn.h>
+#include "raul/RDFWriter.h"
#define U(x) ((const unsigned char*)(x))
@@ -45,7 +45,7 @@ load_ladspa_plugin(const char* lib_path, unsigned long index)
return descriptor;
}
-
+#if 0
void
write_resource(raptor_serializer* serializer,
const char* subject_uri,
@@ -71,11 +71,12 @@ write_resource(raptor_serializer* serializer,
raptor_serialize_statement(serializer, &triple);
}
-
+#endif
void
write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* uri, const char* filename)
{
+#if 0
raptor_init();
raptor_serializer* serializer = raptor_new_serializer("turtle");
@@ -109,6 +110,53 @@ write_lv2_turtle(LADSPA_Descriptor* descriptor, const char* uri, const char* fil
raptor_serialize_end(serializer);
raptor_free_serializer(serializer);
raptor_finish();
+#endif
+ RDFWriter writer;
+
+ writer.add_prefix("lv2", "http://lv2plug.in/ontology#");
+ writer.add_prefix("doap", "http://usefulinc.com/ns/doap#");
+
+ writer.start_to_filename(filename);
+
+ RdfId plugin_id = RdfId(RdfId::RESOURCE, uri);
+
+ writer.write(plugin_id,
+ RdfId(RdfId::RESOURCE, "rdf:type"),
+ RdfId(RdfId::RESOURCE, "lv2:Plugin"));
+
+ writer.write(plugin_id,
+ RdfId(RdfId::RESOURCE, "doap:name"),
+ Atom(descriptor->Name));
+
+ if (LADSPA_IS_HARD_RT_CAPABLE(descriptor->Properties))
+ writer.write(plugin_id,
+ RdfId(RdfId::RESOURCE, "lv2:property"),
+ RdfId(RdfId::RESOURCE, "lv2:hardRTCapable"));
+
+ for (uint32_t i=0; i < descriptor->PortCount; ++i) {
+ char index_str[32];
+ snprintf(index_str, 32, "%u", i);
+
+ RdfId port_id(RdfId::ANONYMOUS, index_str);
+
+ writer.write(plugin_id,
+ RdfId(RdfId::RESOURCE, "lv2:port"),
+ port_id);
+
+ writer.write(port_id,
+ RdfId(RdfId::RESOURCE, "lv2:index"),
+ Atom((int32_t)i));
+
+ writer.write(port_id,
+ RdfId(RdfId::RESOURCE, "lv2:dataType"),
+ RdfId(RdfId::RESOURCE, "lv2:float"));
+
+ writer.write(port_id,
+ RdfId(RdfId::RESOURCE, "lv2:name"),
+ Atom(descriptor->PortNames[i]));
+ }
+
+ writer.finish();
}