diff --git a/Changelog.md b/Changelog.md index 9ed119f..eaacfc2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,13 +1,18 @@ +To Do +===== + +add vpy support to docs + + 5.4.4.3 Beta (not yet released) ============ -new ---- - - update MediaInfo 20.03 -- mpv property window-maximized support added, cycling it from input.conf +- update libmpv 2020-04-12, it supports vpy playback, ask in forum for configuration +- mpv property `window-maximized` support added, cycling it from input.conf might not be 100% reliable, use native Windows shortcuts Win+Up, Win+Down +- the mpv.net `start-size` property supports `always` to always remember the window height ### 5.4.4.2 diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index 896bcc8..2643473 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -27,8 +27,8 @@ namespace mpvnet public static string DarkMode { get; set; } = "always"; public static string DarkTheme { get; set; } = "dark"; public static string LightTheme { get; set; } = "light"; + public static string StartSize { get; set; } = "previous"; - public static bool RememberHeight { get; set; } = true; public static bool RememberPosition { get; set; } public static bool DebugMode { get; set; } public static bool IsStartedFromTerminal { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes"; @@ -40,7 +40,7 @@ namespace mpvnet public static int StartThreshold { get; set; } = 1500; public static int RecentCount { get; set; } = 15; - public static float MinimumAspectRatio { get; set; } = 1.3f; + public static float MinimumAspectRatio { get; set; } = 1.2f; public static Extension Extension { get; set; } @@ -175,7 +175,7 @@ namespace mpvnet case "queue": Queue = value == "yes"; return true; case "auto-load-folder": AutoLoadFolder = value == "yes"; return true; case "update-check": UpdateCheck = value == "yes"; return true; - case "start-size": RememberHeight = value == "previous"; return true; + case "start-size": StartSize = value; return true; case "process-instance": ProcessInstance = value; return true; case "dark-mode": DarkMode = value; return true; case "start-threshold": StartThreshold = value.Int(); return true; diff --git a/mpv.net/Resources/editor.toml.txt b/mpv.net/Resources/editor.toml.txt index 53ccec2..793d20e 100644 --- a/mpv.net/Resources/editor.toml.txt +++ b/mpv.net/Resources/editor.toml.txt @@ -333,9 +333,10 @@ name = "start-size" file = "mpvnet" default = "previous" filter = "Screen" -help = "Setting to remember the window height in the current session, otherwise the video's native resolution is used. (mpv.net specific setting)" -options = [{ name = "video", help = "Window size is set to native video resolution" }, - { name = "previous", help = "Window size is remembered but only in the current session" }] +help = "Setting to remember the window height. (mpv.net specific setting)" +options = [{ name = "video", help = "Window size is set to video resolution" }, + { name = "previous", help = "Window size is remembered but only in the current session" }, + { name = "always", help = "Window size is always remembered"}] [[settings]] name = "start-threshold" @@ -347,7 +348,7 @@ help = "Threshold in milliseconds to wait for libmpv returning the video resolut name = "minimum-aspect-ratio" file = "mpvnet" filter = "Screen" -help = " Minimum aspect ratio for the window. Default: 1.3 (mpv.net specific setting)" +help = " Minimum aspect ratio for the window. Default: 1.2 (mpv.net specific setting)" [[settings]] name = "remember-position" diff --git a/mpv.net/WPF/SetupWindow.xaml b/mpv.net/WPF/SetupWindow.xaml index 5a53e61..40468d6 100644 --- a/mpv.net/WPF/SetupWindow.xaml +++ b/mpv.net/WPF/SetupWindow.xaml @@ -6,7 +6,7 @@ xmlns:UI="clr-namespace:UI" mc:Ignorable="d" - Title="mpv.net OS Setup" + Title="mpv.net Setup" FontSize="13" Foreground="{x:Static UI:Theme.Foreground}" Background="{x:Static UI:Theme.Background}" diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index f4ef592..7feb676 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -287,13 +287,19 @@ namespace mpvnet Size size = mp.VideoSize; int height = size.Height; - if (App.RememberHeight || scale != 1) + if (App.StartSize == "previous" || App.StartSize == "always" || scale != 1) { if (WasInitialSizeSet || scale != 1) height = ClientSize.Height; else { - height = autoFitHeight; + int savedHeight = RegistryHelp.GetInt(App.RegPath, "Height"); + + if (App.StartSize == "always" && savedHeight != 0) + height = savedHeight; + else + height = autoFitHeight; + WasInitialSizeSet = true; } } @@ -380,6 +386,7 @@ namespace mpvnet FormBorderStyle = FormBorderStyle.None; SetFormPosAndSize(); + SaveWindowProperties(); } } } @@ -697,10 +704,7 @@ namespace mpvnet base.OnFormClosing(e); if (WindowState == FormWindowState.Normal) - { - RegistryHelp.SetValue(App.RegPath, "PosX", Left + Width / 2); - RegistryHelp.SetValue(App.RegPath, "PosY", Top + Height / 2); - } + SaveWindowProperties(); RegistryHelp.SetValue(App.RegPath, "Recent", RecentFiles.ToArray()); @@ -714,6 +718,16 @@ namespace mpvnet ps.Runspace.Dispose(); } + void SaveWindowProperties() + { + if (WindowState == FormWindowState.Normal) + { + RegistryHelp.SetValue(App.RegPath, "PosX", Left + Width / 2); + RegistryHelp.SetValue(App.RegPath, "PosY", Top + Height / 2); + RegistryHelp.SetValue(App.RegPath, "Height", ClientSize.Height); + } + } + protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); diff --git a/mpv.net/mpv/mp.cs b/mpv.net/mpv/mp.cs index d247e2c..8cd0ee6 100644 --- a/mpv.net/mpv/mp.cs +++ b/mpv.net/mpv/mp.cs @@ -71,8 +71,8 @@ namespace mpvnet public static List PythonScripts { get; set; } = new List(); public static Size VideoSize { get; set; } public static TimeSpan Duration; - public static AutoResetEvent ShutdownAutoResetEvent { get; set; } = new AutoResetEvent(false); - public static AutoResetEvent VideoSizeAutoResetEvent { get; set; } = new AutoResetEvent(false); + public static AutoResetEvent ShutdownAutoResetEvent { get; } = new AutoResetEvent(false); + public static AutoResetEvent VideoSizeAutoResetEvent { get; } = new AutoResetEvent(false); public static string InputConfPath { get => ConfigFolder + "input.conf"; } public static string ConfPath { get => ConfigFolder + "mpv.conf"; } @@ -368,7 +368,8 @@ namespace mpvnet { HideLogo(); Duration = TimeSpan.FromSeconds(get_property_number("duration")); - Size vidSize = new Size(get_property_int("width"), get_property_int("height")); + Size vidSize = new Size(get_property_int("dwidth"), get_property_int("dheight")); + if (vidSize.Width == 0 || vidSize.Height == 0) vidSize = new Size(1, 1); if (VideoSize != vidSize) @@ -376,6 +377,7 @@ namespace mpvnet VideoSize = vidSize; VideoSizeChanged?.Invoke(); } + VideoSizeAutoResetEvent.Set(); Task.Run(new Action(() => ReadMetaData())); string path = mp.get_property_string("path");