AviSynth portable mode
This commit is contained in:
@@ -2,7 +2,9 @@
|
|||||||
5.4.8.5 Beta (not yet released)
|
5.4.8.5 Beta (not yet released)
|
||||||
============
|
============
|
||||||
|
|
||||||
-
|
- Load AviSynth DLL from environment variable AviSynthDLL
|
||||||
|
in order to support AviSynth portable mode.
|
||||||
|
|
||||||
|
|
||||||
5.4.8.4 Beta
|
5.4.8.4 Beta
|
||||||
============
|
============
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public static class Extensions
|
|||||||
if (instance == null)
|
if (instance == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return Path.GetExtension(instance).ToLower().TrimStart('.');
|
return Path.GetExtension(instance).TrimStart('.').ToLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int ToInt(this string instance)
|
public static int ToInt(this string instance)
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using static libmpv;
|
using static libmpv;
|
||||||
using static WinAPI;
|
|
||||||
using static NewLine;
|
using static NewLine;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
@@ -251,7 +250,7 @@ namespace mpvnet
|
|||||||
{
|
{
|
||||||
string conf = Properties.Resources.mpv_conf;
|
string conf = Properties.Resources.mpv_conf;
|
||||||
Graphics gx = Graphics.FromHwnd(IntPtr.Zero);
|
Graphics gx = Graphics.FromHwnd(IntPtr.Zero);
|
||||||
float scale = GetDeviceCaps(gx.GetHdc(), 88 /*LOGPIXELSX*/) / 96.0f;
|
float scale = WinAPI.GetDeviceCaps(gx.GetHdc(), 88 /*LOGPIXELSX*/) / 96.0f;
|
||||||
|
|
||||||
if (scale != 1)
|
if (scale != 1)
|
||||||
conf = conf.Replace("console-scale=1", "console-scale=" + scale);
|
conf = conf.Replace("console-scale=1", "console-scale=" + scale);
|
||||||
@@ -384,7 +383,7 @@ namespace mpvnet
|
|||||||
mpv_event evt = (mpv_event)Marshal.PtrToStructure(ptr, typeof(mpv_event));
|
mpv_event evt = (mpv_event)Marshal.PtrToStructure(ptr, typeof(mpv_event));
|
||||||
|
|
||||||
if (WindowHandle == IntPtr.Zero)
|
if (WindowHandle == IntPtr.Zero)
|
||||||
WindowHandle = FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
|
WindowHandle = WinAPI.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
|
||||||
|
|
||||||
//Debug.WriteLine(evt.event_id.ToString());
|
//Debug.WriteLine(evt.event_id.ToString());
|
||||||
|
|
||||||
@@ -1014,7 +1013,9 @@ namespace mpvnet
|
|||||||
for (int i = 0; i < files.Length; i++)
|
for (int i = 0; i < files.Length; i++)
|
||||||
{
|
{
|
||||||
string file = files[i];
|
string file = files[i];
|
||||||
LoadLibrary(file.Ext());
|
|
||||||
|
if (file.Ext() == "avs")
|
||||||
|
LoadAviSynth();
|
||||||
|
|
||||||
if (file.Ext() == "iso")
|
if (file.Ext() == "iso")
|
||||||
LoadISO(file);
|
LoadISO(file);
|
||||||
@@ -1108,14 +1109,20 @@ namespace mpvnet
|
|||||||
commandv("playlist-move", "0", (index + 1).ToString());
|
commandv("playlist-move", "0", (index + 1).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wasAviSynthLoaded;
|
bool WasAviSynthLoaded;
|
||||||
|
|
||||||
void LoadLibrary(string ext)
|
void LoadAviSynth()
|
||||||
{
|
{
|
||||||
if (!wasAviSynthLoaded && ext == "avs")
|
if (!WasAviSynthLoaded)
|
||||||
{
|
{
|
||||||
WinAPI.LoadLibrary("AviSynth.dll");
|
string dll = Environment.GetEnvironmentVariable("AviSynthDLL");
|
||||||
wasAviSynthLoaded = true;
|
|
||||||
|
if (File.Exists(dll))
|
||||||
|
WinAPI.LoadLibrary(dll);
|
||||||
|
else
|
||||||
|
WinAPI.LoadLibrary("AviSynth.dll");
|
||||||
|
|
||||||
|
WasAviSynthLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user