This commit is contained in:
stax76
2023-12-15 01:24:43 +01:00
parent cd54e67b87
commit e0616dee76
8 changed files with 125 additions and 63 deletions

View File

@@ -1,16 +1,36 @@

using MpvNet.ExtensionMethod;
using System.Windows;
using MpvNet.Windows.WPF;
namespace MpvNet.Windows.Help;
public class WinMpvHelp
{
public static void CopyMpvNetCom()
public static void AddToPath()
{
string dir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).AddSep() +
"Microsoft\\WindowsApps\\";
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!;
if (File.Exists(dir + "mpvnet.exe") && !File.Exists(dir + "mpvnet.com"))
File.Copy(Folder.Startup + "mpvnet.com", dir + "mpvnet.com");
if (path.ToLower().Contains(Folder.Startup.TrimEnd(Path.DirectorySeparatorChar).ToLower()))
return;
string dir = RegistryHelp.GetString("PathEnvVarCheck");
if (dir == Folder.Startup)
return;
var result = Msg.ShowQuestion("Would you like to add mpv.net to the Path environment variable?",
MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
Environment.SetEnvironmentVariable("Path",
Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";" + path,
EnvironmentVariableTarget.User);
Msg.ShowInfo("mpv.net was added successfully to Path.");
}
RegistryHelp.SetString("PathEnvVarCheck", Folder.Startup);
}
}

View File

@@ -39,6 +39,12 @@ directory = General
width = 500
help = Image file extensions used to create file associations and used by the auto-load-folder feature. (mpv.net option)
name = menu-syntax
file = mpvnet
directory = General
default = #menu:
help = Used menu syntax for defining the context menu in input.conf.\nmpv.net by default uses '#menu:', uosc uses '#!' by default.
name = debug-mode
file = mpvnet
default = no
@@ -113,45 +119,6 @@ option = display-adrop
option = display-desync
option = desync
name = scale
file = mpv
default = bilinear
directory = Video
help = The GPU renderer filter function to use when upscaling video. There are some more filters, but most are not as useful. For a complete list, pass help as value, e.g.: mpv --scale=help
option = bilinear Bilinear hardware texture filtering (fastest, very low quality).
option = spline36 Mid quality and speed. This is the default when using gpu-hq.
option = lanczos Lanczos scaling. Provides mid quality and speed. Generally worse than spline36, but it results in a slightly sharper image which is good for some content types. The number of taps can be controlled with scale-radius, but is best left unchanged. (This filter is an alias for sinc-windowed sinc)
option = ewa_lanczos Elliptic weighted average Lanczos scaling. Also known as Jinc. Relatively slow, but very good quality. The radius can be controlled with scale-radius. Increasing the radius makes the filter sharper but adds more ringing. (This filter is an alias for jinc-windowed jinc)
option = ewa_lanczossharp A slightly sharpened version of ewa_lanczos, preconfigured to use an ideal radius and parameter. If your hardware can run it, this is probably what you should use by default.
option = mitchell Mitchell-Netravali. The B and C parameters can be set with scale-param1 and scale-param2. This filter is very good at downscaling (see dscale).
option = oversample A version of nearest neighbour that (naively) oversamples pixels, so that pixels overlapping edges get linearly interpolated instead of rounded. This essentially removes the small imperfections and judder artifacts caused by nearest-neighbour interpolation, in exchange for adding some blur. This filter is good at temporal interpolation, and also known as "smoothmotion" (see tscale).
name = cscale
file = mpv
default = bilinear
directory = Video
help = As scale, but for interpolating chroma information. If the image is not subsampled, this option is ignored entirely.
option = bilinear Bilinear hardware texture filtering (fastest, very low quality).
option = spline36 Mid quality and speed. This is the default when using gpu-hq.
option = lanczos Lanczos scaling. Provides mid quality and speed. Generally worse than spline36, but it results in a slightly sharper image which is good for some content types. The number of taps can be controlled with scale-radius, but is best left unchanged. (This filter is an alias for sinc-windowed sinc)
option = ewa_lanczos Elliptic weighted average Lanczos scaling. Also known as Jinc. Relatively slow, but very good quality. The radius can be controlled with scale-radius. Increasing the radius makes the filter sharper but adds more ringing. (This filter is an alias for jinc-windowed jinc)
option = ewa_lanczossharp A slightly sharpened version of ewa_lanczos, preconfigured to use an ideal radius and parameter. If your hardware can run it, this is probably what you should use by default.
option = mitchell Mitchell-Netravali. The B and C parameters can be set with scale-param1 and scale-param2. This filter is very good at downscaling (see dscale).
option = oversample A version of nearest neighbour that (naively) oversamples pixels, so that pixels overlapping edges get linearly interpolated instead of rounded. This essentially removes the small imperfections and judder artifacts caused by nearest-neighbour interpolation, in exchange for adding some blur. This filter is good at temporal interpolation, and also known as "smoothmotion" (see tscale).
name = dscale
file = mpv
default =
directory = Video
help = Like scale, but apply these filters on downscaling instead. \nIf no option is selected, it will keep the same with the upscaler.
option = bilinear Bilinear hardware texture filtering (fastest, very low quality).
option = spline36 Mid quality and speed. This is the default when using gpu-hq.
option = lanczos Lanczos scaling. Provides mid quality and speed. Generally worse than spline36, but it results in a slightly sharper image which is good for some content types. The number of taps can be controlled with scale-radius, but is best left unchanged. (This filter is an alias for sinc-windowed sinc)
option = ewa_lanczos Elliptic weighted average Lanczos scaling. Also known as Jinc. Relatively slow, but very good quality. The radius can be controlled with scale-radius. Increasing the radius makes the filter sharper but adds more ringing. (This filter is an alias for jinc-windowed jinc)
option = ewa_lanczossharp A slightly sharpened version of ewa_lanczos, preconfigured to use an ideal radius and parameter. If your hardware can run it, this is probably what you should use by default.
option = mitchell Mitchell-Netravali. The B and C parameters can be set with scale-param1 and scale-param2. This filter is very good at downscaling (see dscale).
option = oversample A version of nearest neighbour that (naively) oversamples pixels, so that pixels overlapping edges get linearly interpolated instead of rounded. This essentially removes the small imperfections and judder artifacts caused by nearest-neighbour interpolation, in exchange for adding some blur. This filter is good at temporal interpolation, and also known as "smoothmotion" (see tscale).
name = dither-depth
file = mpv
default = no
@@ -629,6 +596,45 @@ file = mpv
directory = Video/Screenshot
help = <0-5> Set the filter applied prior to PNG compression. 0 is none, 1 is 'sub', 2 is 'up', 3 is 'average', 4 is 'Paeth', and 5 is 'mixed'. This affects the level of compression that can be achieved. For most images, 'mixed' achieves the best compression ratio, hence it is the default.
name = scale
file = mpv
default = bilinear
directory = Render Options
help = The GPU renderer filter function to use when upscaling video. There are some more filters, but most are not as useful. For a complete list, pass help as value, e.g.: mpv --scale=help
option = bilinear Bilinear hardware texture filtering (fastest, very low quality).
option = spline36 Mid quality and speed. This is the default when using gpu-hq.
option = lanczos Lanczos scaling. Provides mid quality and speed. Generally worse than spline36, but it results in a slightly sharper image which is good for some content types. The number of taps can be controlled with scale-radius, but is best left unchanged. (This filter is an alias for sinc-windowed sinc)
option = ewa_lanczos Elliptic weighted average Lanczos scaling. Also known as Jinc. Relatively slow, but very good quality. The radius can be controlled with scale-radius. Increasing the radius makes the filter sharper but adds more ringing. (This filter is an alias for jinc-windowed jinc)
option = ewa_lanczossharp A slightly sharpened version of ewa_lanczos, preconfigured to use an ideal radius and parameter. If your hardware can run it, this is probably what you should use by default.
option = mitchell Mitchell-Netravali. The B and C parameters can be set with scale-param1 and scale-param2. This filter is very good at downscaling (see dscale).
option = oversample A version of nearest neighbour that (naively) oversamples pixels, so that pixels overlapping edges get linearly interpolated instead of rounded. This essentially removes the small imperfections and judder artifacts caused by nearest-neighbour interpolation, in exchange for adding some blur. This filter is good at temporal interpolation, and also known as "smoothmotion" (see tscale).
name = cscale
file = mpv
default = bilinear
directory = Render Options
help = As scale, but for interpolating chroma information. If the image is not subsampled, this option is ignored entirely.
option = bilinear Bilinear hardware texture filtering (fastest, very low quality).
option = spline36 Mid quality and speed. This is the default when using gpu-hq.
option = lanczos Lanczos scaling. Provides mid quality and speed. Generally worse than spline36, but it results in a slightly sharper image which is good for some content types. The number of taps can be controlled with scale-radius, but is best left unchanged. (This filter is an alias for sinc-windowed sinc)
option = ewa_lanczos Elliptic weighted average Lanczos scaling. Also known as Jinc. Relatively slow, but very good quality. The radius can be controlled with scale-radius. Increasing the radius makes the filter sharper but adds more ringing. (This filter is an alias for jinc-windowed jinc)
option = ewa_lanczossharp A slightly sharpened version of ewa_lanczos, preconfigured to use an ideal radius and parameter. If your hardware can run it, this is probably what you should use by default.
option = mitchell Mitchell-Netravali. The B and C parameters can be set with scale-param1 and scale-param2. This filter is very good at downscaling (see dscale).
option = oversample A version of nearest neighbour that (naively) oversamples pixels, so that pixels overlapping edges get linearly interpolated instead of rounded. This essentially removes the small imperfections and judder artifacts caused by nearest-neighbour interpolation, in exchange for adding some blur. This filter is good at temporal interpolation, and also known as "smoothmotion" (see tscale).
name = dscale
file = mpv
default =
directory = Render Options
help = Like scale, but apply these filters on downscaling instead. \nIf no option is selected, it will keep the same with the upscaler.
option = bilinear Bilinear hardware texture filtering (fastest, very low quality).
option = spline36 Mid quality and speed. This is the default when using gpu-hq.
option = lanczos Lanczos scaling. Provides mid quality and speed. Generally worse than spline36, but it results in a slightly sharper image which is good for some content types. The number of taps can be controlled with scale-radius, but is best left unchanged. (This filter is an alias for sinc-windowed sinc)
option = ewa_lanczos Elliptic weighted average Lanczos scaling. Also known as Jinc. Relatively slow, but very good quality. The radius can be controlled with scale-radius. Increasing the radius makes the filter sharper but adds more ringing. (This filter is an alias for jinc-windowed jinc)
option = ewa_lanczossharp A slightly sharpened version of ewa_lanczos, preconfigured to use an ideal radius and parameter. If your hardware can run it, this is probably what you should use by default.
option = mitchell Mitchell-Netravali. The B and C parameters can be set with scale-param1 and scale-param2. This filter is very good at downscaling (see dscale).
option = oversample A version of nearest neighbour that (naively) oversamples pixels, so that pixels overlapping edges get linearly interpolated instead of rounded. This essentially removes the small imperfections and judder artifacts caused by nearest-neighbour interpolation, in exchange for adding some blur. This filter is good at temporal interpolation, and also known as "smoothmotion" (see tscale).
name = background
file = mpv
directory = Render Options

View File

@@ -122,39 +122,67 @@
<Border x:Name="stackButtons" Grid.Row="3" Padding="10"
Background="{Binding Path=ButtonBackground}" >
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" >
<Button x:Name="btnOK" Content=" OK " MinWidth="75" Margin="5,0,5,0"
<Button x:Name="btnOK"
Content=" OK "
MinWidth="75"
Margin="5,0,5,0"
Width="{Binding Path=ButtonWidth}"
Height="25"
MinHeight="25"
Visibility="{Binding Path=ShowOk}"
IsDefault="{Binding Path=IsDefaultOK}"
Click="BtnOK_Click" />
<Button x:Name="btnYes" Content=" Yes " MinWidth="75" Margin="5,0,5,0"
<Button x:Name="btnYes"
Content=" Yes "
Width="{Binding Path=ButtonWidth}"
MinWidth="75"
MinHeight="25"
Margin="5,0,5,0"
Visibility="{Binding Path=ShowYes}"
IsDefault="{Binding Path=IsDefaultYes}"
Click="BtnYes_Click"/>
<Button x:Name="btnNo" Content=" No " MinWidth="75" Margin="5,0,5,0"
<Button x:Name="btnNo"
Content=" No "
Width="{Binding Path=ButtonWidth}"
MinWidth="75"
MinHeight="25"
Margin="5,0,5,0"
Visibility="{Binding Path=ShowNo}"
IsDefault="{Binding Path=IsDefaultNo}"
Click="BtnNo_Click"/>
<Button x:Name="btnAbort" Content=" Abort " MinWidth="75" Margin="5,0,5,0"
<Button x:Name="btnAbort"
Content=" Abort "
Width="{Binding Path=ButtonWidth}"
MinWidth="75"
MinHeight="25"
Margin="5,0,5,0"
Visibility="{Binding Path=ShowAbort}"
IsDefault="{Binding Path=IsDefaultAbort}"
Click="BtnAbort_Click"/>
<Button x:Name="btnRetry" Content=" Retry " MinWidth="75" Margin="5,0,5,0"
<Button x:Name="btnRetry"
Content=" Retry "
Width="{Binding Path=ButtonWidth}"
MinWidth="75"
MinHeight="25"
Margin="5,0,5,0"
Visibility="{Binding Path=ShowRetry}"
IsDefault="{Binding Path=IsDefaultRetry}"
Click="BtnRetry_Click"/>
<Button x:Name="btnIgnore" Content=" Ignore " MinWidth="75" Margin="5,0,5,0"
<Button x:Name="btnIgnore"
Content=" Ignore "
Width="{Binding Path=ButtonWidth}"
MinWidth="75"
MinHeight="25"
Margin="5,0,5,0"
Visibility="{Binding Path=ShowIgnore}"
IsDefault="{Binding Path=IsDefaultIgnore}"
Click="BtnIgnore_Click"/>
<Button x:Name="btnCancel" Content=" Cancel " MinWidth="75" Margin="5,0,5,0"
<Button x:Name="btnCancel"
Content=" Cancel "
Width="{Binding Path=ButtonWidth}"
MinWidth="75"
MinHeight="25"
Margin="5,0,5,0"
Visibility="{Binding Path=ShowCancel}"
IsDefault="{Binding Path=IsDefaultCancel}"
Click="BtnCancel_Click"/>

View File

@@ -96,13 +96,13 @@ public partial class MessageBoxEx : Window, INotifyPropertyChanged
public static void SetOwner(Window window)
{
IntPtr ownerHandle = GetOwnerHandle();
IntPtr parentHandle = GetParentHandle();
if (ownerHandle != IntPtr.Zero)
new WindowInteropHelper(window).Owner = ownerHandle;
if (parentHandle != IntPtr.Zero)
new WindowInteropHelper(window).Owner = parentHandle;
}
public static IntPtr GetOwnerHandle()
public static IntPtr GetParentHandle()
{
IntPtr foregroundWindow = GetForegroundWindow();
GetWindowThreadProcessId(foregroundWindow, out var procID);

View File

@@ -1250,9 +1250,14 @@ public partial class MainForm : Form
InitAndBuildContextMenu();
Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y);
GlobalHotkey.RegisterGlobalHotkeys(Handle);
TaskHelp.Run(WinMpvHelp.CopyMpvNetCom);
WasShown = true;
StrongReferenceMessenger.Default.Send(new MainWindowIsLoadedMessage());
TaskHelp.Run(() => {
System.Windows.Application.Current.Dispatcher.BeginInvoke(() => {
WinMpvHelp.AddToPath();
}, DispatcherPriority.Background);
});
}
void ContextMenu_Closed(object sender, System.Windows.RoutedEventArgs e) => MenuAutoResetEvent.Set();