comparison plugin/PluginScan.cpp @ 1178:bf05d9259dbc pluginscan

First cut running (but not yet using output of, or recovering from errors in) the plugin checker at startup
author Chris Cannam
date Thu, 14 Apr 2016 12:12:04 +0100
parents
children 6b1af0f05f06
comparison
equal deleted inserted replaced
1175:4018fc0189bc 1178:bf05d9259dbc
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #include "PluginScan.h"
16
17 #include "base/Debug.h"
18
19 #include <QMutex>
20
21 using std::string;
22
23 PluginScan *PluginScan::getInstance() {
24 static QMutex mutex;
25 static PluginScan *m_instance = 0;
26 mutex.lock();
27 if (!m_instance) m_instance = new PluginScan();
28 mutex.unlock();
29 return m_instance;
30 }
31
32 PluginScan::PluginScan() : m_kp(0) {
33 }
34
35 PluginScan::~PluginScan() {
36 delete m_kp;
37 }
38
39 void
40 PluginScan::log(string message)
41 {
42 SVDEBUG << "PluginScan: " << message;
43 }
44
45 void
46 PluginScan::scan()
47 {
48 delete m_kp;
49 m_kp = new KnownPlugins("./helper", this); //!!!
50 }
51
52 QStringList
53 PluginScan::getCandidateVampLibraries() const
54 {
55 QStringList candidates;
56 if (!m_kp) return candidates;
57 auto c = m_kp->getCandidateLibrariesFor(KnownPlugins::VampPlugin);
58 for (auto s: c) candidates.push_back(s.c_str());
59 return candidates;
60 }
61
62 QStringList
63 PluginScan::getCandidateLADSPALibraries() const
64 {
65 QStringList candidates;
66 if (!m_kp) return candidates;
67 auto c = m_kp->getCandidateLibrariesFor(KnownPlugins::LADSPAPlugin);
68 for (auto s: c) candidates.push_back(s.c_str());
69 return candidates;
70 }
71
72 QStringList
73 PluginScan::getCandidateDSSILibraries() const
74 {
75 QStringList candidates;
76 if (!m_kp) return candidates;
77 auto c = m_kp->getCandidateLibrariesFor(KnownPlugins::DSSIPlugin);
78 for (auto s: c) candidates.push_back(s.c_str());
79 return candidates;
80 }
81
82 QString
83 PluginScan::getStartupFailureReport() const
84 {
85 if (!m_kp) return ""; //!!!???
86 string report = m_kp->getFailureReport();
87 return report.c_str(); //!!! wrap?
88 }
89