Chris@1178: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1178: Chris@1178: /* Chris@1178: Sonic Visualiser Chris@1178: An audio file viewer and annotation editor. Chris@1178: Centre for Digital Music, Queen Mary, University of London. Chris@1178: Chris@1178: This program is free software; you can redistribute it and/or Chris@1178: modify it under the terms of the GNU General Public License as Chris@1178: published by the Free Software Foundation; either version 2 of the Chris@1178: License, or (at your option) any later version. See the file Chris@1178: COPYING included with this distribution for more information. Chris@1178: */ Chris@1178: Chris@1178: #ifndef PLUGIN_SCAN_H Chris@1178: #define PLUGIN_SCAN_H Chris@1178: Chris@1178: #include Chris@1246: #include Chris@1241: #include Chris@1246: #include Chris@1178: Chris@1501: #ifdef HAVE_PLUGIN_CHECKER_HELPER Chris@1501: #include "checker/knownplugincandidates.h" Chris@1501: #else Chris@1501: class KnownPluginCandidates {}; Chris@1501: #endif Chris@1178: Chris@1180: class PluginScan Chris@1178: { Chris@1178: public: Chris@1178: static PluginScan *getInstance(); Chris@1178: Chris@1249: /** Chris@1249: * Carry out startup scan of available plugins. Do not call Chris@1249: * getCandidateLibrariesFor() unless this has been called and Chris@1249: * scanSucceeded() is returning true. Chris@1249: */ Chris@1241: void scan(); Chris@1179: Chris@1249: /** Chris@1249: * Return true if scan() completed successfully. If the scan Chris@1249: * failed, consider using the normal plugin path to load any Chris@1249: * available plugins (as if they had all been found to be Chris@1249: * loadable) rather than rejecting all of them -- i.e. consider Chris@1249: * falling back on the behaviour of code from before the scan Chris@1249: * logic was added. Chris@1249: */ Chris@1179: bool scanSucceeded() const; Chris@1178: Chris@1180: enum PluginType { Chris@1429: VampPlugin, Chris@1429: LADSPAPlugin, Chris@1429: DSSIPlugin Chris@1180: }; Chris@1246: struct Candidate { Chris@1249: QString libraryPath; // full path, not just soname Chris@1249: QString helperTag; // identifies the helper that found it Chris@1249: // (see HelperExecPath) Chris@1246: }; Chris@1249: Chris@1249: /** Chris@1249: * Return the candidate plugin libraries of the given type that Chris@1249: * were found by helpers during the startup scan. Chris@1249: * Chris@1249: * This could return an empty list for two reasons: the scan Chris@1249: * succeeded but no libraries were found; or the scan failed. Call Chris@1249: * scanSucceeded() to distinguish between them. Chris@1249: */ Chris@1246: QList getCandidateLibrariesFor(PluginType) const; Chris@1178: Chris@1178: QString getStartupFailureReport() const; Chris@1178: Chris@1178: private: Chris@1178: PluginScan(); Chris@1178: ~PluginScan(); Chris@1241: Chris@1241: void clear(); Chris@1246: Chris@1501: #ifdef HAVE_PLUGIN_CHECKER_HELPER Chris@1501: QString formatFailureReport(QString helperTag, Chris@1501: std::vector) Chris@1501: const; Chris@1501: #endif Chris@1501: Chris@1246: mutable QMutex m_mutex; // while scanning; definitely can't multi-thread this Chris@1241: Chris@1474: std::map m_kp; // tag -> KnownPlugins client Chris@1179: bool m_succeeded; Chris@1180: Chris@1180: class Logger; Chris@1180: Logger *m_logger; Chris@1178: }; Chris@1178: Chris@1178: #endif