Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove term "blacklist" #7365

Merged
merged 3 commits into from
Jul 8, 2024
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
1 change: 1 addition & 0 deletions include/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class LMMS_EXPORT ConfigManager : public QObject

QString defaultVersion() const;

static bool enableBlockedPlugins();

static QStringList availableVstEmbedMethods();
QString vstEmbedMethod() const;
Expand Down
2 changes: 0 additions & 2 deletions include/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ class LMMS_EXPORT Engine : public QObject
return s_projectJournal;
}

static bool ignorePluginBlacklist();

#ifdef LMMS_HAVE_LV2
static class Lv2Manager * getLv2Manager()
{
Expand Down
24 changes: 17 additions & 7 deletions include/Lv2Manager.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Lv2Manager.h - Implementation of Lv2Manager class
*
* Copyright (c) 2018-2023 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
* Copyright (c) 2018-2024 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* This file is part of LMMS - https://lmms.io
*
Expand Down Expand Up @@ -131,14 +131,23 @@ class Lv2Manager
AutoLilvNodes findNodes(const LilvNode *subject,
const LilvNode *predicate, const LilvNode *object);

static const std::set<std::string_view>& getPluginBlacklist()
static bool pluginIsUnstable(const char* pluginUri)
{
return pluginBlacklist;
return unstablePlugins.find(pluginUri) != unstablePlugins.end();
}
static const std::set<std::string_view>& getPluginBlacklistBuffersizeLessThan32()
static bool pluginIsOnlyUsefulWithUi(const char* pluginUri)
{
return pluginBlacklistBuffersizeLessThan32;
return pluginsOnlyUsefulWithUi.find(pluginUri) != pluginsOnlyUsefulWithUi.end();
}
static bool pluginIsUnstableWithBuffersizeLessEqual32(const char* pluginUri)
{
return unstablePluginsBuffersizeLessEqual32.find(pluginUri) !=
unstablePluginsBuffersizeLessEqual32.end();
}

//! Whether the user generally wants a UI (and we generally support that)
//! Since we do not generally support UI right now, this will always return false...
static bool wantUi();

private:
// general data
Expand All @@ -154,8 +163,9 @@ class Lv2Manager
Lv2UridCache m_uridCache;

// static
static const std::set<std::string_view>
pluginBlacklist, pluginBlacklistBuffersizeLessThan32;
static const std::set<std::string_view> unstablePlugins;
static const std::set<std::string_view> pluginsOnlyUsefulWithUi;
static const std::set<std::string_view> unstablePluginsBuffersizeLessEqual32;

// functions
bool isSubclassOf(const LilvPluginClass *clvss, const char *uriStr);
Expand Down
2 changes: 1 addition & 1 deletion include/PluginIssue.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ enum class PluginIssueType
FeatureNotSupported, //!< plugin requires functionality LMMS can't offer
// misc
BadPortType, //!< port type not supported
Blacklisted,
Blocked,
NoIssue
};

Expand Down
8 changes: 7 additions & 1 deletion src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ QString ConfigManager::defaultVersion() const
return LMMS_VERSION;
}

bool ConfigManager::enableBlockedPlugins()
{
const char* envVar = getenv("LMMS_ENABLE_BLOCKED_PLUGINS");
return (envVar && *envVar);
}

QStringList ConfigManager::availableVstEmbedMethods()
{
QStringList methods;
Expand Down Expand Up @@ -512,7 +518,7 @@ void ConfigManager::loadConfigFile(const QString & configFile)
cfg_file.close();
}

// Plugins are searched recursively, blacklist problematic locations
// Plugins are searched recursively, block problematic locations
if( m_vstDir.isEmpty() || m_vstDir == QDir::separator() || m_vstDir == "/" ||
m_vstDir == ensureTrailingSlash( QDir::homePath() ) ||
!QDir( m_vstDir ).exists() )
Expand Down
11 changes: 1 addition & 10 deletions src/core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@ void Engine::destroy()



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




float Engine::framesPerTick(sample_rate_t sampleRate)
{
return sampleRate * 60.0f * 4 /
Expand Down Expand Up @@ -171,4 +162,4 @@ void *Engine::pickDndPluginKey()

Engine * Engine::s_instanceOfMe = nullptr;

} // namespace lmms
} // namespace lmms
8 changes: 4 additions & 4 deletions src/core/PluginIssue.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* PluginIssue.h - PluginIssue class
* PluginIssue.cpp - PluginIssue class implementation
*
* Copyright (c) 2019 Johannes Lorenz <j.git$$$lorenz-ho.me, $$$=@>
* Copyright (c) 2019-2024 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* This file is part of LMMS - https://lmms.io
*
Expand Down Expand Up @@ -68,8 +68,8 @@ const char *PluginIssue::msgFor(const PluginIssueType &it)
return "required feature not supported";
case PluginIssueType::BadPortType:
return "unsupported port type";
case PluginIssueType::Blacklisted:
return "blacklisted plugin";
case PluginIssueType::Blocked:
return "blocked plugin";
case PluginIssueType::NoIssue:
return nullptr;
}
Expand Down
48 changes: 30 additions & 18 deletions src/core/lv2/Lv2Manager.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Lv2Manager.cpp - Implementation of Lv2Manager class
*
* Copyright (c) 2018-2023 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
* Copyright (c) 2018-2024 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* This file is part of LMMS - https://lmms.io
*
Expand Down Expand Up @@ -36,6 +36,7 @@
#include <QElapsedTimer>

#include "AudioEngine.h"
#include "ConfigManager.h"
#include "Engine.h"
#include "Plugin.h"
#include "Lv2ControlBase.h"
Expand All @@ -47,7 +48,7 @@ namespace lmms
{


const std::set<std::string_view> Lv2Manager::pluginBlacklist =
const std::set<std::string_view> Lv2Manager::unstablePlugins =
{
// github.com/calf-studio-gear/calf, #278
"http://calf.sourceforge.net/plugins/Analyzer",
Expand All @@ -67,7 +68,13 @@ const std::set<std::string_view> Lv2Manager::pluginBlacklist =
"http://drobilla.net/plugins/blop/square",
"http://drobilla.net/plugins/blop/triangle",

// Visualization, meters, and scopes etc., won't work until we have gui support
// unstable
"urn:juced:DrumSynth"
};

const std::set<std::string_view> Lv2Manager::pluginsOnlyUsefulWithUi =
{
// Visualization, meters, and scopes etc., won't work if UI is disabled
"http://distrho.sf.net/plugins/ProM",
"http://distrho.sf.net/plugins/glBars",
"http://gareus.org/oss/lv2/meters#spectr30mono",
Expand Down Expand Up @@ -132,13 +139,10 @@ const std::set<std::string_view> Lv2Manager::pluginBlacklist =
"urn:juce:TalFilter2",
"urn:juce:Vex",
"http://zynaddsubfx.sourceforge.net",
"http://geontime.com/geonkick/single",

// unstable
"urn:juced:DrumSynth"
"http://geontime.com/geonkick/single"
};

const std::set<std::string_view> Lv2Manager::pluginBlacklistBuffersizeLessThan32 =
const std::set<std::string_view> Lv2Manager::unstablePluginsBuffersizeLessEqual32 =
{
"http://moddevices.com/plugins/mod-devel/2Voices",
"http://moddevices.com/plugins/mod-devel/Capo",
Expand Down Expand Up @@ -237,7 +241,7 @@ void Lv2Manager::initPlugins()
QElapsedTimer timer;
timer.start();

unsigned blacklisted = 0;
unsigned blocked = 0;
LILV_FOREACH(plugins, itr, plugins)
{
const LilvPlugin* curPlug = lilv_plugins_get(plugins, itr);
Expand Down Expand Up @@ -266,9 +270,9 @@ void Lv2Manager::initPlugins()
{
if(std::any_of(issues.begin(), issues.end(),
[](const PluginIssue& iss) {
return iss.type() == PluginIssueType::Blacklisted; }))
return iss.type() == PluginIssueType::Blocked; }))
{
++blacklisted;
++blocked;
}
}
++pluginCount;
Expand All @@ -295,19 +299,19 @@ void Lv2Manager::initPlugins()
}

// TODO: might be better in the LMMS core
if(Engine::ignorePluginBlacklist())
if(ConfigManager::enableBlockedPlugins())
{
qWarning() <<
"WARNING! Plugin blacklist disabled! If you want to use the blacklist,\n"
" please set environment variable \"LMMS_IGNORE_BLACKLIST\" to empty or\n"
"WARNING! Blocked plugins enabled! If you want to disable them,\n"
" please set environment variable \"LMMS_ENABLE_BLOCKED_PLUGINS\" to empty or\n"
" do not set it.";
}
else if(blacklisted > 0)
else if(blocked > 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.";
"Blocked Lv2 Plugins:" << blocked << "of" << pluginCount << "\n"
" If you want to enable them (dangerous!), please set\n"
" environment variable \"LMMS_ENABLE_BLOCKED_PLUGINS\" to nonempty.";
}
}

Expand All @@ -331,6 +335,14 @@ AutoLilvNodes Lv2Manager::findNodes(const LilvNode *subject,



bool Lv2Manager::wantUi()
{
return false;
}




// unused + untested yet
bool Lv2Manager::isSubclassOf(const LilvPluginClass* clvss, const char* uriStr)
{
Expand Down
25 changes: 13 additions & 12 deletions src/core/lv2/Lv2Proc.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Lv2Proc.cpp - Lv2 processor class
*
* Copyright (c) 2019-2022 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
* Copyright (c) 2019-2024 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
*
* This file is part of LMMS - https://lmms.io
*
Expand Down Expand Up @@ -38,6 +38,7 @@
#include "AudioEngine.h"
#include "AutomatableModel.h"
#include "ComboBoxModel.h"
#include "ConfigManager.h"
#include "Engine.h"
#include "Lv2Features.h"
#include "Lv2Manager.h"
Expand Down Expand Up @@ -74,21 +75,21 @@ Plugin::Type Lv2Proc::check(const LilvPlugin *plugin,
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
// TODO: manage a global list of blocked plugins outside of the code
// for now, this will help
// this is only a fix for the meantime
if (!Engine::ignorePluginBlacklist())
if (!ConfigManager::enableBlockedPlugins())
{
const auto& pluginBlacklist = Lv2Manager::getPluginBlacklist();
const auto& pluginBlacklist32 = Lv2Manager::getPluginBlacklistBuffersizeLessThan32();
if(pluginBlacklist.find(pluginUri) != pluginBlacklist.end())
if( // plugin unstable?
Lv2Manager::pluginIsUnstable(pluginUri) ||
// plugins only useful with UI?
(!Lv2Manager::wantUi() &&
Lv2Manager::pluginIsOnlyUsefulWithUi(pluginUri)) ||
// plugin unstable with 32 or less fpp?
(Engine::audioEngine()->framesPerPeriod() <= 32 &&
Lv2Manager::pluginIsUnstableWithBuffersizeLessEqual32(pluginUri)) )
{
issues.emplace_back(PluginIssueType::Blacklisted);
}
else if(Engine::audioEngine()->framesPerPeriod() <= 32 &&
pluginBlacklist32.find(pluginUri) != pluginBlacklist32.end())
{
issues.emplace_back(PluginIssueType::Blacklisted); // currently no special blacklist category
issues.emplace_back(PluginIssueType::Blocked);
}
}

Expand Down
Loading