From eee1f5fa6f285d304c1a987d0d83fa86bc1573c3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 27 Apr 2011 17:36:06 +0000 Subject: More flexible discovery API (particularly for anything dynamic). --- ext/pui.lv2/pui.h | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'ext/pui.lv2') diff --git a/ext/pui.lv2/pui.h b/ext/pui.lv2/pui.h index 660059c..257c792 100644 --- a/ext/pui.lv2/pui.h +++ b/ext/pui.lv2/pui.h @@ -318,18 +318,53 @@ typedef struct _LV2_PUI_Descriptor { } LV2_PUI_Descriptor; +typedef void* LV2_PUI_Lib_Data; + +/** + Descriptor for a plugin UI library. + + Each plugin UI shared library has exactly one of these objects, accessed + via the lv2_pui_lib_descriptor() function in that library. +*/ +typedef struct { + /** + Opaque library data which must be passed as the first parameter to + all the methods of this struct. + */ + LV2_PUI_Lib_Data lib_data; + + void (*cleanup)(LV2_PUI_Lib_Data lib_data); + + /** + Prototype for UI accessor function. + + This function follows the same rules as lv2_descriptor(), except it + applies to UIs rather than plugins. + */ + LV2_PUI_Descriptor const* (*pui_descriptor)(LV2_PUI_Lib_Data lib_data, + uint32_t index); + +} LV2_PUI_Lib_Descriptor; + /** - Prototype for UI accessor function. + Prototype for UI library accessor function. - This function follows the same rules as lv2_desciprotr(), except it applies - to UIs rather than plugins. + This is the entry point for a plugin UI library. Hosts load this symbol + from the library and call this function to obtain a library descriptor which + can be used to access all the UIs contained in this library. The returned + object must not be destroyed (with LV2_PUI_Lib_Descriptor::cleanup()) until + all UIs loaded from that library have been destroyed. */ -LV2_PUI_Descriptor const* lv2ui_descriptor(uint32_t index); +LV2_PUI_Lib_Descriptor const* lv2_pui_lib_descriptor( + const char* bundle_path, + LV2_Feature const* const* features); /** - Type of the lv2ui_descriptor() function in a UI library. + Type of the lv2_pui_lib_descriptor() function in a UI library. */ -typedef LV2_PUI_Descriptor const* (*LV2_PUI_DescriptorFunction)(uint32_t index); +typedef LV2_PUI_Lib_Descriptor const* (*LV2_PUI_Lib_Descriptor_Func)( + const char* bundle_path, + LV2_Feature const* const* features); #ifdef __cplusplus } -- cgit v1.2.1