mpv setting osd-scale-by-window added to config dialog

This commit is contained in:
Frank Skare
2019-08-08 03:31:57 +02:00
parent 1447636eb7
commit 032e91e4b4
8 changed files with 72 additions and 52 deletions

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.2.1.0")]
[assembly: AssemblyFileVersion("5.2.1.0")]
[assembly: AssemblyVersion("5.2.1.3")]
[assembly: AssemblyFileVersion("5.2.1.3")]

View File

@@ -1,17 +1,11 @@
# This file defines the input (keys and mouse) bindings of mpv and mpv.net
# and it also defines the context menu of mpv.net. mpv.net has an input
# editor and an config editor as alternative to editing conf text files.
# The input and config editor can be found in mpv.net's context menu at:
# Settings > Show Config Editor
# Settings > Show Input Editor
# The defaults of this file can be found at:
# This file defines the key and mouse bindings and the context menu
# of mpv.net. A input and config editor can be found in mpv.net's
# context menu under 'Settings'. The defaults of this file can be found at:
# https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt
# the defaults of mpv can be found at:
# The defaults of mpv can be found at:
# https://github.com/mpv-player/mpv/blob/master/etc/input.conf

View File

@@ -26,7 +26,7 @@ filter = "Video"
help = "Controls which type of graphics APIs will be accepted. Auto uses d3d11, it should only be changed in case of problems."
options = [{ name = "auto", help = "Use any available API" },
{ name = "opengl", help = "Allow only OpenGL (requires OpenGL 2.1+ or GLES 2.0+)" },
{ name = "vulkan", help = "Allow only Vulkan (requires a valid/working spirv-compiler)" },
{ name = "vulkan", help = "Allow only Vulkan (requires a working spirv-compiler). " },
{ name = "d3d11", help = "Allow only gpu-context=d3d11" }]
[[settings]]
@@ -241,6 +241,14 @@ default = "55"
filter = "Screen"
help = "Specify the OSD font size. See sub-font-size for details. Default: 55"
[[settings]]
name = "osd-scale-by-window"
default = "yes"
filter = "Screen"
help = "Whether to scale the OSD with the window size. If this is disabled, osd-font-size and other OSD options that use scaled pixels are always in actual pixels. The effect is that changing the window size won't change the OSD font size."
options = [{ name = "yes" },
{ name = "no" }]
[[settings]]
name = "autofit"
filter = "Screen"
@@ -283,7 +291,7 @@ options = [{ name = "yes" },
name = "screenshot-high-bit-depth"
default = "yes"
filter = "Screen"
help = "If possible, write screenshots with a bit depth similar to the source video (default: yes). This is interesting in particular for PNG, as this sometimes triggers writing 16 bit PNGs with huge file sizes. This will also include an unused alpha channel in the resulting files if 16 bit is used."
help = "If possible, write screenshots with a bit depth similar to the source video. This is interesting in particular for PNG, as this sometimes triggers writing 16 bit PNGs with huge file sizes. This will also include an unused alpha channel in the resulting files if 16 bit is used."
options = [{ name = "yes" },
{ name = "no" }]
@@ -291,7 +299,7 @@ options = [{ name = "yes" },
name = "screenshot-jpeg-source-chroma"
default = "yes"
filter = "Screen"
help = "Write JPEG files with the same chroma subsampling as the video (default: yes). If disabled, the libjpeg default is used."
help = "Write JPEG files with the same chroma subsampling as the video. If disabled, the libjpeg default is used."
options = [{ name = "yes" },
{ name = "no" }]
@@ -329,10 +337,10 @@ options = [{ name = "yes" },
name = "keep-open"
default = "no"
filter = "Playback"
help = "Do not terminate when playing or seeking beyond the end of the file, and there is not next file to be played (and loop is not used). Instead, pause the player. When trying to seek beyond end of the file, the player will attempt to seek to the last frame.\n\nNormally, this will act like set pause yes on EOF, unless the keep-open-pause=no option is set."
options = [{ name = "yes", help = "Don't terminate if the current file is the last playlist entry. Equivalent to keep-open without arguments."},
{ name = "no", help = "If the current file ends, go to the next file or terminate." },
{ name = "always", help = "Like yes, but also applies to files before the last playlist entry. This means playback will never automatically advance to the next file."}]
help = "Unlike mpv, mpv.net never exits automatically."
options = [{ name = "yes", help = "Useless in mpv.net because mpv.net never terminates automatically."},
{ name = "no", help = "If the current file ends, go to the next file." },
{ name = "always", help = "Playback will never automatically advance to the next file."}]
[[settings]]
name = "loop-file"

View File

@@ -193,6 +193,7 @@ namespace mpvnet
{
SearchControl.SearchTextBox.SelectAll();
Keyboard.Focus(SearchControl.SearchTextBox);
foreach (var i in MainStackPanel.Children.OfType<StringSettingControl>())
i.Update();
}

View File

@@ -45,7 +45,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(288F, 288F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(542, 0);
this.ClientSize = new System.Drawing.Size(668, 345);
this.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);

View File

@@ -33,6 +33,22 @@ namespace mpvnet
Instance = this;
Hwnd = Handle;
mp.Init();
mp.Shutdown += Shutdown;
mp.VideoSizeChanged += VideoSizeChanged;
mp.FileLoaded += FileLoaded;
mp.Idle += Idle;
mp.observe_property_bool("fullscreen", PropChangeFullscreen);
mp.observe_property_bool("ontop", PropChangeOnTop);
mp.observe_property_bool("border", PropChangeBorder);
mp.observe_property_string("sid", PropChangeSid);
mp.observe_property_string("aid", PropChangeAid);
mp.observe_property_string("vid", PropChangeVid);
mp.observe_property_int("edition", PropChangeEdition);
if (mp.GPUAPI != "vulkan") mp.ProcessCommandLine(false);
AppDomain.CurrentDomain.UnhandledException += (sender, e) => Msg.ShowError(e.ExceptionObject.ToString());
Application.ThreadException += (sender, e) => Msg.ShowException(e.Exception);
Msg.SupportURL = "https://github.com/stax76/mpv.net#support";
@@ -67,22 +83,6 @@ namespace mpvnet
Left = posX - Width / 2;
Top = posY - Height / 2;
}
mp.Shutdown += Shutdown;
mp.VideoSizeChanged += VideoSizeChanged;
mp.FileLoaded += FileLoaded;
mp.Idle += Idle;
mp.observe_property_bool("fullscreen", PropChangeFullscreen);
mp.observe_property_bool("ontop", PropChangeOnTop);
mp.observe_property_bool("border", PropChangeBorder);
mp.observe_property_string("sid", PropChangeSid);
mp.observe_property_string("aid", PropChangeAid);
mp.observe_property_string("vid", PropChangeVid);
mp.observe_property_int("edition", PropChangeEdition);
if (mp.GPUAPI != "vulkan") mp.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
if (Height < FontHeight * 4) SetFormPosAndSize();
}
catch (Exception ex)
{
@@ -510,7 +510,8 @@ namespace mpvnet
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (mp.get_property_int("playlist-count") == 0) mp.ShowLogo();
if (mp.GPUAPI != "vulkan") mp.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
SetFormPosAndSize();
}
protected override void OnShown(EventArgs e)

View File

@@ -113,7 +113,6 @@ namespace mpvnet
mpv_initialize(Handle);
Initialized?.Invoke();
LoadMpvScripts();
if (GPUAPI != "vulkan") ProcessCommandLine(false);
}
public static void ProcessProperty(string name, string value)
@@ -339,7 +338,7 @@ namespace mpvnet
break;
case mpv_event_id.MPV_EVENT_IDLE:
Idle?.Invoke();
if (get_property_int("playlist-count") == 0) ShowLogo();
ShowLogo();
break;
case mpv_event_id.MPV_EVENT_PAUSE:
Pause?.Invoke();
@@ -377,19 +376,22 @@ namespace mpvnet
var propData = (mpv_event_property)Marshal.PtrToStructure(evt.data, typeof(mpv_event_property));
if (propData.format == mpv_format.MPV_FORMAT_FLAG)
foreach (var i in BoolPropChangeActions)
if (i.Key== propData.name)
i.Value.Invoke(Marshal.PtrToStructure<int>(propData.data) == 1);
lock (BoolPropChangeActions)
foreach (var i in BoolPropChangeActions)
if (i.Key== propData.name)
i.Value.Invoke(Marshal.PtrToStructure<int>(propData.data) == 1);
if (propData.format == mpv_format.MPV_FORMAT_STRING)
foreach (var i in StringPropChangeActions)
if (i.Key == propData.name)
i.Value.Invoke(StringFromNativeUtf8(Marshal.PtrToStructure<IntPtr>(propData.data)));
lock (StringPropChangeActions)
foreach (var i in StringPropChangeActions)
if (i.Key == propData.name)
i.Value.Invoke(StringFromNativeUtf8(Marshal.PtrToStructure<IntPtr>(propData.data)));
if (propData.format == mpv_format.MPV_FORMAT_INT64)
foreach (var i in IntPropChangeActions)
if (i.Key == propData.name)
i.Value.Invoke(Marshal.PtrToStructure<int>(propData.data));
lock (IntPropChangeActions)
foreach (var i in IntPropChangeActions)
if (i.Key == propData.name)
i.Value.Invoke(Marshal.PtrToStructure<int>(propData.data));
break;
case mpv_event_id.MPV_EVENT_PLAYBACK_RESTART:
PlaybackRestart?.Invoke();
@@ -548,7 +550,8 @@ namespace mpvnet
if (err < 0)
throw new Exception($"{name}: {(mpv_error)err}");
else
IntPropChangeActions.Add(new KeyValuePair<string, Action<int>>(name, action));
lock (IntPropChangeActions)
IntPropChangeActions.Add(new KeyValuePair<string, Action<int>>(name, action));
}
public static void observe_property_bool(string name, Action<bool> action)
@@ -558,7 +561,8 @@ namespace mpvnet
if (err < 0)
throw new Exception($"{name}: {(mpv_error)err}");
else
BoolPropChangeActions.Add(new KeyValuePair<string, Action<bool>>(name, action));
lock (BoolPropChangeActions)
BoolPropChangeActions.Add(new KeyValuePair<string, Action<bool>>(name, action));
}
public static void observe_property_string(string name, Action<string> action)
@@ -568,7 +572,8 @@ namespace mpvnet
if (err < 0)
throw new Exception($"{name}: {(mpv_error)err}");
else
StringPropChangeActions.Add(new KeyValuePair<string, Action<string>>(name, action));
lock (StringPropChangeActions)
StringPropChangeActions.Add(new KeyValuePair<string, Action<string>>(name, action));
}
public static void ProcessCommandLine(bool preInit)
@@ -631,8 +636,8 @@ namespace mpvnet
if (files.Count == 0 || files[0].Contains("://"))
{
VideoSizeAutoResetEvent.Set();
VideoSizeChanged?.Invoke();
VideoSizeAutoResetEvent.Set();
}
}
}