comparison plugin/FeatureExtractionPluginFactory.cpp @ 1167:7c4f4701b49f

Debug bits
author Chris Cannam
date Fri, 22 Jan 2016 09:52:08 +0000
parents 4607603c46d0
children 6877f4200912
comparison
equal deleted inserted replaced
1166:4607603c46d0 1167:7c4f4701b49f
162 if (!bad.empty()) { 162 if (!bad.empty()) {
163 warningMessage = 163 warningMessage =
164 QObject::tr("<b>Failed to load plugins</b>" 164 QObject::tr("<b>Failed to load plugins</b>"
165 "<p>Failed to load one or more plugin libraries:</p>\n"); 165 "<p>Failed to load one or more plugin libraries:</p>\n");
166 warningMessage += "<ul>"; 166 warningMessage += "<ul>";
167 for (int i = 0; i < bad.size(); ++i) { 167 for (int i = 0; in_range_for(bad, i); ++i) {
168 QString m; 168 QString m;
169 if (badStatuses[i] == PluginLoadFailedToLoadLibrary) { 169 if (badStatuses[i] == PluginLoadFailedToLoadLibrary) {
170 m = QObject::tr("Failed to load library"); 170 m = QObject::tr("Failed to load library");
171 } else if (badStatuses[i] == PluginLoadFailedToFindDescriptor) { 171 } else if (badStatuses[i] == PluginLoadFailedToFindDescriptor) {
172 m = QObject::tr("Failed to query plugins from library after loading"); 172 m = QObject::tr("Failed to query plugins from library after loading");
374 int index = 0; 374 int index = 0;
375 375
376 QString type, soname, label; 376 QString type, soname, label;
377 PluginIdentifier::parseIdentifier(identifier, type, soname, label); 377 PluginIdentifier::parseIdentifier(identifier, type, soname, label);
378 if (type != "vamp") { 378 if (type != "vamp") {
379 cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Wrong factory for plugin type " << type << endl; 379 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
380 cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Wrong factory for plugin type " << type << endl;
381 #endif
380 return 0; 382 return 0;
381 } 383 }
382 384
383 QString found = findPluginFile(soname); 385 QString found = findPluginFile(soname);
384 386
437 if (DLCLOSE(libraryHandle) != 0) { 439 if (DLCLOSE(libraryHandle) != 0) {
438 cerr << "WARNING: FeatureExtractionPluginFactory::instantiatePlugin: Failed to unload library " << soname << endl; 440 cerr << "WARNING: FeatureExtractionPluginFactory::instantiatePlugin: Failed to unload library " << soname << endl;
439 } 441 }
440 } 442 }
441 443
442 // SVDEBUG << "FeatureExtractionPluginFactory::instantiatePlugin: Instantiated plugin " << label << " from library " << soname << ": descriptor " << descriptor << ", rv "<< rv << ", label " << rv->getName() << ", outputs " << rv->getOutputDescriptors().size() << endl; 444 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
445 cerr << "FeatureExtractionPluginFactory::instantiatePlugin: Instantiated plugin " << label << " from library " << soname << ": descriptor " << descriptor << ", rv "<< rv << ", label " << rv->getName() << ", outputs " << rv->getOutputDescriptors().size() << endl;
446 #endif
443 447
444 return rv; 448 return rv;
445 } 449 }
446 450
447 void 451 void
448 FeatureExtractionPluginFactory::pluginDeleted(Vamp::Plugin *plugin) 452 FeatureExtractionPluginFactory::pluginDeleted(Vamp::Plugin *plugin)
449 { 453 {
450 void *handle = m_handleMap[plugin]; 454 void *handle = m_handleMap[plugin];
451 if (handle) { 455 if (handle) {
452 // SVDEBUG << "unloading library " << handle << " for plugin " << plugin << endl; 456 #ifdef DEBUG_PLUGIN_SCAN_AND_INSTANTIATE
457 cerr << "unloading library " << handle << " for plugin " << plugin << endl;
458 #endif
453 DLCLOSE(handle); 459 DLCLOSE(handle);
454 } 460 }
455 m_handleMap.erase(plugin); 461 m_handleMap.erase(plugin);
456 } 462 }
457 463