diff options
author | David Robillard <d@drobilla.net> | 2007-02-18 23:38:47 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-18 23:38:47 +0000 |
commit | 0153919a422e7a520c38f9cd01e9a079f73c80fd (patch) | |
tree | 2cb063c7d885be9a50da0e5f2c10880a77eb0663 | |
parent | ec3e2125f960aa3de9da474d175bab353745748b (diff) | |
download | lilv-0153919a422e7a520c38f9cd01e9a079f73c80fd.tar.gz lilv-0153919a422e7a520c38f9cd01e9a079f73c80fd.tar.bz2 lilv-0153919a422e7a520c38f9cd01e9a079f73c80fd.zip |
Removed private_types.h (and all exposure of types that shouldn't have been exposed).
git-svn-id: http://svn.drobilla.net/lad/slv2@316 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | slv2/Makefile.am | 1 | ||||
-rw-r--r-- | slv2/plugininstance.h | 57 | ||||
-rw-r--r-- | slv2/types.h | 1 | ||||
-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 (renamed from slv2/private_types.h) | 20 | ||||
-rw-r--r-- | src/query.c | 2 |
9 files changed, 51 insertions, 56 deletions
diff --git a/slv2/Makefile.am b/slv2/Makefile.am index 8ce74f2..d2b863e 100644 --- a/slv2/Makefile.am +++ b/slv2/Makefile.am @@ -3,7 +3,6 @@ slv2includedir = $(includedir)/slv2 slv2include_HEADERS = \ lv2.h \ types.h \ - private_types.h \ slv2.h \ library.h \ plugin.h \ diff --git a/slv2/plugininstance.h b/slv2/plugininstance.h index 1b475c2..e704383 100644 --- a/slv2/plugininstance.h +++ b/slv2/plugininstance.h @@ -26,12 +26,17 @@ extern "C" { #include <assert.h> #include <dlfcn.h> #include <slv2/lv2.h> -#include <slv2/private_types.h> #include <slv2/plugin.h> #include <slv2/port.h> +typedef struct _InstanceImpl* SLV2InstanceImpl; -typedef const struct _Instance SLV2Instance; +/** Instance of a plugin */ +typedef struct _Instance { + const LV2_Descriptor* lv2_descriptor; + LV2_Handle lv2_handle; + SLV2InstanceImpl pimpl; ///< Opaque +} SLV2Instance; /** \defgroup lib Plugin Instance - Shared library access @@ -47,7 +52,7 @@ typedef const struct _Instance SLV2Instance; /** Instantiate a plugin. * * The returned object represents shared library objects loaded into memory, - * it must be cleaned up with slv2instance_free when no longer + * it must be cleaned up with slv2_instance_free when no longer * needed. * * \a plugin is not modified or directly referenced by the returned object @@ -84,9 +89,9 @@ static inline const char* slv2_instance_get_uri(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); - return instance->descriptor->URI; + return instance->lv2_descriptor->URI; } @@ -101,10 +106,10 @@ slv2_instance_connect_port(SLV2Instance* instance, void* data_location) { assert(instance); - assert(instance->descriptor); - assert(instance->descriptor->connect_port); + assert(instance->lv2_descriptor); + assert(instance->lv2_descriptor->connect_port); - instance->descriptor->connect_port + instance->lv2_descriptor->connect_port (instance->lv2_handle, port_index, data_location); } @@ -112,23 +117,23 @@ slv2_instance_connect_port(SLV2Instance* instance, /** Activate a plugin instance. * * This resets all state information in the plugin, except for port data - * locations (as set by slv2instance_connect_port). This MUST be called - * before calling slv2instance_run. + * locations (as set by slv2_instance_connect_port). This MUST be called + * before calling slv2_instance_run. */ static inline void slv2_instance_activate(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); - if (instance->descriptor->activate) - instance->descriptor->activate(instance->lv2_handle); + if (instance->lv2_descriptor->activate) + instance->lv2_descriptor->activate(instance->lv2_handle); } -/** Run \a instance for \a sample_count frames. +/** Run @a instance for @a sample_count frames. * - * If the hint lv2:realtimeSafe is set for this plugin, this function is + * If the hint lv2:hardRtCapable is set for this plugin, this function is * guaranteed not to block. */ static inline void @@ -136,11 +141,11 @@ slv2_instance_run(SLV2Instance* instance, uint32_t sample_count) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); assert(instance->lv2_handle), - assert(instance->descriptor->run); + assert(instance->lv2_descriptor->run); - instance->descriptor->run(instance->lv2_handle, sample_count); + instance->lv2_descriptor->run(instance->lv2_handle, sample_count); } @@ -153,18 +158,18 @@ static inline void slv2_instance_deactivate(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); assert(instance->lv2_handle); - if (instance->descriptor->deactivate) - instance->descriptor->deactivate(instance->lv2_handle); + if (instance->lv2_descriptor->deactivate) + instance->lv2_descriptor->deactivate(instance->lv2_handle); } /** Get the LV2_Descriptor of the plugin instance. * * Normally hosts should not need to access the LV2_Descriptor directly, - * use the slv2instance_* functions. + * use the slv2_instance_* functions. * * The returned descriptor is shared and must not be deleted. */ @@ -172,16 +177,16 @@ static inline const LV2_Descriptor* slv2_instance_get_descriptor(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); - return instance->descriptor; + return instance->lv2_descriptor; } /** Get the LV2_Handle of the plugin instance. * * Normally hosts should not need to access the LV2_Handle directly, - * use the slv2instance_* functions. + * use the slv2_instance_* functions. * * The returned handle is shared and must not be deleted. */ @@ -189,7 +194,7 @@ static inline LV2_Handle slv2_instance_get_handle(SLV2Instance* instance) { assert(instance); - assert(instance->descriptor); + assert(instance->lv2_descriptor); return instance->lv2_handle; } diff --git a/slv2/types.h b/slv2/types.h index b1b115c..dd7480c 100644 --- a/slv2/types.h +++ b/slv2/types.h @@ -22,7 +22,6 @@ #include <stddef.h> #include <stdbool.h> #include <stdint.h> -//#include <slv2/private_types.h> #ifdef __cplusplus extern "C" { 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/slv2/private_types.h b/src/private_types.h index 906d89c..0d755f8 100644 --- a/slv2/private_types.h +++ b/src/private_types.h @@ -29,16 +29,6 @@ extern "C" { #include <slv2/lv2.h> -/* @file private_types.h - * - * If you're a user of SLV2, stop reading this RIGHT NOW :) - * Unfortunately it needs to be exposed to allow inlining of some things that - * really need to be inlined, but these are opaque types. - * - * DO NOT WRITE CODE THAT DEPENDS ON DEFINITIONS IN THIS FILE - */ - - /** Record of an installed/available plugin. * * A simple reference to a plugin somewhere on the system. This just holds @@ -52,13 +42,9 @@ struct _Plugin { }; -/** Instance of a plugin (private type) */ -struct _Instance { - // FIXME: copy plugin here for convenience? - //struct LV2Plugin* plugin; - const LV2_Descriptor* descriptor; - void* lib_handle; - LV2_Handle lv2_handle; +/** Pimpl portion of SLV2Instance */ +struct _InstanceImpl { + void* lib_handle; }; 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* |