Compare commits

...

10 Commits

Author SHA1 Message Date
stax76
a3b9c653fa v7.0.0.4 Beta 2023-12-19 09:37:46 +01:00
stax76
ed48f5c559 Command line parser supports list options with -add suffix. Fixex #619. 2023-12-19 03:18:55 +01:00
stax76
d328f6b7ec Main window: Limited geometry support 2023-12-17 19:08:55 +01:00
stax76
16ba94d67d updated manual and new libplacebo GUI options 2023-12-16 13:48:27 +01:00
stax76
7978170133 Merge pull request #617 from FantasqueX/fix-typo-1
fix typo in changelog
2023-12-16 08:44:03 +01:00
stax76
ab313eb442 new libplacebo options 2023-12-16 08:43:22 +01:00
Letu Ren
f40008d94a fix typo in changelog 2023-12-16 15:31:50 +08:00
stax76
75e19d8d18 newly developed combo box control 2023-12-16 04:57:49 +01:00
stax76
9bb978f612 new combo box control 2023-12-16 04:52:16 +01:00
stax76
3af5b458ba misc 2023-12-15 14:58:32 +01:00
27 changed files with 1009 additions and 359 deletions

View File

@@ -1,4 +1,25 @@
# v7.0.0.4 Beta (2023-12-19)
- When mpv.net is started for the first time from a new startup location,
it asks if file associations should be registered.
- Setup supports installing per user in non admin mode.
- Command line parser supports list options with `-add` suffix.
- Fix window sometimes shown with wrong size.
- Limited support for the mpv option `geometry`, it supports location in percent,
for size use `autofit`. Read the instructions in the mpv.net manual or in the conf editor.
- Improved manual.
- Improved bindings.
- Conf editor reorganized according to options categories used in mpv manual.
- mpv.net is available via command line package manager winget.
- New libplacebo config editor options added.
- The conf editor uses a newly developed combo box control (dropdown menu)
instead of radio buttons whenever an option has more than 3 items,
this improves the look and feel, usability and performance.
The navigation tree view was improved.
- New zhongfly libmpv build.
# v7.0.0.3 Beta (2023-12-15)
- New conf editor option `Video/libplacebo/preset`.
@@ -13,7 +34,8 @@
- Conf editor support added for the mpv options:
`reset-on-next-file`, `input-ipc-server`, `background`, `title`
- Conf editor crash fixed.
- When mpv.net is started for the first time from a new startup location, it asks if mpv.net should be added to the Path environment variable.
- When mpv.net is started for the first time from a new startup location,
it asks if mpv.net should be added to the Path environment variable.
# v7.0.0.2 Beta (2023-12-13)
@@ -38,7 +60,7 @@
- Fix message box exceding working area size.
- C# and PowerShell scripting was removed because of a compatibility problem
with the .NET 6 platform. .NET extensions are supported with a new host
(not backward compatible). A example extension is available under \src\MpvNet.Extension\ExampleExtension
(not backward compatible). An example extension is available under \src\MpvNet.Extension\ExampleExtension
- Redesigned bindings and context menu.
- auto-play option removed, mpv supports it with the option reset-on-next-file.
- Dark mode title bar enabled on Windows 10.0.18985 or higher.

View File

@@ -25,6 +25,7 @@ Table of contents
* [Hidden Features](#hidden-features)
* [Differences compared to mpv](#differences-compared-to-mpv)
* [Environment Variables](#environment-variables)
* [user-data](#user-data)
* [Context Menu Commands](#context-menu)
@@ -43,9 +44,7 @@ Download
--------
1. [Stable and beta portable and setup via GitHub download](../../../releases)
2. Stable via command line from winget: `winget install mpv.net`
2. Stable via command line with winget: `winget install mpv.net`
3. [Automated nightly portable builds](https://github.com/mpvnet-player/mpv.net/actions)
[Changelog](changelog.md)
@@ -54,10 +53,8 @@ Download
Installation
------------
1. Windows 7 or higher is required (Windows 10 or higher is recommended).
2. mpv.net since version 7.0 requires the
[.NET Desktop Runtime 6.0](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
being installed. mpv.net before version 7.0 requires .NET Framework 4.8.
1. Windows 10 or higher.
2. [.NET Desktop Runtime 6.0](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
Internet streaming requires:
@@ -69,8 +66,8 @@ Internet streaming requires:
File Associations can be registered using the context menu under 'Settings > Setup'.
After the file associations were registered, it might be necessary to change the
default app in the Windows settings (Win+I, ms-settings:defaultapps).
After the file associations were registered, it might still be necessary to change the
default app in the Windows settings.
Another way to register file associations is using Windows File Explorer,
select a media file and select 'Open with > Choose another app' in the context menu.
@@ -82,6 +79,11 @@ to get menu items for [Play with mpv.net](https://github.com/stax76/OpenWithPlus
When multiple files are selected in File Explorer and enter is pressed then
the files are opened in mpv.net in random order, this works with maximum 15 files.
#### Path environment variable
In order to use mpv.net in a terminal for advanced use cases,
mpv.net must be added to the Path environment variable,
this can be achieved with the context menu (Settings/Setup).
Support
-------
@@ -108,8 +110,9 @@ Settings
mpv.net searches the config folder at:
1. startup\portable_config
2. %APPDATA%\mpv.net (`C:\Users\%USERNAME%\AppData\Roaming\mpv.net`)
1. Folder defined via MPVNET_HOME environment variable.
2. startup\portable_config (startup means the directory containing mpvnet.exe)
3. `%APPDATA%\mpv.net` (`C:\Users\Username\AppData\Roaming\mpv.net`)
mpv options are stored in the file mpv.conf,
mpv.net options are stored in the file mpvnet.conf,
@@ -119,7 +122,7 @@ mpv.net options are documented [here](#mpvnet-specific-options).
Input and context menu
----------------------
Global keyboard shortcuts are supported via global-input.conf file.
Global keyboard shortcuts are supported via `global-input.conf` file.
The config folder can be opened from the context menu: `Settings > Open Config Folder`
@@ -139,24 +142,31 @@ mpv input options:
https://mpv.io/manual/master/#input
Before version v7 all bindings and the context menu definition
was contained in the input.conf file, which mpv.net created
were defined in the input.conf file, which mpv.net created
in case it didn't exist. This had the disadvantage that mpv.net
lost control over all default bindings and the context menu
defaults. This was unfortunate, v7 introduces a new design
fixing it.
lost control over all default bindings and context menu
defaults. This was unfortunate, v7 introduces a new bindings
and context menu design fixing it.
In v7 no input.conf file is created, the default bindings and
context menu is defined internally. input.conf only contains
what is different from the internally defined defaults,
so it's the same how mpv is used.
so it works the same it work with mpv.
For backward compatibility the old input.conf format with the
menu definition using `#menu: ` is still supported. The new
design also allows for a menu customization, in a sub section
called `Custom`. In input.conf it can be defined like so:
For backward compatibility the old input.conf context menu
format with the menu definition using `#menu: ` is still
supported. The new design also allows for a menu customization,
in a sub section called `Custom`. In input.conf it can be
defined like so:
`Ctrl+a show-text Test #custom-menu: Test > Test`
Users that have their bindings and context menu customized
before v7 can easily migrate to the new design by deleting
bindings they don't use and remember the shortcut and remove
`#menu:` everywhere, it's important to remove `#menu:`
everywhere in order to enable the new mode/design.
Command Line Interface
----------------------
@@ -192,8 +202,6 @@ Terminal
When mpv.net is started from a terminal it will output status,
error and debug messages to the terminal and accept input keys from the terminal.
A common task for the terminal is debugging scripts.
mpv.net specific commands
-------------------------
@@ -205,6 +213,9 @@ mpv.net commands are used when mpv commands don't exist or lack a feature.
### add-to-path
Adds mpv.net to the Path environment variable.
### edit-conf-file [mpv.conf|input.conf]
Opens mpv.conf or input.conf in a text editor.
### load-audio
Shows a file browser dialog to open external audio files.
@@ -259,12 +270,6 @@ Shows available [mpv input commands](https://mpv.io/manual/master/#list-of-input
### show-conf-editor
Shows the conf editor.
### show-decoders
Shows available decoders.
### show-demuxers
Shows available demuxers.
### show-input-editor
Shows the input editor.
@@ -513,7 +518,8 @@ Scripting
#### Lua
A very large collection of Lua user scripts can be found in the mpv wiki [here](https://github.com/mpv-player/mpv/wiki/User-Scripts).
A very large collection of user scripts can be found in the GitHub repository
[awesome-mpv](https://github.com/stax76/awesome-mpv).
Lua scripting is documented in the mpv.net wiki [here](https://github.com/mpvnet-player/mpv.net/wiki/Extending-mpv-and-mpv.net-via-Lua-scripting).
@@ -522,10 +528,10 @@ Lua scripting is documented in the mpv.net wiki [here](https://github.com/mpvnet
[mpv JavaScript documentation](https://mpv.io/manual/master/#javascript)
Extensions
----------
.NET Extensions
---------------
Extensions are located in a subfolder _extensions_ in the config folder,
.NET Extensions are located in a subfolder _extensions_ in the config folder,
the filename must have the same name as the directory:
```Text
@@ -625,14 +631,32 @@ https://mpv.io/manual/master/#window
- [window-scale](https://mpv.io/manual/master/#options-window-scale)
**Partly implemented are:**
**Partly implemented or modified:**
- [autofit-larger](https://mpv.io/manual/master/#options-autofit-larger)
Supported is a single integer value in the range 0-100.
- [autofit-smaller](https://mpv.io/manual/master/#options-autofit-smaller)
Supported is a single integer value in the range 0-100.
- [autofit](https://mpv.io/manual/master/#options-autofit)
Supported is a single integer value in the range 0-100.
#### --autofit=\<int\>
\<int\> Initial window height in percent. Default: 60
#### --autofit-smaller=\<int\>
\<int\> Minimum window height in percent. Default: 10
#### --autofit-larger=\<int\>
\<int\> Maximum window height in percent. Default: 80
#### --geometry\<x:y\>
Initial window location in percent. Default: 50:50 (centered)
x=0 docks the window to the left side.
x=100 docks the window to the right side.
y=0 docks the window to the top side.
y=100 docks the window to the bottom side.
**mpv.net specific window features:**
mpv.net specific window features are documented in the [screen section](#screen).
@@ -677,10 +701,18 @@ Environment Variables
Directory where mpv.net looks for user settings.
### MPVNET_VERSION
Returns the version of mpv.net.
user-data
---------
Script authors can access the following
[user-data](https://mpv.io/manual/master/#command-interface-user-data) properties:
```
user-data/frontend/name
user-data/frontend/version
user-data/frontend/process-path
```
Context Menu Commands
---------------------

View File

@@ -53,6 +53,7 @@ public class Conf
if (section.HasName("help")) baseSetting.Help = section.GetValue("help");
if (section.HasName("url")) baseSetting.URL = section.GetValue("url");
if (section.HasName("width")) baseSetting.Width = Convert.ToInt32(section.GetValue("width"));
if (section.HasName("option-name-width")) baseSetting.OptionNameWidth = Convert.ToInt32(section.GetValue("option-name-width"));
if (section.HasName("type")) baseSetting.Type = section.GetValue("type");
if (baseSetting.Help.ContainsEx("\\n"))

View File

@@ -1,36 +1,58 @@

using System.Windows;
using MpvNet.Windows.WPF;
namespace MpvNet.Windows.Help;
public class WinMpvHelp
{
public static void AddToPath()
public static void Setup()
{
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!;
if (path.ToLower().Contains(Folder.Startup.TrimEnd(Path.DirectorySeparatorChar).ToLower()))
return;
string dir = RegistryHelp.GetString("PathEnvVarCheck");
string dir = RegistryHelp.GetString("PathEnvVarCheck"); // backward compatibility
if (dir == Folder.Startup)
return;
var result = Msg.ShowQuestion("Would you like to add mpv.net to the Path environment variable?",
MessageBoxButton.YesNo);
dir = RegistryHelp.GetString("Setup");
if (result == MessageBoxResult.Yes)
if (dir == Folder.Startup)
return;
string path = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.User)!;
if (!path.ToLower().Contains(Folder.Startup.TrimEnd(Path.DirectorySeparatorChar).ToLower()))
{
Environment.SetEnvironmentVariable("Path",
Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";" + path,
EnvironmentVariableTarget.User);
var result = Msg.ShowQuestion("Would you like to add mpv.net to the Path environment variable?" + BR2 +
"This will allow using mpv.net in a console/terminal.", MessageBoxButton.YesNo);
Msg.ShowInfo("mpv.net was added successfully to Path.");
if (result == MessageBoxResult.Yes)
{
Environment.SetEnvironmentVariable("Path",
Folder.Startup.TrimEnd(Path.DirectorySeparatorChar) + ";" + path,
EnvironmentVariableTarget.User);
Msg.ShowInfo("mpv.net was added successfully to Path.");
}
else
Msg.ShowInfo("If you want to add mpv.net to the Path environment variable later," + BR +
"you can do so with the context menu (Settings/Setup)");
}
RegistryHelp.SetString("PathEnvVarCheck", Folder.Startup);
var result2 = Msg.ShowQuestion("Would you like to register video file associations?", MessageBoxButton.YesNo);
if (result2 == MessageBoxResult.Yes)
{
Player.Command("script-message-to mpvnet reg-file-assoc video");
result2 = Msg.ShowQuestion("Would you like to register audio file associations?", MessageBoxButton.YesNo);
if (result2 == MessageBoxResult.Yes)
Player.Command("script-message-to mpvnet reg-file-assoc audio");
}
else
Msg.ShowInfo("If you want to register file associations later," + BR +
"you can do so with the context menu (Settings/Setup)");
RegistryHelp.SetString("Setup", Folder.Startup);
}
}

View File

@@ -11,9 +11,9 @@
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>mpv-icon.ico</ApplicationIcon>
<Product>mpv.net</Product>
<FileVersion>7.0.0.3</FileVersion>
<AssemblyVersion>7.0.0.3</AssemblyVersion>
<InformationalVersion>7.0.0.3</InformationalVersion>
<FileVersion>7.0.0.4</FileVersion>
<AssemblyVersion>7.0.0.4</AssemblyVersion>
<InformationalVersion>7.0.0.4</InformationalVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@@ -7,7 +7,6 @@ using MpvNet.Help;
using MpvNet.Windows.UI;
using MpvNet.Windows.Help;
using MpvNet.Windows.WPF;
using System.Diagnostics;
namespace MpvNet.Windows;
@@ -97,10 +96,13 @@ static class Program
return;
}
if (App.CommandLine.Contains("--o="))
if (ProcessCommandLineArguments())
Environment.GetCommandLineArgs();
else if (App.CommandLine.Contains("--o="))
{
App.AutoLoadFolder = false;
Player.Init(IntPtr.Zero);
Player.ProcessCommandLineArgsPost();
Player.ProcessCommandLineFiles();
Player.SetPropertyString("idle", "no");
Player.EventLoop();
@@ -119,4 +121,48 @@ static class Program
Terminal.WriteError(ex);
}
}
static bool ProcessCommandLineArguments()
{
foreach (string arg in Environment.GetCommandLineArgs().Skip(1))
{
if (arg == "--profile=help")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(Player.GetProfiles());
Player.Destroy();
return true;
}
else if (arg == "--vd=help" || arg == "--ad=help")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(Player.GetDecoders());
Player.Destroy();
return true;
}
else if (arg == "--audio-device=help")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(Player.GetPropertyOsdString("audio-device-list"));
Player.Destroy();
return true;
}
else if (arg == "--input-keylist")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(Player.GetPropertyString("input-key-list").Replace(",", BR));
Player.Destroy();
return true;
}
else if (arg == "--version")
{
Player.Init(IntPtr.Zero, false);
Console.WriteLine(AppClass.About);
Player.Destroy();
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,7 @@
{
"profiles": {
"MpvNet.Windows": {
"commandName": "Project"
}
}
}

View File

@@ -3,7 +3,7 @@ name = process-instance
file = mpvnet
default = single
directory = General
help = Defines if more then one mpv.net process is allowed. (mpv.net option)\n\nMulti can alternatively be enabled by pressing the SHIFT key.
help = Defines if more then one mpv.net process is allowed.\nMulti can alternatively be enabled by pressing the SHIFT key. (mpv.net option)
option = multi Create a new process everytime the shell starts mpv.net
option = single Force a single process everytime the shell starts mpv.net
option = queue Force a single process and add files to playlist
@@ -44,6 +44,21 @@ file = mpvnet
directory = General
help = Used menu syntax for defining the context menu in input.conf.\nmpv.net by default uses '#menu:', uosc uses '#!' by default.
name = video-sync
file = mpv
default = audio
directory = General
help = How the player synchronizes audio and video.\n\nFor more information visit:
url = https://mpv.io/manual/master/#options-video-sync
option = audio
option = display-resample
option = display-resample-vdrop
option = display-resample-desync
option = display-vdrop
option = display-adrop
option = display-desync
option = desync
name = debug-mode
file = mpvnet
default = no
@@ -73,20 +88,20 @@ option = auto enable best hw decoder
option = yes exactly the same as auto
option = auto-copy enable best hw decoder with copy-back
option = auto-safe enable any whitelisted hw decoder
option = dxva2 requires vo=gpu with gpu-context=d3d11, gpu-context=angle or gpu-context=dxinterop (Windows only)
option = dxva2-copy copies video back to system RAM (Windows only)
option = d3d11va requires vo=gpu with gpu-context=d3d11 or gpu-context=angle (Windows 8+ only)
option = d3d11va-copy copies video back to system RAM (Windows 8+ only)
option = dxva2 requires vo=gpu with gpu-context=d3d11, gpu-context=angle or gpu-context=dxinterop
option = dxva2-copy copies video back to system RAM
option = d3d11va requires vo=gpu with gpu-context=d3d11 or gpu-context=angle
option = d3d11va-copy copies video back to system RAM
option = cuda requires vo=gpu (Any platform CUDA is available)
option = cuda-copy copies video back to system RAM (Any platform CUDA is available)
option = cuda-copy copies video back to system RAM
option = nvdec requires vo=gpu (Any platform CUDA is available)
option = nvdec-copy copies video back to system RAM (Any platform CUDA is available)
option = nvdec-copy copies video back to system RAM
name = gpu-api
file = mpv
default = auto
directory = Video
help = Controls which type of graphics APIs will be accepted. Auto uses d3d11, it should only be changed in case of problems, Vulkan is not recommended.
directory = Video/Render Options
help = Controls which type of graphics APIs will be accepted. On Windows this defaults to d3d11 and should not be changed without a good reason.
option = auto Use any available API
option = d3d11 Allow only gpu-context=d3d11
option = opengl Allow only OpenGL (requires OpenGL 2.1+ or GLES 2.0+)
@@ -95,7 +110,7 @@ option = vulkan Allow only Vulkan
name = gpu-context
file = mpv
default = auto
directory = Video
directory = Video/Render Options
option = auto auto-select
option = d3d11 Win32, with native Direct3D 11 rendering.
option = angle Direct3D11 through the OpenGL ES translation layer ANGLE. This supports almost everything the win backend does (if the ANGLE build is new enough).
@@ -103,67 +118,63 @@ option = win Win32/WGL
option = dxinterop (experimental) Win32, using WGL for rendering and Direct3D 9Ex for presentation. Works on Nvidia and AMD. Newer Intel chips with the latest drivers may also work.
option = winvk VK_KHR_win32_surface
name = video-sync
file = mpv
default = audio
directory = Video
help = How the player synchronizes audio and video.\n\nFor more information visit:
url = https://mpv.io/manual/master/#options-video-sync
option = audio
option = display-resample
option = display-resample-vdrop
option = display-resample-desync
option = display-vdrop
option = display-adrop
option = display-desync
option = desync
name = d3d11va-zero-copy
file = mpv
default = no
directory = Video
help = By default, when using hardware decoding with --gpu-api=d3d11, the video image will be copied (GPU-to-GPU) from the decoder surface to a shader resource. Set this option to avoid that copy by sampling directly from the decoder image. This may increase performance and reduce power usage, but can cause the image to be sampled incorrectly on the bottom and right edges due to padding, and may invoke driver bugs, since Direct3D 11 technically does not allow sampling from a decoder surface (though most drivers support it.)
option = yes
option = no
name = scale
file = mpv
default = bilinear
directory = Video/Render Options
default = lanczos
directory = Video/Render Options/Scaling
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).
url = https://mpv.io/manual/master/#options-scale
option = bilinear
option = spline36
option = lanczos
option = ewa_lanczos
option = ewa_lanczossharp
option = mitchell
option = oversample
name = cscale
file = mpv
default = bilinear
directory = Video/Render Options
directory = Video/Render Options/Scaling
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).
url = https://mpv.io/manual/master/#options-cscale
option = bilinear
option = spline36
option = lanczos
option = ewa_lanczos
option = ewa_lanczossharp
option = mitchell
option = oversample
name = dscale
file = mpv
default =
directory = Video/Render Options
default = lanczos
directory = Video/Render Options/Scaling
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).
url = https://mpv.io/manual/master/#options-dscale
option = bilinear
option = spline36
option = lanczos
option = ewa_lanczos
option = ewa_lanczossharp
option = mitchell
option = oversample
name = correct-downscaling
file = mpv
default = no
directory = Video/Render Options/Scaling
help = When using convolution based filters, extend the filter size when downscaling. Increases quality, but reduces performance while downscaling.\n\nThis will perform slightly sub-optimally for anamorphic video (but still better than without it) since it will extend the size to match only the milder of the scale factors between the axes.
option = yes
option = no
name = sigmoid-upscaling
file = mpv
default = no
directory = Video/Render Options/Scaling
help = When upscaling, use a sigmoidal color transform to avoid emphasizing ringing artifacts. This also implies linear-scaling.
option = yes
option = no
name = dither-depth
file = mpv
@@ -175,22 +186,6 @@ option = auto Automatic selection. If output bit depth cannot be detected, 8 bi
option = 8 Dither to 8 bit output.
option = 10 Dither to 10 bit output.
name = correct-downscaling
file = mpv
default = no
directory = Video/Render Options
help = When using convolution based filters, extend the filter size when downscaling. Increases quality, but reduces performance while downscaling.\n\nThis will perform slightly sub-optimally for anamorphic video (but still better than without it) since it will extend the size to match only the milder of the scale factors between the axes.
option = yes
option = no
name = sigmoid-upscaling
file = mpv
default = no
directory = Video/Render Options
help = When upscaling, use a sigmoidal color transform to avoid emphasizing ringing artifacts. This also implies linear-scaling.
option = yes
option = no
name = deband
file = mpv
default = no
@@ -203,7 +198,7 @@ name = hdr-compute-peak
file = mpv
default = auto
directory = Video/Render Options
help = Compute the HDR peak and frame average brightness per-frame instead of relying on tagged metadata. These values are averaged over local regions as well as over several frames to prevent the value from jittering around too much. This option basically gives you dynamic, per-scene tone mapping. Requires compute shaders, which is a fairly recent OpenGL feature, and will probably also perform horribly on some drivers, so enable at your own risk. The special value auto (default) will enable HDR peak computation automatically if compute shaders and SSBOs are supported.
url = https://mpv.io/manual/master/#options-hdr-compute-peak
option = auto
option = yes
option = no
@@ -212,7 +207,15 @@ name = allow-delayed-peak-detect
file = mpv
default = yes
directory = Video/Render Options
help = When using --hdr-compute-peak, allow delaying the detected peak by a frame when beneficial for performance. In particular, this is required to avoid an unnecessary FBO indirection when no advanced rendering is required otherwise. Has no effect if there already is an indirect pass, such as when advanced scaling is enabled. (Only affects --vo=gpu-next, note that --vo=gpu always delays the peak.)
url = https://mpv.io/manual/master/#options-allow-delayed-peak-detect
option = yes
option = no
name = d3d11va-zero-copy
file = mpv
default = no
directory = Video/Render Options
url = https://mpv.io/manual/master/#options-d3d11va-zero-copy
option = yes
option = no
@@ -239,10 +242,10 @@ option = high_quality Reset all everything to high quality presets (where avail
name = upscaler
file = libplacebo
directory = Video/libplacebo/Scaling
default = default
help = Sets the filter used for upscaling. Defaults to lanczos.
default = lanczos
help = Sets the filter used for upscaling.
url = https://libplacebo.org/options/#upscalerfilter
option = default Default.
option-name-width = 135
option = none No filter, only use basic GPU texture sampling.
option = nearest Nearest-neighbour (box) sampling (very fast).
option = bilinear Bilinear sampling (very fast).
@@ -255,12 +258,119 @@ option = ewa_lanczos EWA Lanczos ("Jinc") reconstruction (slow).
option = ewa_lanczossharp Sharpened version of ewa_lanczos (slow).
option = ewa_lanczos4sharpest Very sharp version of ewa_lanczos, with anti-ringing (very slow).
name = downscaler
file = libplacebo
directory = Video/libplacebo/Scaling
default = hermite
help = Sets the filter used for downscaling. The most relevant options, roughly ordered from fastest to slowest.
option = none Use the same filter as specified for upscaler
option = box Box averaging (very fast)
option = hermite Hermite-weighted averaging (fast)
option = bilinear Bilinear (triangle) averaging (fast)
option = bicubic Bicubic interpolation (fast)
option = gaussian Gaussian smoothing (fast)
option = catmull_rom Catmull-Rom cubic spline
option = mitchell Mitchell-Netravalia cubic spline
option = lanczos Lanczos reconstruction
name = plane_upscaler
file = libplacebo
directory = Video/libplacebo/Scaling
default = none
help = Override the filter used for upscaling planes, e.g. chroma/alpha. If set to none, use the same setting as upscaler, respectively.
option = none Use the same filter as specified for upscaler
option = box Box averaging (very fast)
option = hermite Hermite-weighted averaging (fast)
option = bilinear Bilinear (triangle) averaging (fast)
option = bicubic Bicubic interpolation (fast)
option = gaussian Gaussian smoothing (fast)
option = catmull_rom Catmull-Rom cubic spline
option = mitchell Mitchell-Netravalia cubic spline
option = lanczos Lanczos reconstruction
name = plane_downscaler
file = libplacebo
directory = Video/libplacebo/Scaling
default = none
help = Override the filter used for downscaling planes, e.g. chroma/alpha. If set to none, use the same setting as downscaler, respectively.
option = none Use the same filter as specified for upscaler
option = box Box averaging (very fast)
option = hermite Hermite-weighted averaging (fast)
option = bilinear Bilinear (triangle) averaging (fast)
option = bicubic Bicubic interpolation (fast)
option = gaussian Gaussian smoothing (fast)
option = catmull_rom Catmull-Rom cubic spline
option = mitchell Mitchell-Netravalia cubic spline
option = lanczos Lanczos reconstruction
name = frame_mixer
file = libplacebo
directory = Video/libplacebo/Scaling
default = oversample
help = Sets the filter used for frame mixing (temporal interpolation). Roughly ordered from fastest to slowest.
option = none Disable frame mixing, show nearest frame to target PTS
option = oversample Oversampling, only mix "edge" frames while preserving FPS
option = hermite Hermite-weighted frame mixing
option = linear Linear frame mixing
option = cubic Cubic B-spline frame mixing
name = antiringing_strength
file = libplacebo
directory = Video/libplacebo/Scaling
help = <0.0..1.0> Antiringing strength to use for all filters. A value of 0.0 disables antiringing, and a value of 1.0 enables full-strength antiringing. Defaults to 0.0.
name = deband
file = libplacebo
directory = Video/libplacebo/Debanding
help = Enables debanding using libplacebo.
default = no
option = yes
option = no
name = deband_iterations
file = libplacebo
directory = Video/libplacebo/Debanding
help = <0..16> The number of debanding steps to perform per sample. Each step reduces a bit more banding, but takes time to compute. Note that the strength of each step falls off very quickly, so high numbers (>4) are practically useless. Defaults to 1.
name = deband_threshold
file = libplacebo
directory = Video/libplacebo/Debanding
help = <0.0..1000.0> The debanding filter's cut-off threshold. Higher numbers increase the debanding strength dramatically, but progressively diminish image details. Defaults to 3.0.
name = deband_radius
file = libplacebo
directory = Video/libplacebo/Debanding
help = <0.0..1000.0> The debanding filter's initial radius. The radius increases linearly for each iteration. A higher radius will find more gradients, but a lower radius will smooth more aggressively. Defaults to 16.0.
name = deband_grain
file = libplacebo
directory = Video/libplacebo/Debanding
help = <0.0..1000.0> Add some extra noise to the image. This significantly helps cover up remaining quantization artifacts. Higher numbers add more noise. Defaults to 4.0, which is very mild.
name = sigmoid
file = libplacebo
directory = Video/libplacebo/Sigmoidization
help = Enables sigmoidization.
default = yes
option = yes
option = no
name = sigmoid_center
file = libplacebo
directory = Video/libplacebo/Sigmoidization
help = <0.0..1.0> The center (bias) of the sigmoid curve. Defaults to 0.75.
name = sigmoid_slope
file = libplacebo
directory = Video/libplacebo/Sigmoidization
help = <1.0..20.0> The slope (steepness) of the sigmoid curve. Defaults to 6.5.
name = screenshot-directory
file = mpv
width = 500
type = folder
directory = Video/Screenshot
help = Store screenshots in this directory. This path is joined with the filename generated by screenshot-template. If the template filename is already absolute, the directory is ignored.\n\nIf the directory does not exist, it is created on the first screenshot. If it is not a directory, an error is generated when trying to write a screenshot.
help = Store screenshots in this directory. This path is joined with the filename generated by screenshot-template. If the template filename is already absolute, the directory is ignored.
name = screenshot-format
file = mpv
@@ -333,7 +443,7 @@ name = alang
file = mpv
directory = Audio
type = string
help = Specify a priority list of audio languages to use. Different container formats employ different language codes. DVDs use ISO 639-1 two-letter language codes, Matroska, MPEG-TS and NUT use ISO 639-2 three-letter language codes, while OGM uses a free-form identifier. See also aid.\n\nExamples\n\nmpv dvd://1 alang=hu,en chooses the Hungarian language track on a DVD and falls back on English if Hungarian is not available.\n\nmpv alang=jpn example.mkv plays a Matroska file with Japanese audio.
help = Specify a priority list of audio languages to use. Different container formats employ different language codes. DVDs use ISO 639-1 two-letter language codes, Matroska, MPEG-TS and NUT use ISO 639-2 three-letter language codes, while OGM uses a free-form identifier. See also aid.
name = audio-file-auto
file = mpv
@@ -398,10 +508,16 @@ type = color
directory = Subtitle
help = See sub-color. Color used for sub text background. You can use sub-shadow-offset to change its size relative to the text.
name = title
file = mpv
directory = Window
width = 400
help = Set the window title. This is used for the video window, and if possible, also sets the audio stream title. Properties are expanded. Warning! There is a danger of this causing significant CPU usage, depending on the properties used.
name = fullscreen
file = mpv
default = no
directory = Screen
directory = Window
help = Start the player in fullscreen mode.
option = yes
option = no
@@ -409,71 +525,84 @@ option = no
name = border
file = mpv
default = yes
directory = Screen
directory = Window
help = Show window with decoration (titlebar, border).
option = yes
option = no
name = screen
file = mpv
directory = Screen
directory = Window
help = <0-32> In multi-monitor configurations (i.e. a single desktop that spans across multiple displays), this option tells mpv which screen to display the video on.
name = taskbar-progress
file = mpv
default = yes
directory = Window
help = Show progress in taskbar.
option = yes
option = no
name = osd-playing-msg
file = mpv
width = 300
directory = Screen
directory = Window
type = string
help = Show a message on OSD when playback starts. The string is expanded for properties, e.g. osd-playing-msg='file: ${filename}' will show the message file: followed by a space and the currently played filename. For more information visit:
url = https://mpv.io/manual/master/#property-expansion
name = osd-font-size
file = mpv
directory = Screen
directory = Window
help = Specify the OSD font size. See sub-font-size for details. Default: 55
name = osd-duration
file = mpv
directory = Screen
directory = Window
help = Set the duration of the OSD messages in ms. Default: 1000
name = osd-scale-by-window
file = mpv
default = yes
directory = Screen
directory = Window
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.
option = yes
option = no
name = autofit
file = mpv
directory = Screen
directory = Window
help = <int> Initial window height in percent. Default: 60
name = autofit-image
file = mpvnet
directory = Screen
help = <int> Initial window height in percent for image files. Default: 80
name = autofit-audio
file = mpvnet
directory = Screen
help = <int> Initial window height in percent for audio files. Default: 70
name = autofit-smaller
file = mpv
directory = Screen
directory = Window
help = <int> Minimum window height in percent. Default: 10
name = autofit-larger
file = mpv
directory = Screen
directory = Window
help = <int> Maximum window height in percent. Default: 80
name = autofit-image
file = mpvnet
directory = Window
help = <int> Initial window height in percent for image files. Default: 80
name = autofit-audio
file = mpvnet
directory = Window
help = <int> Initial window height in percent for audio files. Default: 70
name = geometry
file = mpvnet
directory = Window
help = <x:y> Initial window location in percent. Default: 50:50 (centered)\n\nx=0 docks the window to the left side.\nx=100 docks the window to the right side.\ny=0 docks the window to the top side.\ny=100 docks the window to the bottom side.
name = start-size
file = mpvnet
default = height-session
directory = Screen
directory = Window
help = Setting to remember the window size. (mpv.net option)
option = width-session Window width is remembered in the current session
option = width-always Window width is always remembered
@@ -486,25 +615,25 @@ option = always Window size is always remembered
name = keepaspect-window
file = mpv
default = yes
directory = Screen
directory = Window
help = keepaspect-window will lock the window size to the video aspect. Default: yes
option = yes
option = no
name = minimum-aspect-ratio
file = mpvnet
directory = Screen
directory = Window
help = <float> Minimum aspect ratio of the window. Useful to force a wider window and therefore a larger OSC. (mpv.net option)
name = minimum-aspect-ratio-audio
file = mpvnet
directory = Screen
directory = Window
help = Same as minimum-aspect-ratio but used for audio files.
name = remember-window-position
file = mpvnet
default = no
directory = Screen
directory = Window
help = Save the window position on exit. (mpv.net option)
option = yes
option = no
@@ -512,7 +641,7 @@ option = no
name = snap-window
file = mpv
default = no
directory = Screen
directory = Window
help = Snap the player window to screen edges.
option = yes
option = no
@@ -520,27 +649,8 @@ option = no
name = window-maximized
file = mpv
default = no
directory = Screen
help = Start with a maximized window.
option = yes
option = no
name = start-threshold
file = mpvnet
directory = Screen
help = Threshold in milliseconds to wait for libmpv returning the video resolution before the window is shown, otherwise default dimensions are used as defined by autofit and start-size. Default: 1500 (mpv.net option)
name = title
file = mpv
directory = Window
width = 400
help = Set the window title. This is used for the video window, and if possible, also sets the audio stream title. Properties are expanded. Warning! There is a danger of this causing significant CPU usage, depending on the properties used.
name = taskbar-progress
file = mpv
default = yes
directory = Playback
help = Show progress in taskbar.
help = Start with a maximized window.
option = yes
option = no

View File

@@ -16,6 +16,7 @@ public abstract class Setting
public string? Value { get; set; }
public int Width { get; set; }
public int OptionNameWidth { get; set; } = 100;
public ConfItem? ConfItem { get; set; }
}
@@ -35,12 +36,13 @@ public class OptionSettingOption
public string? Name { get; set; }
public string? Help { get; set; }
public int OptionWidth { get => OptionSetting!.OptionNameWidth; }
public OptionSetting? OptionSetting { get; set; }
public string? Text
{
get => string.IsNullOrEmpty(_text) ? Name : _text;
get => _text ?? Name;
set => _text = value;
}

View File

@@ -0,0 +1,18 @@

using System.Windows.Controls;
using System.Windows;
namespace MpvNet.Windows.WPF;
public class ComboBoxTemplateSelector : DataTemplateSelector
{
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
ContentPresenter presenter = (ContentPresenter)container;
if (presenter.TemplatedParent is ComboBox)
return (DataTemplate)presenter.FindResource("ComboBoxCollapsedDataTemplate");
else // Templated parent is ComboBoxItem
return (DataTemplate)presenter.FindResource("ComboBoxExpandedDataTemplate");
}
}

View File

@@ -28,8 +28,8 @@
<KeyBinding Key="n" Modifiers="Ctrl" Command="{Binding ShowMpvNetSpecificSettingsCommand}"/>
<KeyBinding Key="F5" Command="{Binding PreviewMpvConfFileCommand}"/>
<KeyBinding Key="F6" Command="{Binding PreviewMpvNetConfFileCommand}"/>
<KeyBinding Key="F1" Command="{Binding ShowMpvManualCommand}"/>
<KeyBinding Key="F2" Command="{Binding ShowMpvNetManualCommand}"/>
<KeyBinding Key="F1" Modifiers="Ctrl" Command="{Binding ShowMpvManualCommand}"/>
<KeyBinding Key="F2" Modifiers="Ctrl" Command="{Binding ShowMpvNetManualCommand}"/>
</Window.InputBindings>
<Grid>
@@ -40,7 +40,7 @@
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170" />
<ColumnDefinition Width="180" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
@@ -135,12 +135,12 @@
<Separator />
<MenuItem
Header="Show mpv manual"
InputGestureText="F1"
InputGestureText="Ctrl+F1"
Command="{Binding Data.ShowMpvManualCommand, Source={StaticResource BindingProxy}}"
/>
<MenuItem
Header="Show mpv.net manual"
InputGestureText="F2"
InputGestureText="Ctrl+F2"
Command="{Binding Data.ShowMpvNetManualCommand, Source={StaticResource BindingProxy}}"
/>
</ContextMenu>

View File

@@ -48,7 +48,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
SelectNodeFromSearchText(node);
foreach (var node in Nodes)
ExpandNode(node);
node.IsExpanded = true;
}
public Theme? Theme => Theme.Current;
@@ -134,7 +134,9 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
foreach (ConfItem item in ConfItems)
{
if (setting.Name == item.Name && item.Section == "" && !item.IsSectionItem)
if (setting.Name == item.Name &&
setting.File == item.File &&
item.Section == "" && !item.IsSectionItem)
{
setting.Value = item.Value;
setting.StartValue = setting.Value;
@@ -149,7 +151,10 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
MainStackPanel.Children.Add(new StringSettingControl(s) { Visibility = Visibility.Collapsed });
break;
case OptionSetting s:
MainStackPanel.Children.Add(new OptionSettingControl(s) { Visibility = Visibility.Collapsed });
if (s.Options.Count > 3)
MainStackPanel.Children.Add(new ComboBoxSettingControl(s) { Visibility = Visibility.Collapsed });
else
MainStackPanel.Children.Add(new OptionSettingControl(s) { Visibility = Visibility.Collapsed });
break;
}
}
@@ -239,7 +244,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
{
if (!isSectionItem && comment != "" && comment != "\r\n")
ConfItems.Add(new ConfItem() {
Comment = comment, File = System.IO.Path.GetFileNameWithoutExtension(file)});
Comment = comment, File = Path.GetFileNameWithoutExtension(file)});
section = line.Substring(0, line.IndexOf("]") + 1);
comment = "";
@@ -251,7 +256,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
line += "=yes";
ConfItem item = new();
item.File = System.IO.Path.GetFileNameWithoutExtension(file);
item.File = Path.GetFileNameWithoutExtension(file);
item.IsSectionItem = isSectionItem;
item.Comment = comment;
comment = "";
@@ -498,6 +503,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
if (node.Path + ":" == SearchText)
{
node.IsSelected = true;
node.IsExpanded = true;
return;
}
@@ -514,14 +520,6 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
UnselectNode(it);
}
void ExpandNode(NodeViewModel node)
{
node.IsExpanded = true;
foreach (var it in node.Children)
ExpandNode(it);
}
[RelayCommand] void ShowMpvNetSpecificSettings() => SearchText = "mpv.net";
[RelayCommand] void PreviewMpvConfFile() => Msg.ShowInfo(GetContent("mpv"));

View File

@@ -0,0 +1,72 @@
<UserControl
x:Name="ComboBoxSettingControl1"
x:Class="MpvNet.Windows.WPF.ComboBoxSettingControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:MpvNet.Windows.WPF"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800">
<Grid Margin="20,0">
<StackPanel>
<TextBox
x:Name="TitleTextBox"
FontSize="24"
Margin="0,10"
BorderThickness="0"
IsReadOnly="True"
Foreground="{Binding Theme.Heading}"
Background="{Binding Theme.Background}"
/>
<ComboBox
Name="ComboBoxControl"
Width="200"
HorizontalAlignment="Left"
MaxDropDownHeight="2000"
Foreground="{Binding Theme.Foreground}"
Background="{Binding Theme.Background}"
SelectionChanged="ComboBoxControl_SelectionChanged"
>
<ComboBox.ItemTemplateSelector>
<local:ComboBoxTemplateSelector/>
</ComboBox.ItemTemplateSelector>
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<Style.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="3"/>
</Style>
</Style.Resources>
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
<TextBox
x:Name="HelpTextBox"
TextWrapping="WrapWithOverflow"
BorderThickness="0"
IsReadOnly="True"
Margin="0,10,0,0"
Foreground="{Binding Theme.Foreground}"
Background="{Binding Theme.Background}"
/>
<TextBlock
x:Name="LinkTextBlock"
Margin="2,0"
>
<local:HyperlinkEx
x:Name="Link"
Foreground="{Binding Theme.Heading}"
/>
</TextBlock>
</StackPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,69 @@

using System.Windows;
using System.Windows.Controls;
using MpvNet.Windows.UI;
namespace MpvNet.Windows.WPF;
public partial class ComboBoxSettingControl : UserControl, ISettingControl
{
OptionSetting OptionSetting;
public ComboBoxSettingControl(OptionSetting optionSetting)
{
OptionSetting = optionSetting;
InitializeComponent();
DataContext = this;
TitleTextBox.Text = optionSetting.Name;
if (string.IsNullOrEmpty(optionSetting.Help))
HelpTextBox.Visibility = Visibility.Collapsed;
HelpTextBox.Text = optionSetting.Help;
ComboBoxControl.ItemsSource = optionSetting.Options;
foreach (var item in optionSetting.Options)
if (item.Name == optionSetting.Value)
ComboBoxControl.SelectedItem = item;
if (string.IsNullOrEmpty(optionSetting.URL))
LinkTextBlock.Visibility = Visibility.Collapsed;
Link.SetURL(optionSetting.URL);
}
public Theme? Theme => Theme.Current;
public Setting Setting => OptionSetting;
public bool Contains(string searchString) => ContainsInternal(searchString.ToLower());
public bool ContainsInternal(string search)
{
if (TitleTextBox.Text.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) > -1)
return true;
if (HelpTextBox.Text.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) > -1)
return true;
foreach (var i in OptionSetting.Options)
{
if (i.Text?.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) > -1)
return true;
if (i.Help?.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) > -1)
return true;
if (i.Name?.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) > -1)
return true;
}
return false;
}
void ComboBoxControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
OptionSetting.Value = (ComboBoxControl.SelectedItem as OptionSettingOption)?.Name;
}
}

View File

@@ -66,8 +66,14 @@
Background="{Binding Theme.Background}"
/>
<TextBlock x:Name="LinkTextBlock" Margin="0,10">
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
<TextBlock
x:Name="LinkTextBlock"
Margin="2,0,0,0"
>
<local:HyperlinkEx
x:Name="Link"
Foreground="{Binding Theme.Heading}"
/>
</TextBlock>
</StackPanel>
</Grid>

View File

@@ -21,6 +21,10 @@ public partial class OptionSettingControl : UserControl, ISettingControl
HelpTextBox.Visibility = Visibility.Collapsed;
HelpTextBox.Text = optionSetting.Help;
if (string.IsNullOrEmpty(optionSetting.Help))
LinkTextBlock.Margin = new Thickness(2, 6, 0, 0);
ItemsControl.ItemsSource = optionSetting.Options;
if (string.IsNullOrEmpty(optionSetting.URL))

View File

@@ -60,8 +60,14 @@
Background="{Binding Theme.Background}"
/>
<TextBlock x:Name="LinkTextBlock" Margin="0,10">
<local:HyperlinkEx x:Name="Link"></local:HyperlinkEx>
<TextBlock
x:Name="LinkTextBlock"
Margin="2,0"
>
<local:HyperlinkEx
x:Name="Link"
Foreground="{Binding Theme.Heading}"
/>
</TextBlock>
</StackPanel>
</Grid>

View File

@@ -6,6 +6,183 @@
xmlns:local="clr-namespace:MpvNet.Windows.WPF"
>
<DataTemplate x:Key="ComboBoxCollapsedDataTemplate" >
<TextBlock Text="{Binding Text}"/>
</DataTemplate>
<DataTemplate x:Key="ComboBoxExpandedDataTemplate" >
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
<Border>
<TextBlock
Text="{Binding Text}"
Width="{Binding OptionWidth}"
VerticalAlignment="Center"
TextWrapping="Wrap"
/>
</Border>
<Border>
<TextBlock
Text="{Binding Help}"
MaxWidth="400"
Padding="0,3"
VerticalAlignment="Center"
TextWrapping="Wrap"
/>
</Border>
</StackPanel>
</DataTemplate>
<Style x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="32" />
</Grid.ColumnDefinitions>
<Border
x:Name="Border"
Grid.ColumnSpan="2"
CornerRadius="3"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
/>
<Path
x:Name="Arrow"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 1,1.5 L 4.5,5 L 8,1.5"
SnapsToDevicePixels="false"
Stroke="{TemplateBinding Foreground}"
StrokeThickness="1.5"
/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
<Border x:Name="PART_ContentHost" Focusable="True" />
</ControlTemplate>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="Foreground" Value="#333" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="FontSize" Value="13" />
<Setter Property="MinWidth" Value="150"/>
<Setter Property="MinHeight" Value="25"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton
Cursor="Hand"
Name="ToggleButton"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
Foreground="{TemplateBinding Foreground}"
Style="{StaticResource ComboBoxToggleButton}"
Grid.Column="2"
Focusable="false"
IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press"
/>
<ContentPresenter
Name="ContentSite"
IsHitTestVisible="False"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
Margin="10,3,30,3"
VerticalAlignment="Center"
HorizontalAlignment="Left"
/>
<TextBox
x:Name="PART_EditableTextBox"
Style="{x:Null}"
Template="{StaticResource ComboBoxTextBox}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="3,3,23,3"
Focusable="True"
Visibility="Hidden"
IsReadOnly="{TemplateBinding IsReadOnly}"
/>
<Popup
Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide"
>
<Grid
Name="DropDown"
SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
>
<Border
CornerRadius="3"
x:Name="DropDownBorder"
Background="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}, Path=Background}"
BorderBrush="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}, Path=Foreground}"
BorderThickness="1"
/>
<ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True">
<StackPanel
IsItemsHost="True"
KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasItems" Value="false">
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
</Trigger>
<Trigger Property="IsGrouping" Value="true">
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</Trigger>
<Trigger Property="IsEditable" Value="true">
<Setter Property="IsTabStop" Value="false"/>
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
<Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" Value="0.56"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="BorderBrush" Value="#FF7EB4EA"/>
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.Theme.Heading}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="local:HyperlinkEx">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
@@ -53,20 +230,23 @@
</Style>
<Style TargetType="TextBox">
<Setter Property="MinHeight" Value="25" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border x:Name="border"
BorderBrush="{DynamicResource PrimaryTextBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
CornerRadius="3"
SnapsToDevicePixels="True">
<Border
x:Name="border"
BorderBrush="{DynamicResource PrimaryTextBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
CornerRadius="3"
SnapsToDevicePixels="True">
<ScrollViewer x:Name="PART_ContentHost"
Focusable="false"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden"/>
<ScrollViewer
x:Name="PART_ContentHost"
Focusable="false"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden"/>
</Border>
<ControlTemplate.Triggers>

View File

@@ -6,6 +6,7 @@ using System.Threading;
using System.Windows.Forms;
using System.Windows.Threading;
using System.Windows.Forms.Integration;
using System.Text.RegularExpressions;
using MpvNet.Windows.WPF;
using MpvNet.Windows.UI;
@@ -67,8 +68,7 @@ public partial class MainForm : Form
GuiCommand.Current.WindowScaleNet += GuiCommand_WindowScaleNet;
GuiCommand.Current.ShowMenu += GuiCommand_ShowMenu;
if (Player.GPUAPI != "vulkan")
Init();
Init();
_taskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated");
@@ -162,6 +162,7 @@ public partial class MainForm : Form
Player.ObservePropertyDouble("window-scale", PropChangeWindowScale);
Player.ProcessCommandLineArgsPost();
Player.ProcessCommandLineFiles();
}
@@ -506,7 +507,7 @@ public partial class MainForm : Form
return null;
}
void SetFormPosAndSize(bool force = false, bool checkAutofit = true)
void SetFormPosAndSize(bool force = false, bool checkAutofit = true, bool load = false)
{
if (!force)
{
@@ -605,10 +606,10 @@ public partial class MainForm : Form
Player.WasInitialSizeSet = true;
}
SetSize(width, height, screen, checkAutofit);
SetSize(width, height, screen, checkAutofit, load);
}
void SetSize(int width, int height, Screen screen, bool checkAutofit = true)
void SetSize(int width, int height, Screen screen, bool checkAutofit = true, bool load = false)
{
Rectangle workingArea = WinApiHelp.GetWorkingArea(Handle, screen.WorkingArea);
@@ -655,16 +656,19 @@ public partial class MainForm : Form
var rect = new Rect(new Rectangle(screen.Bounds.X, screen.Bounds.Y, width, height));
WinApiHelp.AddWindowBorders(Handle, ref rect, GetDpi(Handle));
int left = middlePos.X - rect.Width / 2;
int top = middlePos.Y - rect.Height / 2;
width = rect.Width;
height = rect.Height;
int left = middlePos.X - width / 2;
int top = middlePos.Y - height / 2;
Rectangle currentRect = new Rectangle(Left, Top, Width, Height);
if (GetHorizontalLocation(screen) == -1) left = Left;
if (GetHorizontalLocation(screen) == 1) left = currentRect.Right - rect.Width;
if (GetHorizontalLocation(screen) == 1) left = currentRect.Right - width;
if (GetVerticalLocation(screen) == -1) top = Top;
if (GetVerticalLocation(screen) == 1) top = currentRect.Bottom - rect.Height;
if (GetVerticalLocation(screen) == 1) top = currentRect.Bottom - height;
Screen[] screens = Screen.AllScreens;
@@ -673,20 +677,53 @@ public partial class MainForm : Form
int minTop = screens.Select(val => WinApiHelp.GetWorkingArea(Handle, val.WorkingArea).Y).Min();
int maxBottom = screens.Select(val => WinApiHelp.GetWorkingArea(Handle, val.WorkingArea).Bottom).Max();
if (load && CommandLine.Contains("geometry"))
{
string geometryString = CommandLine.GetValue("geometry");
var geometry = ParseGeometry(geometryString, WinApiHelp.GetWorkingArea(
Handle, Screen.FromHandle(Handle).WorkingArea), width, height);
if (geometry.x != int.MaxValue)
left = geometry.x;
if (geometry.y != int.MaxValue)
top = geometry.y;
}
if (left < minLeft)
left = minLeft;
if (left + rect.Width > maxRight)
left = maxRight - rect.Width;
if (left + width > maxRight)
left = maxRight - width;
if (top < minTop)
top = minTop;
if (top + rect.Height > maxBottom)
top = maxBottom - rect.Height;
if (top + height > maxBottom)
top = maxBottom - height;
uint SWP_NOACTIVATE = 0x0010;
SetWindowPos(Handle, IntPtr.Zero, left, top, rect.Width, rect.Height, SWP_NOACTIVATE);
SetWindowPos(Handle, IntPtr.Zero, left, top, width, height, SWP_NOACTIVATE);
}
(int x, int y) ParseGeometry(string input, Rectangle workingArea, int width, int height)
{
int x = int.MaxValue;
int y = int.MaxValue;
Match match = Regex.Match(input, @"^(\d+)%?:(\d+)%?$");
if (match.Success)
{
x = int.Parse(match.Groups[1].Value);
y = int.Parse(match.Groups[2].Value);
x = workingArea.Left + Convert.ToInt32((workingArea.Width - width) / 100.0 * x);
y = workingArea.Top + Convert.ToInt32((workingArea.Height - height) / 100.0 * y);
}
return (x, y);
}
public void CycleFullscreen(bool enabled)
@@ -1220,10 +1257,8 @@ public partial class MainForm : Form
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (Player.GPUAPI != "vulkan")
Player.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
_lastCycleFullscreen = Environment.TickCount;
SetFormPosAndSize();
SetFormPosAndSize(false, true, true);
}
protected override void OnLostFocus(EventArgs e)
@@ -1236,9 +1271,6 @@ public partial class MainForm : Form
{
base.OnShown(e);
if (Player.GPUAPI == "vulkan")
Init();
if (WindowState == FormWindowState.Maximized)
Player.SetPropertyBool("window-maximized", true);
@@ -1255,7 +1287,7 @@ public partial class MainForm : Form
TaskHelp.Run(() => {
System.Windows.Application.Current.Dispatcher.BeginInvoke(() => {
WinMpvHelp.AddToPath();
WinMpvHelp.Setup();
}, DispatcherPriority.Background);
});
}

View File

@@ -10,7 +10,6 @@ namespace MpvNet;
public class AppClass
{
public List<string> TempFiles { get; } = new ();
public Dictionary<string, string> CommandLineArguments { get; } = new ();
public string ConfPath { get => Player.ConfigFolder + "mpvnet.conf"; }
public string ProcessInstance { get; set; } = "single";
@@ -31,7 +30,6 @@ public class AppClass
public bool RememberVolume { get; set; } = true;
public bool RememberWindowPosition { get; set; }
public int StartThreshold { get; set; } = 1500;
public int RecentCount { get; set; } = 15;
public float AutofitAudio { get; set; } = 0.7f;
@@ -155,7 +153,6 @@ public class AppClass
case "remember-volume": RememberVolume = value == "yes"; return true;
case "remember-window-position": RememberWindowPosition = value == "yes"; return true;
case "start-size": StartSize = value; return true;
case "start-threshold": StartThreshold = value.ToInt(1500); return true;
case "video-file-extensions": FileTypes.Video = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;
default:

73
src/MpvNet/CommandLine.cs Normal file
View File

@@ -0,0 +1,73 @@

namespace MpvNet;
public class CommandLine
{
static List<StringPair>? _arguments;
public static List<StringPair> Arguments
{
get
{
if (_arguments != null)
return _arguments;
_arguments = new();
foreach (string i in Environment.GetCommandLineArgs().Skip(1))
{
string arg = i;
if (!arg.StartsWith("--"))
continue;
if (!arg.Contains('='))
{
if (arg.Contains("--no-"))
{
arg = arg.Replace("--no-", "--");
arg += "=no";
}
else
arg += "=yes";
}
string left = arg[2..arg.IndexOf("=")];
string right = arg[(left.Length + 3)..];
if (string.IsNullOrEmpty(left))
continue;
switch (left)
{
case "script": left = "scripts"; break;
case "audio-file": left = "audio-files"; break;
case "sub-file": left = "sub-files"; break;
case "external-file": left = "external-files"; break;
}
_arguments.Add(new StringPair(left, right));
}
return _arguments;
}
}
public static bool Contains(string name)
{
foreach (StringPair pair in Arguments)
if (pair.Name == name)
return true;
return false;
}
public static string GetValue(string name)
{
foreach (StringPair pair in Arguments)
if (pair.Name == name)
return pair.Value;
return "";
}
}

View File

@@ -125,8 +125,6 @@ public static class InputHelp
new (_("View") + " > " + _("More"), _("Show Console"), "script-binding console/enable", "`"),
new (_("View") + " > " + _("More"), _("Show Audio Devices"), "script-message-to mpvnet show-audio-devices"),
new (_("View") + " > " + _("More"), _("Show Commands"), "script-message-to mpvnet show-commands", "F2"),
new (_("View") + " > " + _("More"), _("Show Demuxers"), "script-message-to mpvnet show-demuxers"),
new (_("View") + " > " + _("More"), _("Show Decoders"), "script-message-to mpvnet show-decoders"),
new (_("View") + " > " + _("More"), _("Show Bindings"), "script-message-to mpvnet show-bindings"),
new (_("Window"), _("Fullscreen"), "cycle fullscreen", "Enter"),

View File

@@ -64,7 +64,7 @@ public class MpvClient
OnEndFile(data);
}
break;
case mpv_event_id.MPV_EVENT_FILE_LOADED:
case mpv_event_id.MPV_EVENT_FILE_LOADED: // triggered after MPV_EVENT_START_FILE
OnFileLoaded();
break;
case mpv_event_id.MPV_EVENT_PROPERTY_CHANGE:
@@ -82,7 +82,7 @@ public class MpvClient
case mpv_event_id.MPV_EVENT_COMMAND_REPLY:
OnCommandReply();
break;
case mpv_event_id.MPV_EVENT_START_FILE:
case mpv_event_id.MPV_EVENT_START_FILE: // triggered before MPV_EVENT_FILE_LOADED
OnStartFile();
break;
case mpv_event_id.MPV_EVENT_AUDIO_RECONFIG:

View File

@@ -50,7 +50,6 @@ public class MainPlayer : MpvClient
public float AutofitLarger { get; set; } = 0.8f;
public AutoResetEvent ShutdownAutoResetEvent { get; } = new AutoResetEvent(false);
public AutoResetEvent VideoSizeAutoResetEvent { get; } = new AutoResetEvent(false);
public nint MainHandle { get; set; }
public List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
public List<TimeSpan> BluRayTitles { get; } = new List<TimeSpan>();
@@ -64,7 +63,7 @@ public class MainPlayer : MpvClient
public event Action<int>? PlaylistPosChanged;
public event Action<Size>? VideoSizeChanged;
public void Init(IntPtr formHandle)
public void Init(IntPtr formHandle, bool processCommandLineArguments = true)
{
App.ApplyShowMenuFix();
@@ -110,11 +109,12 @@ public class MainPlayer : MpvClient
if (!string.IsNullOrEmpty(UsedInputConfContent))
SetPropertyString("input-conf", @"memory://" + UsedInputConfContent);
ProcessCommandLineArgs();
if (processCommandLineArguments)
ProcessCommandLineArgs();
if (App.CommandLineArguments.ContainsKey("config-dir"))
if (CommandLine.Contains("config-dir"))
{
string configDir = App.CommandLineArguments["config-dir"];
string configDir = CommandLine.GetValue("config-dir");
string fullPath = System.IO.Path.GetFullPath(configDir);
App.InputConf.Path = fullPath.AddSep() + "input.conf";
string content = App.InputConf.GetContent();
@@ -151,16 +151,20 @@ public class MainPlayer : MpvClient
// this means Lua scripts that use idle might not work correctly
SetPropertyString("idle", "yes");
ObservePropertyString("path", value => Path = value);
ObservePropertyBool("pause", value => {
Paused = value;
Pause?.Invoke();
});
ObservePropertyInt("video-rotate", value => {
VideoRotate = value;
UpdateVideoSize("dwidth", "dheight");
VideoRotate = GetPropertyInt("video-rotate");
ObservePropertyInt("video-rotate", value =>
{
if (VideoRotate != value)
{
VideoRotate = value;
UpdateVideoSize("dwidth", "dheight");
}
});
ObservePropertyInt("playlist-pos", value => {
@@ -172,9 +176,6 @@ public class MainPlayer : MpvClient
CommandV("quit");
});
if (!GetPropertyBool("osd-scale-by-window"))
App.StartThreshold = 0;
Initialized?.Invoke();
}
@@ -315,19 +316,18 @@ public class MainPlayer : MpvClient
void UpdateVideoSize(string w, string h)
{
Size size = new Size(GetPropertyInt(w), GetPropertyInt(h));
if (size.Width == 0 || size.Height == 0)
if (string.IsNullOrEmpty(Path))
return;
Size size = new Size(GetPropertyInt(w), GetPropertyInt(h));
if (VideoRotate == 90 || VideoRotate == 270)
size = new Size(size.Height, size.Width);
if (VideoSize != size)
if (size != VideoSize && size != Size.Empty)
{
VideoSize = size;
VideoSizeChanged?.Invoke(size);
VideoSizeAutoResetEvent.Set();
}
}
@@ -357,24 +357,27 @@ public class MainPlayer : MpvClient
base.OnLogMessage(data);
}
protected override void OnVideoReconfig()
{
UpdateVideoSize("dwidth", "dheight");
base.OnVideoReconfig();
}
protected override void OnEndFile(mpv_event_end_file data)
{
base.OnEndFile(data);
FileEnded = true;
}
protected override void OnVideoReconfig()
{
UpdateVideoSize("dwidth", "dheight");
base.OnVideoReconfig();
}
// executed before OnFileLoaded
protected override void OnStartFile()
{
Path = GetPropertyString("path");
base.OnStartFile();
TaskHelp.Run(LoadFolder);
}
// executed after OnStartFile
protected override void OnFileLoaded()
{
Duration = TimeSpan.FromSeconds(GetPropertyDouble("duration"));
@@ -382,13 +385,8 @@ public class MainPlayer : MpvClient
if (App.StartSize == "video")
WasInitialSizeSet = false;
string path = GetPropertyString("path");
if (!FileTypes.Video.Contains(path.Ext()) || FileTypes.Audio.Contains(path.Ext()))
{
if (!FileTypes.Video.Contains(Path.Ext()) || FileTypes.Audio.Contains(Path.Ext()))
UpdateVideoSize("width", "height");
VideoSizeAutoResetEvent.Set();
}
TaskHelp.Run(UpdateTracks);
@@ -417,75 +415,28 @@ public class MainPlayer : MpvClient
public void ProcessCommandLineArgs()
{
foreach (string i in Environment.GetCommandLineArgs().Skip(1))
foreach (var pair in CommandLine.Arguments)
{
string arg = i;
if (!arg.StartsWith("--"))
if (pair.Name.EndsWith("-add"))
continue;
if (arg == "--profile=help")
{
Console.WriteLine(GetProfiles());
continue;
}
else if (arg == "--vd=help" || arg == "--ad=help")
{
Console.WriteLine(GetDecoders());
continue;
}
else if (arg == "--audio-device=help")
{
Console.WriteLine(GetPropertyOsdString("audio-device-list"));
continue;
}
else if (arg == "--version")
{
Console.WriteLine(AppClass.About);
continue;
}
else if (arg == "--input-keylist")
{
Console.WriteLine(GetPropertyString("input-key-list").Replace(",", BR));
continue;
}
else if (arg.StartsWith("--command="))
{
Command(arg[10..]);
continue;
}
ProcessProperty(pair.Name, pair.Value);
if (!arg.Contains('='))
if (!App.ProcessProperty(pair.Name, pair.Value))
SetPropertyString(pair.Name, pair.Value);
}
}
public void ProcessCommandLineArgsPost()
{
foreach (var pair in CommandLine.Arguments)
{
if (pair.Name.EndsWith("-add"))
{
if (arg.Contains("--no-"))
{
arg = arg.Replace("--no-", "--");
arg += "=no";
}
else
arg += "=yes";
string name = pair.Name[..^4];
string separator = name.Contains("-file") || name.Contains("-path") ? ";" : ",";
SetPropertyString(name, GetPropertyString(name) + separator + pair.Value);
}
string left = arg[2..arg.IndexOf("=")];
string right = arg[(left.Length + 3)..];
if (string.IsNullOrEmpty(left))
continue;
switch (left)
{
case "script": left = "scripts"; break;
case "audio-file": left = "audio-files"; break;
case "sub-file": left = "sub-files"; break;
case "external-file": left = "external-files"; break;
}
App.CommandLineArguments[left] = right;
ProcessProperty(left, right);
if (!App.ProcessProperty(left, right))
SetPropertyString(left, right);
}
}
@@ -506,12 +457,6 @@ public class MainPlayer : MpvClient
Command("playlist-shuffle");
SetPropertyInt("playlist-pos", 0);
}
if (files.Count == 0 || files[0].Contains("://"))
{
VideoSizeChanged?.Invoke(VideoSize);
VideoSizeAutoResetEvent.Set();
}
}
public DateTime LastLoad;

View File

@@ -0,0 +1,7 @@
{
"profiles": {
"MpvNet": {
"commandName": "Project"
}
}
}

View File

@@ -1,4 +1,5 @@
namespace MpvNet.Windows;

namespace MpvNet;
public class StringPair
{

View File

@@ -11,12 +11,14 @@ AppVersion={#MyAppVersion}
AppPublisher=Frank Skare (stax76)
ArchitecturesInstallIn64BitMode=x64
Compression=lzma2
DefaultDirName={commonpf}\{#MyAppName}
DefaultDirName={autopf}\{#MyAppName}
OutputBaseFilename=mpv.net-v{#MyAppVersion}-setup
OutputDir=E:\Desktop
DefaultGroupName={#MyAppName}
SetupIconFile=..\..\MpvNet.Windows\mpv-icon.ico
UninstallDisplayIcon={app}\{#MyAppExeName}
PrivilegesRequired=admin
PrivilegesRequiredOverridesAllowed=dialog
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"