mirror of https://github.com/odrling/Aegisub
avisynth: 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 "avisynth not found" when Avisynth wasn't installed, even if Avisynth wasn't selected as the video provider.
This commit is contained in:
parent
ad443dd118
commit
fe77a1a0b8
|
@ -64,8 +64,6 @@ public:
|
|||
};
|
||||
|
||||
AvisynthAudioProvider::AvisynthAudioProvider(agi::fs::path const& filename) try {
|
||||
agi::acs::CheckFileRead(filename);
|
||||
|
||||
std::lock_guard<std::mutex> lock(avs_wrapper.GetMutex());
|
||||
|
||||
try {
|
||||
|
@ -150,6 +148,7 @@ void AvisynthAudioProvider::FillBuffer(void *buf, int64_t start, int64_t count)
|
|||
}
|
||||
|
||||
std::unique_ptr<agi::AudioProvider> CreateAvisynthAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) {
|
||||
agi::acs::CheckFileRead(file);
|
||||
return agi::make_unique<AvisynthAudioProvider>(file);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -94,8 +94,6 @@ public:
|
|||
};
|
||||
|
||||
AvisynthVideoProvider::AvisynthVideoProvider(agi::fs::path const& filename, std::string const& colormatrix) try {
|
||||
agi::acs::CheckFileRead(filename);
|
||||
|
||||
std::lock_guard<std::mutex> lock(avs.GetMutex());
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -326,6 +324,7 @@ void AvisynthVideoProvider::GetFrame(int n, VideoFrame &out) {
|
|||
|
||||
namespace agi { class BackgroundRunner; }
|
||||
std::unique_ptr<VideoProvider> CreateAvisynthVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) {
|
||||
agi::acs::CheckFileRead(path);
|
||||
return agi::make_unique<AvisynthVideoProvider>(path, colormatrix);
|
||||
}
|
||||
#endif // HAVE_AVISYNTH
|
||||
|
|
Loading…
Reference in New Issue