vapoursynth: Add option to enable/disable user plugin loading

On Windows, plugins are shipped with Aegisub now and loaded from
aegisub_vs.py, so user plugins installed out of Aegisub are more
likely to just interfere with that (like when the user has an
old version of libvslsmashsource installed).
So this option defaults to off on Windows, but to on everywhere else
since VS plugins aren't shipped with Aegisub there.

Note that this option only disables autoloading of user plugins.
VapourSynth loads system plugins no matter what.
This commit is contained in:
arch1t3cht 2023-10-18 13:31:47 +02:00
parent 41ef3fa56a
commit 79b3f4ccb0
7 changed files with 24 additions and 8 deletions

View file

@ -58,7 +58,11 @@ VapourSynthAudioProvider::VapourSynthAudioProvider(agi::fs::path const& filename
VSCleanCache();
script = vs.GetScriptAPI()->createScript(nullptr);
VSCore *core = vs.GetAPI()->createCore(OPT_GET("Provider/VapourSynth/Autoload User Plugins")->GetBool() ? 0 : VSCoreCreationFlags::ccfDisableAutoLoading);
if (core == nullptr) {
throw VapourSynthError("Error creating core");
}
script = vs.GetScriptAPI()->createScript(core);
if (script == nullptr) {
throw VapourSynthError("Error creating script API");
}

View file

@ -354,6 +354,7 @@
"Log Level" : "quiet"
},
"VapourSynth" : {
"Autoload User Plugins": true,
"Cache" : {
"Files" : 500,
"Size" : 1000

View file

@ -2,7 +2,9 @@
"Audio" : {
"Player" : "DirectSound"
},
"Subtitle" : {
"Provider" : "CSRI/xy-vsfilter_aegisub"
"Provider" : {
"VapourSynth" : {
"Autoload User Plugins": false
}
}
}

View file

@ -9,9 +9,15 @@ resrc = [
output: ['bitmap.cpp', 'bitmap.h'])
]
conf_platform_json = configure_file(input: 'default_config_platform.json.in',
output: '@BASENAME@',
configuration: conf_platform)
if host_machine.system() == 'windows'
conf_platform_json = configure_file(input: 'default_config_win.json',
output: 'default_config_platform.json',
copy: true)
else
conf_platform_json = configure_file(input: 'default_config_platform.json.in',
output: '@BASENAME@',
configuration: conf_platform)
endif
if host_machine.system() == 'darwin'
resmanifest = 'manifest_osx.respack'

View file

@ -354,6 +354,7 @@
"Log Level" : "quiet"
},
"VapourSynth" : {
"Autoload User Plugins": true,
"Cache" : {
"Files" : 500,
"Size" : 1000

View file

@ -476,7 +476,9 @@ void VapourSynth(wxTreebook *book, Preferences *parent) {
const wxString log_levels[] = { "Quiet", "Fatal", "Critical", "Warning", "Information", "Debug" };
wxArrayString log_levels_choice(6, log_levels);
p->OptionChoice(general, _("Log Level"), log_levels_choice, "Provider/Video/VapourSynth/Log Level");
p->OptionChoice(general, _("Log level"), log_levels_choice, "Provider/Video/VapourSynth/Log Level");
p->CellSkip(general);
p->OptionAdd(general, _("Load user plugins"), "Provider/VapourSynth/Autoload User Plugins");
auto video = p->PageSizer(_("Default Video Script"));

View file

@ -123,7 +123,7 @@ VapourSynthVideoProvider::VapourSynthVideoProvider(agi::fs::path const& filename
VSCleanCache();
int err1, err2;
VSCore *core = vs.GetAPI()->createCore(0);
VSCore *core = vs.GetAPI()->createCore(OPT_GET("Provider/VapourSynth/Autoload User Plugins")->GetBool() ? 0 : VSCoreCreationFlags::ccfDisableAutoLoading);
if (core == nullptr) {
throw VapourSynthError("Error creating core");
}