Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class LMMS_EXPORT LmmsCore : public QObject
return s_projectJournal;
}

static bool ignorePluginBlacklist();

#ifdef LMMS_HAVE_LV2
static class Lv2Manager * getLv2Manager()
{
Expand Down
8 changes: 8 additions & 0 deletions include/Lv2Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ class Lv2Manager
}
bool isFeatureSupported(const char* featName) const;

static const std::set<const char*, Lv2Manager::CmpStr>& getPluginBlacklist()
{
return pluginBlacklist;
}

private:
// general data
bool m_debug; //!< if set, debug output will be printed
Expand All @@ -144,6 +149,9 @@ class Lv2Manager
// URID cache for fast URID access
Lv2UridCache m_uridCache;

// static
static const std::set<const char*, Lv2Manager::CmpStr> pluginBlacklist;

// functions
bool isSubclassOf(const LilvPluginClass *clvss, const char *uriStr);
};
Expand Down
2 changes: 2 additions & 0 deletions include/PluginIssue.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum PluginIssueType
portHasNoMax,
featureNotSupported, //!< plugin requires functionality LMMS can't offer
badPortType, //!< port type not supported
blacklisted,
noIssue
};

Expand All @@ -60,6 +61,7 @@ class PluginIssue
: m_issueType(it), m_info(msg)
{
}
PluginIssueType type() const { return m_issueType; }
friend QDebug operator<<(QDebug stream, const PluginIssue& iss);
};

Expand Down
12 changes: 12 additions & 0 deletions src/core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ void LmmsCore::destroy()
delete ConfigManager::inst();
}




bool LmmsCore::ignorePluginBlacklist()
{
const char* envVar = getenv("LMMS_IGNORE_BLACKLIST");
return (envVar && *envVar);
}




float LmmsCore::framesPerTick(sample_rate_t sampleRate)
{
return sampleRate * 60.0f * 4 /
Expand Down
2 changes: 2 additions & 0 deletions src/core/PluginIssue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const char *PluginIssue::msgFor(const PluginIssueType &it)
return "required feature not supported";
case badPortType:
return "unsupported port type";
case blacklisted:
return "blacklisted plugin";
case noIssue:
return nullptr;
}
Expand Down
38 changes: 38 additions & 0 deletions src/core/lv2/Lv2Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#ifdef LMMS_HAVE_LV2

#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <lilv/lilv.h>
Expand All @@ -36,6 +37,7 @@
#include <QElapsedTimer>

#include "ConfigManager.h"
#include "Engine.h"
#include "Plugin.h"
#include "PluginFactory.h"
#include "Lv2ControlBase.h"
Expand All @@ -44,6 +46,16 @@



const std::set<const char*, Lv2Manager::CmpStr> Lv2Manager::pluginBlacklist =
{
// github.com/calf-studio-gear/calf, #278
"http://calf.sourceforge.net/plugins/Analyzer",
"http://calf.sourceforge.net/plugins/BassEnhancer"
};




Lv2Manager::Lv2Manager() :
m_uridCache(m_uridMap)
{
Expand Down Expand Up @@ -100,6 +112,7 @@ void Lv2Manager::initPlugins()
QElapsedTimer timer;
timer.start();

unsigned blacklisted = 0;
LILV_FOREACH(plugins, itr, plugins)
{
const LilvPlugin* curPlug = lilv_plugins_get(plugins, itr);
Expand All @@ -111,6 +124,15 @@ void Lv2Manager::initPlugins()
m_lv2InfoMap[lilv_node_as_uri(lilv_plugin_get_uri(curPlug))]
= std::move(info);
if(issues.empty()) { ++pluginsLoaded; }
else
{
if(std::any_of(issues.begin(), issues.end(),
[](const PluginIssue& iss) {
return iss.type() == PluginIssueType::blacklisted; }))
{
++blacklisted;
}
}
++pluginCount;
}

Expand All @@ -133,6 +155,22 @@ void Lv2Manager::initPlugins()
" environment variable \"LMMS_LV2_DEBUG\" to nonempty.";
}
}

// TODO: might be better in the LMMS core
if(Engine::ignorePluginBlacklist())
{
qWarning() <<
"WARNING! Plugin blacklist disabled! If you want to use the blacklist,\n"
" please set environment variable \"LMMS_IGNORE_BLACKLIST\" to empty or\n"
" do not set it.";
}
else if(blacklisted > 0)
{
qDebug() <<
"Lv2 Plugins blacklisted:" << blacklisted << "of" << pluginCount << "\n"
" If you want to ignore the blacklist (dangerous!), please set\n"
" environment variable \"LMMS_IGNORE_BLACKLIST\" to nonempty.";
}
}


Expand Down
13 changes: 13 additions & 0 deletions src/core/lv2/Lv2Proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ Plugin::PluginTypes Lv2Proc::check(const LilvPlugin *plugin,
unsigned audioChannels[maxCount] = { 0, 0 }; // audio input and output count
unsigned midiChannels[maxCount] = { 0, 0 }; // MIDI input and output count

const char* pluginUri = lilv_node_as_uri(lilv_plugin_get_uri(plugin));
//qDebug() << "Checking plugin" << pluginUri << "...";

// TODO: manage a global blacklist outside of the code
// for now, this will help
// this is only a fix for the meantime
const auto& pluginBlacklist = Lv2Manager::getPluginBlacklist();
if (!Engine::ignorePluginBlacklist() &&
pluginBlacklist.find(pluginUri) != pluginBlacklist.end())
{
issues.emplace_back(blacklisted);
}

for (unsigned portNum = 0; portNum < maxPorts; ++portNum)
{
Lv2Ports::Meta meta;
Expand Down