Command line parser supports list options with -add suffix. Fixex #619.
This commit is contained in:
@@ -1,13 +1,19 @@
|
|||||||
|
|
||||||
# v7.0.0.4 Beta (2023-??-??)
|
# v7.0.0.4 Beta (2023-??-??)
|
||||||
|
|
||||||
|
- 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,
|
- Limited support for the mpv option `geometry`, it supports location in percent,
|
||||||
for size use `autofit`. Please read the instructions in the mpv.net manual or in the conf editor.
|
for size use `autofit`. Read the instructions in the mpv.net manual or in the conf editor.
|
||||||
- Updated and improved manual.
|
- 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.
|
- mpv.net is available via command line package manager winget.
|
||||||
- New libplacebo config editor options added.
|
- New libplacebo config editor options added.
|
||||||
- The conf editor uses a newly developed combo box control (dropdown menu)
|
- The conf editor uses a newly developed combo box control (dropdown menu)
|
||||||
instead of radio buttons whenever an option has more than 3 items.
|
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.
|
- New zhongfly libmpv build.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Table of contents
|
|||||||
* [Hidden Features](#hidden-features)
|
* [Hidden Features](#hidden-features)
|
||||||
* [Differences compared to mpv](#differences-compared-to-mpv)
|
* [Differences compared to mpv](#differences-compared-to-mpv)
|
||||||
* [Environment Variables](#environment-variables)
|
* [Environment Variables](#environment-variables)
|
||||||
|
* [user-data](#user-data)
|
||||||
* [Context Menu Commands](#context-menu)
|
* [Context Menu Commands](#context-menu)
|
||||||
|
|
||||||
|
|
||||||
@@ -269,12 +270,6 @@ Shows available [mpv input commands](https://mpv.io/manual/master/#list-of-input
|
|||||||
### show-conf-editor
|
### show-conf-editor
|
||||||
Shows the conf editor.
|
Shows the conf editor.
|
||||||
|
|
||||||
### show-decoders
|
|
||||||
Shows available decoders.
|
|
||||||
|
|
||||||
### show-demuxers
|
|
||||||
Shows available demuxers.
|
|
||||||
|
|
||||||
### show-input-editor
|
### show-input-editor
|
||||||
Shows the input editor.
|
Shows the input editor.
|
||||||
|
|
||||||
@@ -707,6 +702,18 @@ Environment Variables
|
|||||||
Directory where mpv.net looks for user settings.
|
Directory where mpv.net looks for user settings.
|
||||||
|
|
||||||
|
|
||||||
|
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
|
Context Menu Commands
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using MpvNet.Help;
|
|||||||
using MpvNet.Windows.UI;
|
using MpvNet.Windows.UI;
|
||||||
using MpvNet.Windows.Help;
|
using MpvNet.Windows.Help;
|
||||||
using MpvNet.Windows.WPF;
|
using MpvNet.Windows.WPF;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace MpvNet.Windows;
|
namespace MpvNet.Windows;
|
||||||
|
|
||||||
@@ -97,10 +96,13 @@ static class Program
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App.CommandLine.Contains("--o="))
|
if (ProcessCommandLineArguments())
|
||||||
|
Environment.GetCommandLineArgs();
|
||||||
|
else if (App.CommandLine.Contains("--o="))
|
||||||
{
|
{
|
||||||
App.AutoLoadFolder = false;
|
App.AutoLoadFolder = false;
|
||||||
Player.Init(IntPtr.Zero);
|
Player.Init(IntPtr.Zero);
|
||||||
|
Player.ProcessCommandLineArgsPost();
|
||||||
Player.ProcessCommandLineFiles();
|
Player.ProcessCommandLineFiles();
|
||||||
Player.SetPropertyString("idle", "no");
|
Player.SetPropertyString("idle", "no");
|
||||||
Player.EventLoop();
|
Player.EventLoop();
|
||||||
@@ -119,4 +121,48 @@ static class Program
|
|||||||
Terminal.WriteError(ex);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,21 @@ file = mpvnet
|
|||||||
directory = General
|
directory = General
|
||||||
help = Used menu syntax for defining the context menu in input.conf.\nmpv.net by default uses '#menu:', uosc uses '#!' by default.
|
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
|
name = debug-mode
|
||||||
file = mpvnet
|
file = mpvnet
|
||||||
default = no
|
default = no
|
||||||
@@ -85,8 +100,8 @@ option = nvdec-copy copies video back to system RAM
|
|||||||
name = gpu-api
|
name = gpu-api
|
||||||
file = mpv
|
file = mpv
|
||||||
default = auto
|
default = auto
|
||||||
directory = Video
|
directory = Video/Render Options
|
||||||
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.
|
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 = auto Use any available API
|
||||||
option = d3d11 Allow only gpu-context=d3d11
|
option = d3d11 Allow only gpu-context=d3d11
|
||||||
option = opengl Allow only OpenGL (requires OpenGL 2.1+ or GLES 2.0+)
|
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
|
name = gpu-context
|
||||||
file = mpv
|
file = mpv
|
||||||
default = auto
|
default = auto
|
||||||
directory = Video
|
directory = Video/Render Options
|
||||||
option = auto auto-select
|
option = auto auto-select
|
||||||
option = d3d11 Win32, with native Direct3D 11 rendering.
|
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).
|
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,33 +118,10 @@ 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 = 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
|
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
|
|
||||||
url = https://mpv.io/manual/master/#options-d3d11va-zero-copy
|
|
||||||
option = yes
|
|
||||||
option = no
|
|
||||||
|
|
||||||
name = scale
|
name = scale
|
||||||
file = mpv
|
file = mpv
|
||||||
default = lanczos
|
default = lanczos
|
||||||
directory = Video/Render Options
|
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
|
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
|
||||||
url = https://mpv.io/manual/master/#options-scale
|
url = https://mpv.io/manual/master/#options-scale
|
||||||
option = bilinear
|
option = bilinear
|
||||||
@@ -143,7 +135,7 @@ option = oversample
|
|||||||
name = cscale
|
name = cscale
|
||||||
file = mpv
|
file = mpv
|
||||||
default = bilinear
|
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.
|
help = As scale, but for interpolating chroma information. If the image is not subsampled, this option is ignored entirely.
|
||||||
url = https://mpv.io/manual/master/#options-cscale
|
url = https://mpv.io/manual/master/#options-cscale
|
||||||
option = bilinear
|
option = bilinear
|
||||||
@@ -157,7 +149,7 @@ option = oversample
|
|||||||
name = dscale
|
name = dscale
|
||||||
file = mpv
|
file = mpv
|
||||||
default = lanczos
|
default = lanczos
|
||||||
directory = Video/Render Options
|
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.
|
help = Like scale, but apply these filters on downscaling instead. \nIf no option is selected, it will keep the same with the upscaler.
|
||||||
url = https://mpv.io/manual/master/#options-dscale
|
url = https://mpv.io/manual/master/#options-dscale
|
||||||
option = bilinear
|
option = bilinear
|
||||||
@@ -168,6 +160,22 @@ option = ewa_lanczossharp
|
|||||||
option = mitchell
|
option = mitchell
|
||||||
option = oversample
|
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
|
name = dither-depth
|
||||||
file = mpv
|
file = mpv
|
||||||
default = no
|
default = no
|
||||||
@@ -178,22 +186,6 @@ option = auto Automatic selection. If output bit depth cannot be detected, 8 bi
|
|||||||
option = 8 Dither to 8 bit output.
|
option = 8 Dither to 8 bit output.
|
||||||
option = 10 Dither to 10 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
|
name = deband
|
||||||
file = mpv
|
file = mpv
|
||||||
default = no
|
default = no
|
||||||
@@ -219,6 +211,14 @@ url = https://mpv.io/manual/master/#options-allow-delayed-peak-detect
|
|||||||
option = yes
|
option = yes
|
||||||
option = no
|
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
|
||||||
|
|
||||||
name = background
|
name = background
|
||||||
file = mpv
|
file = mpv
|
||||||
directory = Video/Render Options
|
directory = Video/Render Options
|
||||||
@@ -242,11 +242,10 @@ option = high_quality Reset all everything to high quality presets (where avail
|
|||||||
name = upscaler
|
name = upscaler
|
||||||
file = libplacebo
|
file = libplacebo
|
||||||
directory = Video/libplacebo/Scaling
|
directory = Video/libplacebo/Scaling
|
||||||
default = default
|
default = lanczos
|
||||||
help = Sets the filter used for upscaling. Defaults to lanczos.
|
help = Sets the filter used for upscaling.
|
||||||
url = https://libplacebo.org/options/#upscalerfilter
|
url = https://libplacebo.org/options/#upscalerfilter
|
||||||
option-name-width = 135
|
option-name-width = 135
|
||||||
option = default Default.
|
|
||||||
option = none No filter, only use basic GPU texture sampling.
|
option = none No filter, only use basic GPU texture sampling.
|
||||||
option = nearest Nearest-neighbour (box) sampling (very fast).
|
option = nearest Nearest-neighbour (box) sampling (very fast).
|
||||||
option = bilinear Bilinear sampling (very fast).
|
option = bilinear Bilinear sampling (very fast).
|
||||||
@@ -263,7 +262,7 @@ name = downscaler
|
|||||||
file = libplacebo
|
file = libplacebo
|
||||||
directory = Video/libplacebo/Scaling
|
directory = Video/libplacebo/Scaling
|
||||||
default = hermite
|
default = hermite
|
||||||
help = Sets the filter used for downscaling. Defaults to hermite. The most relevant options, roughly ordered from fastest to slowest.
|
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 = none Use the same filter as specified for upscaler
|
||||||
option = box Box averaging (very fast)
|
option = box Box averaging (very fast)
|
||||||
option = hermite Hermite-weighted averaging (fast)
|
option = hermite Hermite-weighted averaging (fast)
|
||||||
@@ -323,7 +322,7 @@ help = <0.0..1.0> Antiringing strength to use for all filters. A value of 0.0 di
|
|||||||
name = deband
|
name = deband
|
||||||
file = libplacebo
|
file = libplacebo
|
||||||
directory = Video/libplacebo/Debanding
|
directory = Video/libplacebo/Debanding
|
||||||
help = Enables debanding.
|
help = Enables debanding using libplacebo.
|
||||||
default = no
|
default = no
|
||||||
option = yes
|
option = yes
|
||||||
option = no
|
option = no
|
||||||
@@ -509,10 +508,16 @@ type = color
|
|||||||
directory = Subtitle
|
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.
|
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
|
name = fullscreen
|
||||||
file = mpv
|
file = mpv
|
||||||
default = no
|
default = no
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = Start the player in fullscreen mode.
|
help = Start the player in fullscreen mode.
|
||||||
option = yes
|
option = yes
|
||||||
option = no
|
option = no
|
||||||
@@ -520,76 +525,84 @@ option = no
|
|||||||
name = border
|
name = border
|
||||||
file = mpv
|
file = mpv
|
||||||
default = yes
|
default = yes
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = Show window with decoration (titlebar, border).
|
help = Show window with decoration (titlebar, border).
|
||||||
option = yes
|
option = yes
|
||||||
option = no
|
option = no
|
||||||
|
|
||||||
name = screen
|
name = screen
|
||||||
file = mpv
|
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.
|
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
|
name = osd-playing-msg
|
||||||
file = mpv
|
file = mpv
|
||||||
width = 300
|
width = 300
|
||||||
directory = Screen
|
directory = Window
|
||||||
type = string
|
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:
|
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
|
url = https://mpv.io/manual/master/#property-expansion
|
||||||
|
|
||||||
name = osd-font-size
|
name = osd-font-size
|
||||||
file = mpv
|
file = mpv
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = Specify the OSD font size. See sub-font-size for details. Default: 55
|
help = Specify the OSD font size. See sub-font-size for details. Default: 55
|
||||||
|
|
||||||
name = osd-duration
|
name = osd-duration
|
||||||
file = mpv
|
file = mpv
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = Set the duration of the OSD messages in ms. Default: 1000
|
help = Set the duration of the OSD messages in ms. Default: 1000
|
||||||
|
|
||||||
name = osd-scale-by-window
|
name = osd-scale-by-window
|
||||||
file = mpv
|
file = mpv
|
||||||
default = yes
|
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.
|
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 = yes
|
||||||
option = no
|
option = no
|
||||||
|
|
||||||
name = autofit
|
name = autofit
|
||||||
file = mpv
|
file = mpv
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = <int> Initial window height in percent. Default: 60
|
help = <int> Initial window height in percent. Default: 60
|
||||||
|
|
||||||
name = autofit-smaller
|
name = autofit-smaller
|
||||||
file = mpv
|
file = mpv
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = <int> Minimum window height in percent. Default: 10
|
help = <int> Minimum window height in percent. Default: 10
|
||||||
|
|
||||||
name = autofit-larger
|
name = autofit-larger
|
||||||
file = mpv
|
file = mpv
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = <int> Maximum window height in percent. Default: 80
|
help = <int> Maximum window height in percent. Default: 80
|
||||||
|
|
||||||
name = autofit-image
|
name = autofit-image
|
||||||
file = mpvnet
|
file = mpvnet
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = <int> Initial window height in percent for image files. Default: 80
|
help = <int> Initial window height in percent for image files. Default: 80
|
||||||
|
|
||||||
name = autofit-audio
|
name = autofit-audio
|
||||||
file = mpvnet
|
file = mpvnet
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = <int> Initial window height in percent for audio files. Default: 70
|
help = <int> Initial window height in percent for audio files. Default: 70
|
||||||
|
|
||||||
name = geometry
|
name = geometry
|
||||||
file = mpvnet
|
file = mpvnet
|
||||||
directory = Screen
|
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.
|
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
|
name = start-size
|
||||||
file = mpvnet
|
file = mpvnet
|
||||||
default = height-session
|
default = height-session
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = Setting to remember the window size. (mpv.net option)
|
help = Setting to remember the window size. (mpv.net option)
|
||||||
option = width-session Window width is remembered in the current session
|
option = width-session Window width is remembered in the current session
|
||||||
option = width-always Window width is always remembered
|
option = width-always Window width is always remembered
|
||||||
@@ -602,25 +615,25 @@ option = always Window size is always remembered
|
|||||||
name = keepaspect-window
|
name = keepaspect-window
|
||||||
file = mpv
|
file = mpv
|
||||||
default = yes
|
default = yes
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = keepaspect-window will lock the window size to the video aspect. Default: yes
|
help = keepaspect-window will lock the window size to the video aspect. Default: yes
|
||||||
option = yes
|
option = yes
|
||||||
option = no
|
option = no
|
||||||
|
|
||||||
name = minimum-aspect-ratio
|
name = minimum-aspect-ratio
|
||||||
file = mpvnet
|
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)
|
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
|
name = minimum-aspect-ratio-audio
|
||||||
file = mpvnet
|
file = mpvnet
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = Same as minimum-aspect-ratio but used for audio files.
|
help = Same as minimum-aspect-ratio but used for audio files.
|
||||||
|
|
||||||
name = remember-window-position
|
name = remember-window-position
|
||||||
file = mpvnet
|
file = mpvnet
|
||||||
default = no
|
default = no
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = Save the window position on exit. (mpv.net option)
|
help = Save the window position on exit. (mpv.net option)
|
||||||
option = yes
|
option = yes
|
||||||
option = no
|
option = no
|
||||||
@@ -628,7 +641,7 @@ option = no
|
|||||||
name = snap-window
|
name = snap-window
|
||||||
file = mpv
|
file = mpv
|
||||||
default = no
|
default = no
|
||||||
directory = Screen
|
directory = Window
|
||||||
help = Snap the player window to screen edges.
|
help = Snap the player window to screen edges.
|
||||||
option = yes
|
option = yes
|
||||||
option = no
|
option = no
|
||||||
@@ -636,27 +649,8 @@ option = no
|
|||||||
name = window-maximized
|
name = window-maximized
|
||||||
file = mpv
|
file = mpv
|
||||||
default = no
|
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
|
directory = Window
|
||||||
width = 400
|
help = Start with a maximized window.
|
||||||
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.
|
|
||||||
option = yes
|
option = yes
|
||||||
option = no
|
option = no
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
<KeyBinding Key="n" Modifiers="Ctrl" Command="{Binding ShowMpvNetSpecificSettingsCommand}"/>
|
<KeyBinding Key="n" Modifiers="Ctrl" Command="{Binding ShowMpvNetSpecificSettingsCommand}"/>
|
||||||
<KeyBinding Key="F5" Command="{Binding PreviewMpvConfFileCommand}"/>
|
<KeyBinding Key="F5" Command="{Binding PreviewMpvConfFileCommand}"/>
|
||||||
<KeyBinding Key="F6" Command="{Binding PreviewMpvNetConfFileCommand}"/>
|
<KeyBinding Key="F6" Command="{Binding PreviewMpvNetConfFileCommand}"/>
|
||||||
<KeyBinding Key="F1" Command="{Binding ShowMpvManualCommand}"/>
|
<KeyBinding Key="F1" Modifiers="Ctrl" Command="{Binding ShowMpvManualCommand}"/>
|
||||||
<KeyBinding Key="F2" Command="{Binding ShowMpvNetManualCommand}"/>
|
<KeyBinding Key="F2" Modifiers="Ctrl" Command="{Binding ShowMpvNetManualCommand}"/>
|
||||||
</Window.InputBindings>
|
</Window.InputBindings>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="170" />
|
<ColumnDefinition Width="180" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
@@ -135,12 +135,12 @@
|
|||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Header="Show mpv manual"
|
Header="Show mpv manual"
|
||||||
InputGestureText="F1"
|
InputGestureText="Ctrl+F1"
|
||||||
Command="{Binding Data.ShowMpvManualCommand, Source={StaticResource BindingProxy}}"
|
Command="{Binding Data.ShowMpvManualCommand, Source={StaticResource BindingProxy}}"
|
||||||
/>
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Header="Show mpv.net manual"
|
Header="Show mpv.net manual"
|
||||||
InputGestureText="F2"
|
InputGestureText="Ctrl+F2"
|
||||||
Command="{Binding Data.ShowMpvNetManualCommand, Source={StaticResource BindingProxy}}"
|
Command="{Binding Data.ShowMpvNetManualCommand, Source={StaticResource BindingProxy}}"
|
||||||
/>
|
/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
|||||||
SelectNodeFromSearchText(node);
|
SelectNodeFromSearchText(node);
|
||||||
|
|
||||||
foreach (var node in Nodes)
|
foreach (var node in Nodes)
|
||||||
ExpandNode(node);
|
node.IsExpanded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Theme? Theme => Theme.Current;
|
public Theme? Theme => Theme.Current;
|
||||||
@@ -134,7 +134,9 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
|||||||
|
|
||||||
foreach (ConfItem item in ConfItems)
|
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.Value = item.Value;
|
||||||
setting.StartValue = setting.Value;
|
setting.StartValue = setting.Value;
|
||||||
@@ -242,7 +244,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
|||||||
{
|
{
|
||||||
if (!isSectionItem && comment != "" && comment != "\r\n")
|
if (!isSectionItem && comment != "" && comment != "\r\n")
|
||||||
ConfItems.Add(new ConfItem() {
|
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);
|
section = line.Substring(0, line.IndexOf("]") + 1);
|
||||||
comment = "";
|
comment = "";
|
||||||
@@ -254,7 +256,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
|||||||
line += "=yes";
|
line += "=yes";
|
||||||
|
|
||||||
ConfItem item = new();
|
ConfItem item = new();
|
||||||
item.File = System.IO.Path.GetFileNameWithoutExtension(file);
|
item.File = Path.GetFileNameWithoutExtension(file);
|
||||||
item.IsSectionItem = isSectionItem;
|
item.IsSectionItem = isSectionItem;
|
||||||
item.Comment = comment;
|
item.Comment = comment;
|
||||||
comment = "";
|
comment = "";
|
||||||
@@ -501,6 +503,7 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
|||||||
if (node.Path + ":" == SearchText)
|
if (node.Path + ":" == SearchText)
|
||||||
{
|
{
|
||||||
node.IsSelected = true;
|
node.IsSelected = true;
|
||||||
|
node.IsExpanded = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,14 +520,6 @@ public partial class ConfWindow : Window, INotifyPropertyChanged
|
|||||||
UnselectNode(it);
|
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 ShowMpvNetSpecificSettings() => SearchText = "mpv.net";
|
||||||
|
|
||||||
[RelayCommand] void PreviewMpvConfFile() => Msg.ShowInfo(GetContent("mpv"));
|
[RelayCommand] void PreviewMpvConfFile() => Msg.ShowInfo(GetContent("mpv"));
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ public partial class MainForm : Form
|
|||||||
GuiCommand.Current.WindowScaleNet += GuiCommand_WindowScaleNet;
|
GuiCommand.Current.WindowScaleNet += GuiCommand_WindowScaleNet;
|
||||||
GuiCommand.Current.ShowMenu += GuiCommand_ShowMenu;
|
GuiCommand.Current.ShowMenu += GuiCommand_ShowMenu;
|
||||||
|
|
||||||
if (Player.GPUAPI != "vulkan")
|
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
_taskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated");
|
_taskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated");
|
||||||
@@ -163,6 +162,7 @@ public partial class MainForm : Form
|
|||||||
|
|
||||||
Player.ObservePropertyDouble("window-scale", PropChangeWindowScale);
|
Player.ObservePropertyDouble("window-scale", PropChangeWindowScale);
|
||||||
|
|
||||||
|
Player.ProcessCommandLineArgsPost();
|
||||||
Player.ProcessCommandLineFiles();
|
Player.ProcessCommandLineFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,10 +677,9 @@ public partial class MainForm : Form
|
|||||||
int minTop = screens.Select(val => WinApiHelp.GetWorkingArea(Handle, val.WorkingArea).Y).Min();
|
int minTop = screens.Select(val => WinApiHelp.GetWorkingArea(Handle, val.WorkingArea).Y).Min();
|
||||||
int maxBottom = screens.Select(val => WinApiHelp.GetWorkingArea(Handle, val.WorkingArea).Bottom).Max();
|
int maxBottom = screens.Select(val => WinApiHelp.GetWorkingArea(Handle, val.WorkingArea).Bottom).Max();
|
||||||
|
|
||||||
if (load && App.CommandLine.Contains(" --geometry="))
|
if (load && CommandLine.Contains("geometry"))
|
||||||
{
|
{
|
||||||
string geometryString = Environment.GetCommandLineArgs()
|
string geometryString = CommandLine.GetValue("geometry");
|
||||||
.Where(i => i.StartsWith("--geometry=")).First().Substring(11);
|
|
||||||
|
|
||||||
var geometry = ParseGeometry(geometryString, WinApiHelp.GetWorkingArea(
|
var geometry = ParseGeometry(geometryString, WinApiHelp.GetWorkingArea(
|
||||||
Handle, Screen.FromHandle(Handle).WorkingArea), width, height);
|
Handle, Screen.FromHandle(Handle).WorkingArea), width, height);
|
||||||
@@ -1258,10 +1257,6 @@ public partial class MainForm : Form
|
|||||||
protected override void OnLoad(EventArgs e)
|
protected override void OnLoad(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnLoad(e);
|
base.OnLoad(e);
|
||||||
|
|
||||||
if (Player.GPUAPI != "vulkan")
|
|
||||||
Player.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
|
|
||||||
|
|
||||||
_lastCycleFullscreen = Environment.TickCount;
|
_lastCycleFullscreen = Environment.TickCount;
|
||||||
SetFormPosAndSize(false, true, true);
|
SetFormPosAndSize(false, true, true);
|
||||||
}
|
}
|
||||||
@@ -1276,9 +1271,6 @@ public partial class MainForm : Form
|
|||||||
{
|
{
|
||||||
base.OnShown(e);
|
base.OnShown(e);
|
||||||
|
|
||||||
if (Player.GPUAPI == "vulkan")
|
|
||||||
Init();
|
|
||||||
|
|
||||||
if (WindowState == FormWindowState.Maximized)
|
if (WindowState == FormWindowState.Maximized)
|
||||||
Player.SetPropertyBool("window-maximized", true);
|
Player.SetPropertyBool("window-maximized", true);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ namespace MpvNet;
|
|||||||
public class AppClass
|
public class AppClass
|
||||||
{
|
{
|
||||||
public List<string> TempFiles { get; } = new ();
|
public List<string> TempFiles { get; } = new ();
|
||||||
public Dictionary<string, string> CommandLineArguments { get; } = new ();
|
|
||||||
|
|
||||||
public string ConfPath { get => Player.ConfigFolder + "mpvnet.conf"; }
|
public string ConfPath { get => Player.ConfigFolder + "mpvnet.conf"; }
|
||||||
public string ProcessInstance { get; set; } = "single";
|
public string ProcessInstance { get; set; } = "single";
|
||||||
@@ -31,7 +30,6 @@ public class AppClass
|
|||||||
public bool RememberVolume { get; set; } = true;
|
public bool RememberVolume { get; set; } = true;
|
||||||
public bool RememberWindowPosition { get; set; }
|
public bool RememberWindowPosition { get; set; }
|
||||||
|
|
||||||
public int StartThreshold { get; set; } = 1500;
|
|
||||||
public int RecentCount { get; set; } = 15;
|
public int RecentCount { get; set; } = 15;
|
||||||
|
|
||||||
public float AutofitAudio { get; set; } = 0.7f;
|
public float AutofitAudio { get; set; } = 0.7f;
|
||||||
@@ -155,7 +153,6 @@ public class AppClass
|
|||||||
case "remember-volume": RememberVolume = value == "yes"; return true;
|
case "remember-volume": RememberVolume = value == "yes"; return true;
|
||||||
case "remember-window-position": RememberWindowPosition = value == "yes"; return true;
|
case "remember-window-position": RememberWindowPosition = value == "yes"; return true;
|
||||||
case "start-size": StartSize = value; 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;
|
case "video-file-extensions": FileTypes.Video = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
73
src/MpvNet/CommandLine.cs
Normal file
73
src/MpvNet/CommandLine.cs
Normal 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 "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -125,8 +125,6 @@ public static class InputHelp
|
|||||||
new (_("View") + " > " + _("More"), _("Show Console"), "script-binding console/enable", "`"),
|
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 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 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 (_("View") + " > " + _("More"), _("Show Bindings"), "script-message-to mpvnet show-bindings"),
|
||||||
|
|
||||||
new (_("Window"), _("Fullscreen"), "cycle fullscreen", "Enter"),
|
new (_("Window"), _("Fullscreen"), "cycle fullscreen", "Enter"),
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class MpvClient
|
|||||||
OnEndFile(data);
|
OnEndFile(data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_FILE_LOADED:
|
case mpv_event_id.MPV_EVENT_FILE_LOADED: // triggered after MPV_EVENT_START_FILE
|
||||||
OnFileLoaded();
|
OnFileLoaded();
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_PROPERTY_CHANGE:
|
case mpv_event_id.MPV_EVENT_PROPERTY_CHANGE:
|
||||||
@@ -82,7 +82,7 @@ public class MpvClient
|
|||||||
case mpv_event_id.MPV_EVENT_COMMAND_REPLY:
|
case mpv_event_id.MPV_EVENT_COMMAND_REPLY:
|
||||||
OnCommandReply();
|
OnCommandReply();
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_START_FILE:
|
case mpv_event_id.MPV_EVENT_START_FILE: // triggered before MPV_EVENT_FILE_LOADED
|
||||||
OnStartFile();
|
OnStartFile();
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_AUDIO_RECONFIG:
|
case mpv_event_id.MPV_EVENT_AUDIO_RECONFIG:
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ public class MainPlayer : MpvClient
|
|||||||
public float AutofitLarger { get; set; } = 0.8f;
|
public float AutofitLarger { get; set; } = 0.8f;
|
||||||
|
|
||||||
public AutoResetEvent ShutdownAutoResetEvent { get; } = new AutoResetEvent(false);
|
public AutoResetEvent ShutdownAutoResetEvent { get; } = new AutoResetEvent(false);
|
||||||
public AutoResetEvent VideoSizeAutoResetEvent { get; } = new AutoResetEvent(false);
|
|
||||||
public nint MainHandle { get; set; }
|
public nint MainHandle { get; set; }
|
||||||
public List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
|
public List<MediaTrack> MediaTracks { get; set; } = new List<MediaTrack>();
|
||||||
public List<TimeSpan> BluRayTitles { get; } = new List<TimeSpan>();
|
public List<TimeSpan> BluRayTitles { get; } = new List<TimeSpan>();
|
||||||
@@ -64,7 +63,7 @@ public class MainPlayer : MpvClient
|
|||||||
public event Action<int>? PlaylistPosChanged;
|
public event Action<int>? PlaylistPosChanged;
|
||||||
public event Action<Size>? VideoSizeChanged;
|
public event Action<Size>? VideoSizeChanged;
|
||||||
|
|
||||||
public void Init(IntPtr formHandle)
|
public void Init(IntPtr formHandle, bool processCommandLineArguments = true)
|
||||||
{
|
{
|
||||||
App.ApplyShowMenuFix();
|
App.ApplyShowMenuFix();
|
||||||
|
|
||||||
@@ -110,11 +109,12 @@ public class MainPlayer : MpvClient
|
|||||||
if (!string.IsNullOrEmpty(UsedInputConfContent))
|
if (!string.IsNullOrEmpty(UsedInputConfContent))
|
||||||
SetPropertyString("input-conf", @"memory://" + UsedInputConfContent);
|
SetPropertyString("input-conf", @"memory://" + UsedInputConfContent);
|
||||||
|
|
||||||
|
if (processCommandLineArguments)
|
||||||
ProcessCommandLineArgs();
|
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);
|
string fullPath = System.IO.Path.GetFullPath(configDir);
|
||||||
App.InputConf.Path = fullPath.AddSep() + "input.conf";
|
App.InputConf.Path = fullPath.AddSep() + "input.conf";
|
||||||
string content = App.InputConf.GetContent();
|
string content = App.InputConf.GetContent();
|
||||||
@@ -151,16 +151,20 @@ public class MainPlayer : MpvClient
|
|||||||
// this means Lua scripts that use idle might not work correctly
|
// this means Lua scripts that use idle might not work correctly
|
||||||
SetPropertyString("idle", "yes");
|
SetPropertyString("idle", "yes");
|
||||||
|
|
||||||
ObservePropertyString("path", value => Path = value);
|
|
||||||
|
|
||||||
ObservePropertyBool("pause", value => {
|
ObservePropertyBool("pause", value => {
|
||||||
Paused = value;
|
Paused = value;
|
||||||
Pause?.Invoke();
|
Pause?.Invoke();
|
||||||
});
|
});
|
||||||
|
|
||||||
ObservePropertyInt("video-rotate", value => {
|
VideoRotate = GetPropertyInt("video-rotate");
|
||||||
|
|
||||||
|
ObservePropertyInt("video-rotate", value =>
|
||||||
|
{
|
||||||
|
if (VideoRotate != value)
|
||||||
|
{
|
||||||
VideoRotate = value;
|
VideoRotate = value;
|
||||||
UpdateVideoSize("dwidth", "dheight");
|
UpdateVideoSize("dwidth", "dheight");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ObservePropertyInt("playlist-pos", value => {
|
ObservePropertyInt("playlist-pos", value => {
|
||||||
@@ -172,9 +176,6 @@ public class MainPlayer : MpvClient
|
|||||||
CommandV("quit");
|
CommandV("quit");
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!GetPropertyBool("osd-scale-by-window"))
|
|
||||||
App.StartThreshold = 0;
|
|
||||||
|
|
||||||
Initialized?.Invoke();
|
Initialized?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,19 +316,18 @@ public class MainPlayer : MpvClient
|
|||||||
|
|
||||||
void UpdateVideoSize(string w, string h)
|
void UpdateVideoSize(string w, string h)
|
||||||
{
|
{
|
||||||
Size size = new Size(GetPropertyInt(w), GetPropertyInt(h));
|
if (string.IsNullOrEmpty(Path))
|
||||||
|
|
||||||
if (size.Width == 0 || size.Height == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Size size = new Size(GetPropertyInt(w), GetPropertyInt(h));
|
||||||
|
|
||||||
if (VideoRotate == 90 || VideoRotate == 270)
|
if (VideoRotate == 90 || VideoRotate == 270)
|
||||||
size = new Size(size.Height, size.Width);
|
size = new Size(size.Height, size.Width);
|
||||||
|
|
||||||
if (VideoSize != size)
|
if (size != VideoSize && size != Size.Empty)
|
||||||
{
|
{
|
||||||
VideoSize = size;
|
VideoSize = size;
|
||||||
VideoSizeChanged?.Invoke(size);
|
VideoSizeChanged?.Invoke(size);
|
||||||
VideoSizeAutoResetEvent.Set();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,24 +357,27 @@ public class MainPlayer : MpvClient
|
|||||||
base.OnLogMessage(data);
|
base.OnLogMessage(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnVideoReconfig()
|
|
||||||
{
|
|
||||||
UpdateVideoSize("dwidth", "dheight");
|
|
||||||
base.OnVideoReconfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnEndFile(mpv_event_end_file data)
|
protected override void OnEndFile(mpv_event_end_file data)
|
||||||
{
|
{
|
||||||
base.OnEndFile(data);
|
base.OnEndFile(data);
|
||||||
FileEnded = true;
|
FileEnded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnVideoReconfig()
|
||||||
|
{
|
||||||
|
UpdateVideoSize("dwidth", "dheight");
|
||||||
|
base.OnVideoReconfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
// executed before OnFileLoaded
|
||||||
protected override void OnStartFile()
|
protected override void OnStartFile()
|
||||||
{
|
{
|
||||||
|
Path = GetPropertyString("path");
|
||||||
base.OnStartFile();
|
base.OnStartFile();
|
||||||
TaskHelp.Run(LoadFolder);
|
TaskHelp.Run(LoadFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// executed after OnStartFile
|
||||||
protected override void OnFileLoaded()
|
protected override void OnFileLoaded()
|
||||||
{
|
{
|
||||||
Duration = TimeSpan.FromSeconds(GetPropertyDouble("duration"));
|
Duration = TimeSpan.FromSeconds(GetPropertyDouble("duration"));
|
||||||
@@ -382,13 +385,8 @@ public class MainPlayer : MpvClient
|
|||||||
if (App.StartSize == "video")
|
if (App.StartSize == "video")
|
||||||
WasInitialSizeSet = false;
|
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");
|
UpdateVideoSize("width", "height");
|
||||||
VideoSizeAutoResetEvent.Set();
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskHelp.Run(UpdateTracks);
|
TaskHelp.Run(UpdateTracks);
|
||||||
|
|
||||||
@@ -417,75 +415,28 @@ public class MainPlayer : MpvClient
|
|||||||
|
|
||||||
public void ProcessCommandLineArgs()
|
public void ProcessCommandLineArgs()
|
||||||
{
|
{
|
||||||
foreach (string i in Environment.GetCommandLineArgs().Skip(1))
|
foreach (var pair in CommandLine.Arguments)
|
||||||
{
|
{
|
||||||
string arg = i;
|
if (pair.Name.EndsWith("-add"))
|
||||||
|
|
||||||
if (!arg.StartsWith("--"))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (arg == "--profile=help")
|
ProcessProperty(pair.Name, pair.Value);
|
||||||
{
|
|
||||||
Console.WriteLine(GetProfiles());
|
if (!App.ProcessProperty(pair.Name, pair.Value))
|
||||||
continue;
|
SetPropertyString(pair.Name, pair.Value);
|
||||||
}
|
}
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arg.Contains('='))
|
public void ProcessCommandLineArgsPost()
|
||||||
{
|
{
|
||||||
if (arg.Contains("--no-"))
|
foreach (var pair in CommandLine.Arguments)
|
||||||
{
|
{
|
||||||
arg = arg.Replace("--no-", "--");
|
if (pair.Name.EndsWith("-add"))
|
||||||
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;
|
string name = pair.Name[..^4];
|
||||||
case "audio-file": left = "audio-files"; break;
|
string separator = name.Contains("-file") || name.Contains("-path") ? ";" : ",";
|
||||||
case "sub-file": left = "sub-files"; break;
|
SetPropertyString(name, GetPropertyString(name) + separator + pair.Value);
|
||||||
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");
|
Command("playlist-shuffle");
|
||||||
SetPropertyInt("playlist-pos", 0);
|
SetPropertyInt("playlist-pos", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files.Count == 0 || files[0].Contains("://"))
|
|
||||||
{
|
|
||||||
VideoSizeChanged?.Invoke(VideoSize);
|
|
||||||
VideoSizeAutoResetEvent.Set();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime LastLoad;
|
public DateTime LastLoad;
|
||||||
|
|||||||
7
src/MpvNet/Properties/launchSettings.json
Normal file
7
src/MpvNet/Properties/launchSettings.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"MpvNet": {
|
||||||
|
"commandName": "Project"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
namespace MpvNet.Windows;
|
|
||||||
|
namespace MpvNet;
|
||||||
|
|
||||||
public class StringPair
|
public class StringPair
|
||||||
{
|
{
|
||||||
Reference in New Issue
Block a user