diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/plugin.c | 2 | ||||
-rw-r--r-- | src/plugininstance.c | 21 | ||||
-rw-r--r-- | src/pluginlist.c | 2 | ||||
-rw-r--r-- | src/private_types.h | 67 | ||||
-rw-r--r-- | src/query.c | 2 |
6 files changed, 84 insertions, 11 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 43aa62a..02520e1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,7 @@ lib_LTLIBRARIES = libslv2.la libslv2_la_LIBADD = @RASQAL_LIBS@ libslv2_la_SOURCES = \ + private_types.h \ util.h \ plugin.c \ query.c \ diff --git a/src/plugin.c b/src/plugin.c index d3710a4..6571326 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -22,12 +22,12 @@ #include <stdlib.h> #include <assert.h> #include <rasqal.h> -#include <slv2/private_types.h> #include <slv2/plugin.h> #include <slv2/types.h> #include <slv2/query.h> #include <slv2/util.h> #include <slv2/stringlist.h> +#include "private_types.h" SLV2Plugin* diff --git a/src/plugininstance.c b/src/plugininstance.c index ed8abc7..13a659a 100644 --- a/src/plugininstance.c +++ b/src/plugininstance.c @@ -21,11 +21,11 @@ #include <string.h> #include <assert.h> #include <dlfcn.h> -#include <slv2/private_types.h> #include <slv2/types.h> #include <slv2/plugin.h> #include <slv2/plugininstance.h> #include <slv2/util.h> +#include "private_types.h" SLV2Instance* @@ -81,9 +81,12 @@ slv2_plugin_instantiate(const SLV2Plugin* plugin, result = malloc(sizeof(struct _Instance)); /*result->plugin = malloc(sizeof(struct _Plugin)); memcpy(result->plugin, plugin, sizeof(struct _Plugin));*/ - result->descriptor = ld; - result->lib_handle = lib; + result->lv2_descriptor = ld; result->lv2_handle = ld->instantiate(ld, sample_rate, (char*)bundle_path, host_features); + struct _InstanceImpl* impl = malloc(sizeof(struct _InstanceImpl)); + impl->lib_handle = lib; + result->pimpl = impl; + break; } } @@ -101,7 +104,7 @@ slv2_plugin_instantiate(const SLV2Plugin* plugin, // "Connect" all ports to NULL (catches bugs) for (uint32_t i=0; i < slv2_plugin_get_num_ports(plugin); ++i) - result->descriptor->connect_port(result->lv2_handle, i, NULL); + result->lv2_descriptor->connect_port(result->lv2_handle, i, NULL); if (local_host_features) free(host_features); @@ -114,10 +117,12 @@ void slv2_instance_free(SLV2Instance* instance) { struct _Instance* i = (struct _Instance*)instance; - i->descriptor->cleanup(i->lv2_handle); - i->descriptor = NULL; - dlclose(i->lib_handle); - i->lib_handle = NULL; + i->lv2_descriptor->cleanup(i->lv2_handle); + i->lv2_descriptor = NULL; + dlclose(i->pimpl->lib_handle); + i->pimpl->lib_handle = NULL; + free(i->pimpl); + i->pimpl = NULL; free(i); } diff --git a/src/pluginlist.c b/src/pluginlist.c index f030713..d6c1665 100644 --- a/src/pluginlist.c +++ b/src/pluginlist.c @@ -24,12 +24,12 @@ #include <sys/types.h> #include <assert.h> #include <dirent.h> -#include <slv2/private_types.h> #include <slv2/types.h> #include <slv2/plugin.h> #include <slv2/pluginlist.h> #include <slv2/stringlist.h> #include <slv2/util.h> +#include "private_types.h" /* not exposed */ diff --git a/src/private_types.h b/src/private_types.h new file mode 100644 index 0000000..0d755f8 --- /dev/null +++ b/src/private_types.h @@ -0,0 +1,67 @@ +/* SLV2 + * Copyright (C) 2007 Dave Robillard <http://drobilla.net> + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __SLV2_PRIVATE_TYPES_H__ +#define __SLV2_PRIVATE_TYPES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdbool.h> +#include <stddef.h> +#include <raptor.h> +#include <slv2/lv2.h> + + +/** Record of an installed/available plugin. + * + * A simple reference to a plugin somewhere on the system. This just holds + * paths of relevant files, the actual data therein isn't loaded into memory. + */ +struct _Plugin { + char* plugin_uri; + char* bundle_url; // Bundle directory plugin was loaded from + raptor_sequence* data_uris; // rdfs::seeAlso + char* lib_uri; // lv2:binary +}; + + +/** Pimpl portion of SLV2Instance */ +struct _InstanceImpl { + void* lib_handle; +}; + + +/** List of references to plugins available for loading (private type) */ +struct _PluginList { + size_t num_plugins; + struct _Plugin** plugins; +}; + + +/** An ordered, indexable collection of strings. */ +//typedef raptor_sequence* SLV2Strings; + + +#ifdef __cplusplus +} +#endif + +#endif /* __SLV2_PRIVATE_TYPES_H__ */ + diff --git a/src/query.c b/src/query.c index fa3b22b..617b1df 100644 --- a/src/query.c +++ b/src/query.c @@ -24,7 +24,7 @@ #include <slv2/library.h> #include <slv2/util.h> #include <slv2/stringlist.h> -#include <slv2/private_types.h> +#include "private_types.h" char* |