vapoursynth: Check if file exists before creating provider

Since FileNotFound exceptions don't abort the provider search, opening
an invalid path would show errors such as "vapoursynth not found" when
VapourSynth wasn't installed, even if VapourSynth wasn't selected as the
default video provider.
This commit is contained in:
arch1t3cht 2022-09-27 23:17:54 +02:00
parent febce3ecdc
commit 40a9344d44
2 changed files with 2 additions and 2 deletions

View file

@ -54,7 +54,6 @@ public:
};
VapoursynthAudioProvider::VapoursynthAudioProvider(agi::fs::path const& filename) try {
agi::acs::CheckFileRead(filename);
std::lock_guard<std::mutex> lock(vs.GetMutex());
script = vs.GetScriptAPI()->createScript(nullptr);
@ -162,6 +161,7 @@ VapoursynthAudioProvider::~VapoursynthAudioProvider() {
}
std::unique_ptr<agi::AudioProvider> CreateVapoursynthAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) {
agi::acs::CheckFileRead(file);
return agi::make_unique<VapoursynthAudioProvider>(file);
}
#endif

View file

@ -105,7 +105,6 @@ void VapoursynthVideoProvider::SetResizeArg(VSMap *args, const VSMap *props, con
}
VapoursynthVideoProvider::VapoursynthVideoProvider(agi::fs::path const& filename, std::string const& colormatrix) try {
agi::acs::CheckFileRead(filename);
std::lock_guard<std::mutex> lock(vs.GetMutex());
script = vs.GetScriptAPI()->createScript(nullptr);
@ -277,6 +276,7 @@ VapoursynthVideoProvider::~VapoursynthVideoProvider() {
namespace agi { class BackgroundRunner; }
std::unique_ptr<VideoProvider> CreateVapoursynthVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) {
agi::acs::CheckFileRead(path);
return agi::make_unique<VapoursynthVideoProvider>(path, colormatrix);
}
#endif // WITH_VAPOURSYNTH