diff --git a/aegisub/audio_provider_avs.cpp b/aegisub/audio_provider_avs.cpp index d0fe8b151..09c5b0136 100644 --- a/aegisub/audio_provider_avs.cpp +++ b/aegisub/audio_provider_avs.cpp @@ -45,6 +45,7 @@ #include "avisynth_wrap.h" #include "utils.h" #include "options.h" +#include "standard_paths.h" //////////////////////// @@ -131,7 +132,21 @@ void AvisynthAudioProvider::OpenAVSAudio() { wxFileName fn(filename); const char * argnames[3] = { 0, "video", "audio" }; AVSValue args[3] = { env->SaveString(fn.GetShortPath().mb_str(wxConvLocal)), false, true }; - script = env->Invoke("DirectShowSource", AVSValue(args,3),argnames); + + // Load DirectShowSource.dll from app dir if it exists + wxFileName dsspath(StandardPaths::DecodePath(_T("?data/DirectShowSource.dll"))); + if (dsspath.FileExists()) { + env->Invoke("LoadPlugin",env->SaveString(dsspath.GetFullPath().mb_str(wxConvLocal))); + } + + // Load audio with DSS if it exists + if (env->FunctionExists("DirectShowSource")) { + script = env->Invoke("DirectShowSource", AVSValue(args,3),argnames); + } + // Otherwise fail + else { + throw AvisynthError("No suitable audio source filter found. Try placing DirectShowSource.dll in the Aegisub application directory."); + } } LoadFromClip(script); diff --git a/aegisub/video_provider_avs.cpp b/aegisub/video_provider_avs.cpp index 3fe70d3c3..554427754 100644 --- a/aegisub/video_provider_avs.cpp +++ b/aegisub/video_provider_avs.cpp @@ -298,6 +298,15 @@ PClip AvisynthVideoProvider::OpenVideo(wxString _filename, bool mpeg2dec3_priori // Try DirectShowSource if (!dss2) { + // Load DirectShowSource.dll from app dir if it exists + wxFileName dsspath(StandardPaths::DecodePath(_T("?data/DirectShowSource.dll"))); + if (dsspath.FileExists()) { + AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loading DirectShowSource")); + env->Invoke("LoadPlugin",env->SaveString(dsspath.GetFullPath().mb_str(wxConvLocal))); + AVSTRACE(_T("AvisynthVideoProvider::OpenVideo: Loaded DirectShowSource")); + } + + // Then try using DSS if (env->FunctionExists("DirectShowSource")) { if (fps == 0.0) { const char *argnames[3] = { 0, "video", "audio" };