Chris@4
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@5
|
2 /*
|
Chris@5
|
3 Copyright (c) 2016 Queen Mary, University of London
|
Chris@5
|
4
|
Chris@5
|
5 Permission is hereby granted, free of charge, to any person
|
Chris@5
|
6 obtaining a copy of this software and associated documentation
|
Chris@5
|
7 files (the "Software"), to deal in the Software without
|
Chris@5
|
8 restriction, including without limitation the rights to use, copy,
|
Chris@5
|
9 modify, merge, publish, distribute, sublicense, and/or sell copies
|
Chris@5
|
10 of the Software, and to permit persons to whom the Software is
|
Chris@5
|
11 furnished to do so, subject to the following conditions:
|
Chris@5
|
12
|
Chris@5
|
13 The above copyright notice and this permission notice shall be
|
Chris@5
|
14 included in all copies or substantial portions of the Software.
|
Chris@5
|
15
|
Chris@5
|
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@5
|
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@5
|
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
Chris@5
|
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
Chris@5
|
20 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@5
|
21 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@5
|
22 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@5
|
23
|
Chris@5
|
24 Except as contained in this notice, the names of the Centre for
|
Chris@5
|
25 Digital Music and Queen Mary, University of London shall not be
|
Chris@5
|
26 used in advertising or otherwise to promote the sale, use or other
|
Chris@5
|
27 dealings in this Software without prior written authorization.
|
Chris@5
|
28 */
|
Chris@4
|
29
|
Chris@4
|
30 #ifndef KNOWN_PLUGINS_H
|
Chris@4
|
31 #define KNOWN_PLUGINS_H
|
Chris@4
|
32
|
Chris@4
|
33 #include "plugincandidates.h"
|
Chris@4
|
34
|
Chris@4
|
35 #include <string>
|
Chris@4
|
36 #include <map>
|
Chris@4
|
37 #include <vector>
|
Chris@4
|
38
|
Chris@4
|
39 class KnownPlugins
|
Chris@4
|
40 {
|
Chris@4
|
41 typedef std::vector<std::string> stringlist;
|
Chris@4
|
42
|
Chris@4
|
43 public:
|
Chris@4
|
44 enum PluginType {
|
Chris@19
|
45 VampPlugin,
|
Chris@19
|
46 LADSPAPlugin,
|
Chris@19
|
47 DSSIPlugin
|
Chris@4
|
48 };
|
Chris@4
|
49
|
Chris@6
|
50 KnownPlugins(std::string helperExecutableName,
|
Chris@6
|
51 PluginCandidates::LogCallback *cb = 0);
|
Chris@4
|
52
|
Chris@4
|
53 std::vector<PluginType> getKnownPluginTypes() const {
|
Chris@19
|
54 return { VampPlugin, LADSPAPlugin, DSSIPlugin };
|
Chris@4
|
55 };
|
Chris@4
|
56
|
Chris@4
|
57 std::string getTagFor(PluginType type) const {
|
Chris@19
|
58 return m_known.at(type).tag;
|
Chris@4
|
59 }
|
Chris@4
|
60
|
Chris@4
|
61 stringlist getCandidateLibrariesFor(PluginType type) const {
|
Chris@19
|
62 return m_candidates.getCandidateLibrariesFor(getTagFor(type));
|
Chris@4
|
63 }
|
Chris@4
|
64
|
Chris@21
|
65 std::string getHelperExecutableName() const {
|
Chris@21
|
66 return m_helperExecutableName;
|
Chris@21
|
67 }
|
Chris@21
|
68
|
Chris@4
|
69 std::string getFailureReport() const;
|
Chris@4
|
70
|
Chris@4
|
71 private:
|
Chris@4
|
72 struct TypeRec {
|
Chris@19
|
73 std::string tag;
|
Chris@19
|
74 stringlist path;
|
Chris@19
|
75 std::string descriptor;
|
Chris@4
|
76 };
|
Chris@4
|
77 std::map<PluginType, TypeRec> m_known;
|
Chris@4
|
78
|
Chris@4
|
79 stringlist expandConventionalPath(PluginType type, std::string var);
|
Chris@4
|
80 std::string getDefaultPath(PluginType type);
|
Chris@4
|
81
|
Chris@4
|
82 PluginCandidates m_candidates;
|
Chris@20
|
83 std::string m_helperExecutableName;
|
Chris@20
|
84
|
Chris@20
|
85 bool is32bit() const; // true if helper looks to be 32-bit on 64-bit system
|
Chris@4
|
86 };
|
Chris@4
|
87
|
Chris@4
|
88 #endif
|