From 4f96835e19d5b527dd2395ba16c6f42ae6c2dd33 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Wed, 6 May 2020 11:11:09 +0200 Subject: [PATCH] support avisynth portable --- Changelog.md | 1 + mpv.net/WPF/LearnWindow.xaml.cs | 2 +- mpv.net/mpv/Core.cs | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 13e84bd..d8c7eb3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ ============ - log error fix +- workaround to support AviSynth portable (ffmpeg blocks loading AviSynth from path env var) 5.4.6.0 diff --git a/mpv.net/WPF/LearnWindow.xaml.cs b/mpv.net/WPF/LearnWindow.xaml.cs index 9038bae..42fa2b0 100644 --- a/mpv.net/WPF/LearnWindow.xaml.cs +++ b/mpv.net/WPF/LearnWindow.xaml.cs @@ -386,4 +386,4 @@ namespace mpvnet KeyChar = e.Text; } } -} \ No newline at end of file +} diff --git a/mpv.net/mpv/Core.cs b/mpv.net/mpv/Core.cs index a4ae3ec..ed8066c 100644 --- a/mpv.net/mpv/Core.cs +++ b/mpv.net/mpv/Core.cs @@ -974,6 +974,7 @@ namespace mpvnet for (int i = 0; i < files.Length; i++) { string file = files[i]; + LoadLibrary(file.ShortExt()); if (App.SubtitleTypes.Contains(file.ShortExt())) commandv("sub-add", file); @@ -1020,6 +1021,17 @@ namespace mpvnet commandv("playlist-move", "0", (index + 1).ToString()); } + bool wasAviSynthLoaded; + + void LoadLibrary(string ext) + { + if (!wasAviSynthLoaded && ext == "avs") + { + WinAPI.LoadLibrary("AviSynth.dll"); + wasAviSynthLoaded = true; + } + } + string LastHistoryPath; DateTime LastHistoryStartDateTime;