comparison plugin/PiperVampPluginFactory.cpp @ 1464:91bb68146dfc

Add getPluginLibraryPath throughout, in order to provide diagnostic about which plugins were loaded from where
author Chris Cannam
date Fri, 11 May 2018 14:11:04 +0100
parents 87ae75da6527
children cee1be4fb8c1
comparison
equal deleted inserted replaced
1463:2b2b58ae8b59 1464:91bb68146dfc
156 if (m_taxonomy.find(identifier) != m_taxonomy.end()) { 156 if (m_taxonomy.find(identifier) != m_taxonomy.end()) {
157 return m_taxonomy[identifier]; 157 return m_taxonomy[identifier];
158 } else { 158 } else {
159 return {}; 159 return {};
160 } 160 }
161 }
162
163 QString
164 PiperVampPluginFactory::getPluginLibraryPath(QString identifier)
165 {
166 // What we want to return here is the file path of the library in
167 // which the plugin was actually found -- we want to be paranoid
168 // about that and not just query
169 // Vamp::HostExt::PluginLoader::getLibraryPathForPlugin to return
170 // what the SDK thinks the likely location would be (in case our
171 // search order turns out to have been different)
172
173 QStringList bits = identifier.split(':');
174 if (bits.size() > 1) {
175 QString soname = bits[bits.size() - 2];
176 auto i = m_libraries.find(soname);
177 if (i != m_libraries.end()) {
178 return i->second;
179 }
180 }
181 return QString();
161 } 182 }
162 183
163 void 184 void
164 PiperVampPluginFactory::populate(QString &errorMessage) 185 PiperVampPluginFactory::populate(QString &errorMessage)
165 { 186 {
194 for (const auto &c: candidateLibraries) { 215 for (const auto &c: candidateLibraries) {
195 if (c.helperTag == tag) { 216 if (c.helperTag == tag) {
196 string soname = QFileInfo(c.libraryPath).baseName().toStdString(); 217 string soname = QFileInfo(c.libraryPath).baseName().toStdString();
197 SVDEBUG << "INFO: For tag \"" << tag << "\" giving library " << soname << endl; 218 SVDEBUG << "INFO: For tag \"" << tag << "\" giving library " << soname << endl;
198 from.push_back(soname); 219 from.push_back(soname);
220 m_libraries[QString::fromStdString(soname)] = c.libraryPath;
199 } 221 }
200 } 222 }
201 223
202 if (from.empty()) { 224 if (from.empty()) {
203 SVDEBUG << "PiperVampPluginFactory: No candidate libraries for tag \"" 225 SVDEBUG << "PiperVampPluginFactory: No candidate libraries for tag \""