2 // LADSPAInfo.h - Header file for LADSPA Plugin info class
4 // Copyleft (C) 2002 Mike Rawes <myk@waxfrenzy.org>
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __ladspa_info_h__
22 #define __ladspa_info_h__
24 // #include <config.h>
35 // If override is false, examine $LADSPA_PATH
36 // Also examine supplied path list
37 // For all paths, add basic plugin information for later lookup,
38 // instantiation and so on.
39 LADSPAInfo(bool override
= false, const char *path_list
= "");
41 // Unload all loaded plugins and clean up
44 // ************************************************************************
45 // Loading/Unloading plugin libraries
47 // At first, no library dlls are loaded.
49 // A plugin library may have more than one plugin descriptor. The
50 // descriptor is used to instantiate, activate, execute plugin instances.
51 // Administration of plugin instances are outwith the scope of this class,
52 // instead, descriptors are requested using GetDecriptorByID, and disposed
53 // of using DiscardDescriptorByID.
55 // Each library keeps a reference count of descriptors requested. A library
56 // is loaded when a descriptor is requested for the first time, and remains
57 // loaded until the number of discards matches the number of requests.
59 // Rescan all paths in $LADSPA_PATH, as per constructor.
60 // This will also unload all libraries, and make any descriptors that
61 // have not been discarded with DiscardDescriptorByID invalid.
62 void RescanPlugins(void);
64 // Unload all dlopened libraries. This will make any descriptors that
65 // have not been discarded with DiscardDescriptorByID invalid.
66 void UnloadAllLibraries(void);
68 // Get descriptor of plugin with given ID. This increments the descriptor
69 // count for the corresponding library.
70 const LADSPA_Descriptor
*GetDescriptorByID(unsigned long unique_id
);
72 // Notify that a descriptor corresponding to the given ID has been
73 // discarded. This decrements the descriptor count for the corresponding
75 void DiscardDescriptorByID(unsigned long unique_id
);
77 // ************************************************************************
78 // SSM Specific options
80 // Get unique ID of plugin identified by given library filename and label.
81 // This is for backwards compatibility with older versions of SSM where the
82 // path and label of the plugin was stored in the configuration - current
83 // versions store the Unique ID
84 unsigned long GetIDFromFilenameAndLabel(std::string filename
,
87 // Struct for plugin information returned by queries
91 unsigned long UniqueID
;
94 bool operator<(const PluginEntry
& pe
)
96 return (Name
<pe
.Name
);
100 // Get ordered list of plugin names and IDs for plugin menu
101 const std::vector
<PluginEntry
> GetMenuList(void);
103 // Get the index in the above list for given Unique ID
104 // If not found, this returns the size of the above list
105 unsigned long GetPluginListEntryByID(unsigned long unique_id
);
107 // Get the number of input ports for the plugin with the most
109 unsigned long GetMaxInputPortCount(void) { return m_MaxInputPortCount
; }
112 // See LADSPAInfo.C for comments on these functions
113 void DescendGroup(std::string prefix
,
114 const std::string group
,
116 std::list
<std::string
> GetSubGroups(const std::string group
);
119 void ScanPathList(const char *path_list
,
120 void (LADSPAInfo::*ExamineFunc
)(const std::string
,
122 void ExaminePluginLibrary(const std::string path
,
123 const std::string basename
);
125 bool CheckPlugin(const LADSPA_Descriptor
*desc
);
126 LADSPA_Descriptor_Function
GetDescriptorFunctionForLibrary(unsigned long library_index
);
128 void ExamineRDFFile(const std::string path
,
129 const std::string basename
);
130 void MetadataRDFDescend(const char *uri
,
131 unsigned long parent
);
134 // For cached library information
137 unsigned long PathIndex
; // Index of path in m_Paths
138 std::string Basename
; // Filename
139 unsigned long RefCount
; // Count of descriptors requested
140 void *Handle
; // DLL Handle, NULL
143 // For cached plugin information
146 unsigned long LibraryIndex
; // Index of library in m_Libraries
147 unsigned long Index
; // Plugin index in library
148 unsigned long UniqueID
; // Unique ID
149 std::string Label
; // Plugin label
150 std::string Name
; // Plugin Name
151 const LADSPA_Descriptor
*Descriptor
; // Descriptor, NULL
154 // For cached RDF uri information
157 std::string URI
; // Full URI for use with lrdf
158 std::string Label
; // Label
159 std::vector
<unsigned long> Parents
; // Index of parents in m_RDFURIs
160 std::vector
<unsigned long> Children
; // Indices of children in m_RDFURIs
161 std::vector
<unsigned long> Plugins
; // Indices of plugins in m_Plugins
165 typedef std::map
<unsigned long,
167 std::less
<unsigned long> > IDMap
;
169 typedef std::map
<std::string
,
171 std::less
<std::string
> > StringMap
;
173 bool m_LADSPAPathOverride
;
176 // LADSPA Plugin information database
177 std::vector
<std::string
> m_Paths
;
178 std::vector
<LibraryInfo
> m_Libraries
;
179 std::vector
<PluginInfo
> m_Plugins
;
181 // Plugin lookup maps
185 std::vector
<RDFURIInfo
> m_RDFURIs
;
187 // RDF URI lookup map
188 StringMap m_RDFURILookup
;
190 // RDF Label lookup map
191 StringMap m_RDFLabelLookup
;
194 std::vector
<PluginEntry
> m_SSMMenuList
;
195 StringMap m_FilenameLookup
;
196 unsigned long m_MaxInputPortCount
;
199 #endif // __ladspa_info_h__