Mercurial > hg > svcore
comparison plugin/LADSPAPluginFactory.cpp @ 1498:850bc66d6a70
Tidy up debug output
author | Chris Cannam |
---|---|
date | Mon, 13 Aug 2018 15:37:31 +0100 |
parents | 900601b954f2 |
children | 70e172e6cc59 |
comparison
equal
deleted
inserted
replaced
1497:900601b954f2 | 1498:850bc66d6a70 |
---|---|
420 PluginIdentifier::parseIdentifier(identifier, type, soname, label); | 420 PluginIdentifier::parseIdentifier(identifier, type, soname, label); |
421 | 421 |
422 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { | 422 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { |
423 loadLibrary(soname); | 423 loadLibrary(soname); |
424 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { | 424 if (m_libraryHandles.find(soname) == m_libraryHandles.end()) { |
425 cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname << endl; | 425 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: loadLibrary failed for " << soname << endl; |
426 return 0; | 426 return 0; |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 void *libraryHandle = m_libraryHandles[soname]; | 430 void *libraryHandle = m_libraryHandles[soname]; |
431 | 431 |
432 LADSPA_Descriptor_Function fn = (LADSPA_Descriptor_Function) | 432 LADSPA_Descriptor_Function fn = (LADSPA_Descriptor_Function) |
433 DLSYM(libraryHandle, "ladspa_descriptor"); | 433 DLSYM(libraryHandle, "ladspa_descriptor"); |
434 | 434 |
435 if (!fn) { | 435 if (!fn) { |
436 cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname << endl; | 436 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No descriptor function in library " << soname << endl; |
437 return 0; | 437 return 0; |
438 } | 438 } |
439 | 439 |
440 const LADSPA_Descriptor *descriptor = 0; | 440 const LADSPA_Descriptor *descriptor = 0; |
441 | 441 |
443 while ((descriptor = fn(index))) { | 443 while ((descriptor = fn(index))) { |
444 if (descriptor->Label == label) return descriptor; | 444 if (descriptor->Label == label) return descriptor; |
445 ++index; | 445 ++index; |
446 } | 446 } |
447 | 447 |
448 cerr << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No such plugin as " << label << " in library " << soname << endl; | 448 SVCERR << "WARNING: LADSPAPluginFactory::getLADSPADescriptor: No such plugin as " << label << " in library " << soname << endl; |
449 | 449 |
450 return 0; | 450 return 0; |
451 } | 451 } |
452 | 452 |
453 void | 453 void |
460 return; | 460 return; |
461 } | 461 } |
462 | 462 |
463 if (QFileInfo(soName).exists()) { | 463 if (QFileInfo(soName).exists()) { |
464 DLERROR(); | 464 DLERROR(); |
465 cerr << "LADSPAPluginFactory::loadLibrary: Library \"" << soName << "\" exists, but failed to load it" << endl; | 465 SVCERR << "LADSPAPluginFactory::loadLibrary: Library \"" << soName << "\" exists, but failed to load it" << endl; |
466 return; | 466 return; |
467 } | 467 } |
468 | 468 |
469 std::vector<QString> pathList = getPluginPath(); | 469 std::vector<QString> pathList = getPluginPath(); |
470 | 470 |
482 QDir::Name | QDir::IgnoreCase, | 482 QDir::Name | QDir::IgnoreCase, |
483 QDir::Files | QDir::Readable); | 483 QDir::Files | QDir::Readable); |
484 | 484 |
485 if (QFileInfo(dir.filePath(fileName)).exists()) { | 485 if (QFileInfo(dir.filePath(fileName)).exists()) { |
486 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY | 486 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY |
487 cerr << "Loading: " << fileName << endl; | 487 SVDEBUG << "Loading: " << fileName << endl; |
488 #endif | 488 #endif |
489 libraryHandle = DLOPEN(dir.filePath(fileName), RTLD_NOW); | 489 libraryHandle = DLOPEN(dir.filePath(fileName), RTLD_NOW); |
490 if (libraryHandle) { | 490 if (libraryHandle) { |
491 m_libraryHandles[soName] = libraryHandle; | 491 m_libraryHandles[soName] = libraryHandle; |
492 return; | 492 return; |
495 | 495 |
496 for (unsigned int j = 0; j < dir.count(); ++j) { | 496 for (unsigned int j = 0; j < dir.count(); ++j) { |
497 QString file = dir.filePath(dir[j]); | 497 QString file = dir.filePath(dir[j]); |
498 if (QFileInfo(file).baseName() == base) { | 498 if (QFileInfo(file).baseName() == base) { |
499 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY | 499 #ifdef DEBUG_LADSPA_PLUGIN_FACTORY |
500 cerr << "Loading: " << file << endl; | 500 SVDEBUG << "Loading: " << file << endl; |
501 #endif | 501 #endif |
502 libraryHandle = DLOPEN(file, RTLD_NOW); | 502 libraryHandle = DLOPEN(file, RTLD_NOW); |
503 if (libraryHandle) { | 503 if (libraryHandle) { |
504 m_libraryHandles[soName] = libraryHandle; | 504 m_libraryHandles[soName] = libraryHandle; |
505 return; | 505 return; |
506 } | 506 } |
507 } | 507 } |
508 } | 508 } |
509 } | 509 } |
510 | 510 |
511 cerr << "LADSPAPluginFactory::loadLibrary: Failed to locate plugin library \"" << soName << "\"" << endl; | 511 SVCERR << "LADSPAPluginFactory::loadLibrary: Failed to locate plugin library \"" << soName << "\"" << endl; |
512 } | 512 } |
513 | 513 |
514 void | 514 void |
515 LADSPAPluginFactory::unloadLibrary(QString soName) | 515 LADSPAPluginFactory::unloadLibrary(QString soName) |
516 { | 516 { |