Compare commits

..

55 Commits

Author SHA1 Message Date
stax76
e8bc8311e6 add header format to changelog 2022-06-05 16:45:11 +02:00
stax76
19c4a1d6c1 6.0.0.0 Beta 2022-06-05 16:42:47 +02:00
stax76
a53fa7178f libmpv update changelog 2022-06-05 13:09:43 +02:00
stax76
09aee26cd4 Fix logo not hiding sometimes using gpu-api=vulkan 2022-06-05 12:55:53 +02:00
stax76
0c6e486eb0 #435 Fix mpv options not working in case of existing same line comments 2022-06-05 06:40:42 +02:00
stax76
1561ed90f6 remove 'mpv.net' from conf editor definitions that are not specific to mpv.net 2022-06-04 10:31:52 +02:00
stax76
c2f965ced9 improved changelog 2022-06-04 10:06:48 +02:00
stax76
aed524bbc5 Merge pull request #434 from dyphire/track_menu
optimize subtitle format information
2022-06-04 08:42:53 +02:00
dyphire
8cf7e4fd71 optimize subtitle format information 2022-06-04 11:21:06 +08:00
stax76
0ebcf12502 update changelog 2022-06-04 00:32:45 +02:00
stax76
2af13e995f using media info by default 2022-06-04 00:27:17 +02:00
stax76
2e2562fefc shorter media info to better fit on screen 2022-06-04 00:17:56 +02:00
stax76
1860c42114 Merge pull request #433 from dyphire/track_menu
Minor changes to track menu
2022-06-03 23:10:22 +02:00
dyphire
8782ae8ad2 Minor changes 2022-06-04 04:21:07 +08:00
stax76
5d9cde10ce fix issue using external tracks 2022-06-03 21:08:30 +02:00
stax76
2ee2b31bc0 menu fix 2022-06-03 21:02:29 +02:00
stax76
4cd92db141 use new msg model everywhere 2022-06-03 20:23:05 +02:00
stax76
8ee389e8cb misc 2022-06-03 18:38:53 +02:00
stax76
971fe1fe7c - 2022-06-03 15:47:21 +02:00
stax76
e9df0f9f99 - 2022-06-02 20:16:13 +02:00
stax76
d465b13a03 Merge branch 'master' into no-mediainfo 2022-06-02 14:18:07 +02:00
stax76
412d4d7238 Merge pull request #432 from dyphire/track_menu
Optimize track menu.
2022-06-02 14:17:04 +02:00
stax76
1dd93bfcff - 2022-06-02 14:15:02 +02:00
stax76
4ebf241306 shorten mpv.conf preview 2022-06-02 12:37:56 +02:00
dyphire
1a714a39df Optimize track menu
Add encoding information to subtitles

Add title for external tracks, match and replace the filename to avoid too long characters
2022-06-02 11:33:18 +08:00
stax76
b2b387c017 #344 cache and demuxer-max-bytes option added to conf editor 2022-06-01 14:55:04 +02:00
stax76
bf43328e7a require at least 2 characters in conf editor search 2022-06-01 10:16:36 +02:00
stax76
4cba6bb03c fix changelog 2022-05-28 00:54:33 +02:00
stax76
72f9f156b8 fix external tracks 2022-05-27 16:21:42 +02:00
stax76
c78719c3bf Fix #426 external audio and subtitle tracks 2022-05-27 14:07:04 +02:00
stax76
7e4ea640cf Command messages are dispatched with script-message-to mpvnet 2022-05-27 12:20:37 +02:00
stax76
6ddca6d608 minor rewrite 2022-05-26 19:06:32 +02:00
stax76
0fae17b42a support idlelogo 2022-05-26 18:39:44 +02:00
stax76
7e834cea6d Fix #424 media title issues 2022-05-26 11:36:24 +02:00
stax76
6fc546c69c auto-load-folder threading stability 2022-05-22 15:49:25 +02:00
stax76
e8baa21d42 Fix auto-load-folder not working with user scripts 2022-05-22 14:35:43 +02:00
stax76
4c3c65dded #423 Fix chapter time display in menu 2022-05-22 11:48:35 +02:00
stax76
843f7d1a41 manual fix 2022-05-22 09:10:10 +02:00
stax76
673d5a8c0e manual improvement 2022-05-22 09:07:36 +02:00
stax76
6bd4540106 Fix #422 slow startup using osd-scale-by-window=no 2022-05-22 08:22:49 +02:00
stax76
5b57e6214e change profile using command palette 2022-05-22 08:07:48 +02:00
stax76
27f7935127 misc 2022-05-21 10:58:39 +02:00
stax76
cd84819a03 New show-santa-logo (green and grumpy) option 2022-05-21 08:52:44 +02:00
stax76
0efc335232 new quick bookmark feature 2022-05-21 08:31:06 +02:00
stax76
b04fb9b789 input conf use 'V' for 'Open URL or file from clipboard' 2022-05-20 18:18:56 +02:00
stax76
354d5493c4 improved error handling 2022-05-20 14:50:56 +02:00
stax76
3e499befbc Fix #421 crash choosing Matroska edition in the menu. 2022-05-20 14:29:21 +02:00
stax76
bc0fc2a29d Fix auto-play not working with user scripts 2022-05-19 23:17:23 +02:00
stax76
229ace708d minor input.conf change 2022-05-18 11:54:34 +02:00
stax76
2708937554 input.conf duplicate fix 2022-05-17 18:37:31 +02:00
stax76
66654537fe idle fix 2022-05-17 17:10:45 +02:00
stax76
5d16d7b2d1 support mpv idle property partly 2022-05-17 15:05:00 +02:00
stax76
b3ebf85772 Merge pull request #419 from hooke007/doc
bump Manual_chs v5.9.0.0
2022-05-14 14:24:11 +02:00
hooke007
733f0999e1 bump Manual_chs v5.9.0.0 2022-05-13 21:28:25 +01:00
stax76
2aec8856c7 script-opts defaults 2022-05-13 13:39:40 +02:00
17 changed files with 1210 additions and 823 deletions

View File

@@ -74,6 +74,7 @@ Features that mpv and mpv.net have in common
-------------------------------------------- --------------------------------------------
- Lua and JavaScript Scripting - Lua and JavaScript Scripting
- Hundreds available user scripts make mpv the most feature rich desktop video player
- Simple config files that are easy to read and edit - Simple config files that are easy to read and edit
- JSON IPC to control the player with a external programs - JSON IPC to control the player with a external programs
- On Screen Controler (OSC, play control buttons) with modern flat design - On Screen Controler (OSC, play control buttons) with modern flat design

View File

@@ -1,5 +1,59 @@
5.9.0.0 Beta (2022-05-08) # 6.0.0.0 Beta (2022-06-05)
- The options `cache` and `demuxer-max-bytes`have been added
to the conf editor.
- Command messages are dispatched with `script-message-to mpvnet`.
- New feature to change profile using the command palette.
- New feature to show media info on screen, the command palette shows
an osd option and the show-info command shows more detailed info
after a second key press. Media info display in the track menu
was also improved. Thanks to dyphire helping with code.
- New `media-info` option allowing to use mpv `track-list`
instead of the media info library.
- New show-santa-logo (green and grumpy) option.
- New quick bookmark feature, see manual.
- Progress command shows time and date.
- When input.conf is created on the very first start and a
script-opts folder does not exist, a script-opts folder
is created with osc and console defaults:
`console-scale=1.5`
`osc-idlescreen=no` (hides the original mpv logo)
`osc-hidetimeout=2000`
`osc-scalewindowed=1.5`
- Support mpv idle property, see manual for remarks.
- Fix external audio and subtitle files not shown in all use cases.
- Fix various mpv options not working in case of existing same line comments.
- Fix crash choosing Matroska edition in the menu.
- Fix auto-play and auto-load-folder not working with user scripts.
- Fix slow startup using `osd-scale-by-window=no`.
- Fix URL shown instead of media title on file change OSD,
in recent menu and in recent command palette.
- Fix chapter time display in menu.
- Fix incorrect startup window size using gpu-api=vulkan.
- Fix logo not hiding sometimes using gpu-api=vulkan.
- libmpv shinchiro 2022-06-05
input.conf changes:
Old:
```
F9 show-text ${track-list} 5000 #menu: View > Show Tracks
```
New:
```
F9 script-message-to mpvnet show-media-info osd #menu: View > Show Tracks
Ctrl+p script-message-to mpvnet select-profile #menu: View > Show Profile Selection
Alt+q script-message-to mpvnet quick-bookmark
```
All occurrences of `script-message mpv.net` were changed to `script-message-to mpvnet`.
# 5.9.0.0 Beta (2022-05-08)
- Fix startup without media file not working with gpu-api=vulkan. - Fix startup without media file not working with gpu-api=vulkan.
- Fix keyboard layout change not working. - Fix keyboard layout change not working.

View File

@@ -63,9 +63,11 @@ Installation
mpv.net requires the .NET Framework 4.8 and Windows 7 or higher and a modern graphics card. mpv.net requires the .NET Framework 4.8 and Windows 7 or higher and a modern graphics card.
For internet streaming from YouTube and similar sites, yt-dlp must be Internet streaming requires:
copied into the mpv.net folder or the user environment variable PATH
must be edited to include the yt-dlp folder. - Downloading [yt-dlp](https://github.com/yt-dlp/yt-dlp) and adding its folder
to the [user environment variable PATH](https://www.google.com/search?q=user+environment+variable+PATH).
- In case of proxy server usage, [manual configuration](https://github.com/stax76/mpv.net/issues/401).
#### File Associations #### File Associations
@@ -219,7 +221,7 @@ A common task for the terminal is debugging scripts.
mpv.net specific commands mpv.net specific commands
------------------------- -------------------------
`script-message mpv.net <command> <arguments>` `script-message-to mpvnet <command> <arguments>`
mpv.net commands are used when mpv commands don't exist or lack a feature. mpv.net commands are used when mpv commands don't exist or lack a feature.
@@ -236,9 +238,6 @@ Shows a file browser dialog to open external subtitle files.
Opens the config folder with Windows File Explorer. Opens the config folder with Windows File Explorer.
### open-files [\<flags\>] ### open-files [\<flags\>]
**no-folder**
For single files prevents loading the complete folder into the playlist.
**append** **append**
Appends files to the playlist. Appends files to the playlist.
@@ -271,6 +270,12 @@ already the first entry, nothing happens.
Jumps to the last playlist entry, if the loaded file is Jumps to the last playlist entry, if the loaded file is
already the last entry, nothing happens. already the last entry, nothing happens.
### quick-bookmark
On the first press a bookmark is saved, on the second
press it is restored and removed. When a new file is
loaded the bookmark is removed.
### reg-file-assoc \<audio|video|image\> ### reg-file-assoc \<audio|video|image\>
Registers the file associations. Registers the file associations.
@@ -310,7 +315,7 @@ Shows available demuxers.
Shows the history file when existing. Shows the history file when existing.
### show-info ### show-info
Shows a simple file info. Shows media info on screen, a second key press shows more detailed media info.
### show-input-editor ### show-input-editor
Shows the input editor. Shows the input editor.
@@ -325,6 +330,9 @@ Shows media info in a messsge box.
**editor** **editor**
Shows media info in the text editor. Shows media info in the text editor.
**osd**
Displays media info on screen.
**full** **full**
Shows fully detailed media info. Shows fully detailed media info.
@@ -342,7 +350,7 @@ and allows to play the selected entry.
Shows available profiles with a message box. Shows available profiles with a message box.
### show-progress ### show-progress
Shows a simple OSD progress message. Shows a simple OSD progress message with time and date.
### show-properties ### show-properties
Shows available properties in the command palette and Shows available properties in the command palette and
@@ -446,10 +454,6 @@ Can be suppressed via shift key. Default: yes
If the player is paused and another file is loaded, If the player is paused and another file is loaded,
playback automatically resumes. playback automatically resumes.
#### --keep-open-exit
If set to yes and keep-open is set to no, mpv.net exits after the last file ends.
In mpv the idle property would be used, it's not possible for mpv.net to use the idle property.
### General ### General
@@ -474,6 +478,10 @@ Force a single process and add files to playlist.
Amount of recent files to be remembered. Default: 15 Amount of recent files to be remembered. Default: 15
#### --media-info=\<yes|no\>
Usage of the media info library instead of mpv to access media information. Default: yes (mpv.net specific option)
#### --video-file-extensions=\<string\> #### --video-file-extensions=\<string\>
Video file extensions used to create file associations and used by the auto-load-folder feature. Video file extensions used to create file associations and used by the auto-load-folder feature.
@@ -519,9 +527,12 @@ Color theme used in light mode. Default: light
#### --show-logo=\<yes|no\> #### --show-logo=\<yes|no\>
Draws the blue mpv.net logo ontop of the native OSC logo. Draws the blue mpv.net logo ontop of the native OSC logo. Default: yes
Changes take effect after application restart. Default: yes
#### --show-santa-logo=\<yes|no\>
Draws the blue mpv.net logo with a santa hat in december,
the option is called green and grumpy in mpv. Default: yes
External Tools External Tools
-------------- --------------
@@ -790,7 +801,6 @@ https://mpv.io/manual/master/#window
- [autofit-smaller](https://mpv.io/manual/master/#options-autofit-smaller) - [autofit-smaller](https://mpv.io/manual/master/#options-autofit-smaller)
- [autofit](https://mpv.io/manual/master/#options-autofit) - [autofit](https://mpv.io/manual/master/#options-autofit)
mpv.net specific window features are documented in the [screen section](#screen). mpv.net specific window features are documented in the [screen section](#screen).
@@ -809,6 +819,13 @@ need an own implementation in mpv.net, so far implemented are:
--vd=help --vd=help
--version --version
### Other Limitations
The mpv property [idle](https://mpv.io/manual/master/#options-idle) can be
used and mpv.net functions accordingly, but Lua scripts always see `idle=yes`
because mpv.net has to set it to function correctly, this is a difficult
to overcome libmpv limitation.
### mpv.net specific options ### mpv.net specific options

View File

@@ -2,7 +2,7 @@
mpv.net手册 mpv.net手册
============== ==============
同步源提交_[20220402](https://github.com/stax76/mpv.net/commit/27dc98af2195622d3443cc048b3c856c5238b9f5) 适配版本 [v5.9.0.0-beta](https://github.com/stax76/mpv.net/releases/tag/v5.9.0.0-beta)
**[ENGLISH](Manual.md)** | **简体中文** **[ENGLISH](Manual.md)** | **简体中文**
@@ -41,6 +41,9 @@ mpv.net出于兼容mpv而设计几乎所有mpv的功能都可用因为它
mpv专注命令行与终端的使用而mpv.net保留了这些并加入了现代化的图形界面。 mpv专注命令行与终端的使用而mpv.net保留了这些并加入了现代化的图形界面。
与mpv一样mpv.net也是为高级用户设计的对于普通用户
有一个正在建设中的 [mpv.net-next](https://github.com/mpv-net-player/mpv.net-next) 项目。
下载 下载
-------- --------
@@ -248,6 +251,9 @@ mpv.net命令可在mpv命令不存在或缺乏某种功能时使用。
### play-pause ### play-pause
循环切换 pause 的属性。如果播放列表为空,将加载最近文件列表中的最新文件。 循环切换 pause 的属性。如果播放列表为空,将加载最近文件列表中的最新文件。
### playlist-add \<integer\>
通过指定的整数值来跳转播放的条目。如果已到达末尾则它会跳到开头,反之亦然。
### playlist-first ### playlist-first
跳转到播放列表的第一个条目,如果加载的文件已经是第一个条目,则无动作。 跳转到播放列表的第一个条目,如果加载的文件已经是第一个条目,则无动作。
@@ -424,6 +430,12 @@ mpv.net的专属选项
如果在播放器暂停时,加载另一个文件,会自动恢复播放。 如果在播放器暂停时,加载另一个文件,会自动恢复播放。
#### --keep-open-exit
如果设置为yes并且keep-open设置为nompv.net将在播完最后一个文件后退出。
在mpv中可以使用idle属性但对mpv.net来说不可能实现它。
### General ### General
#### --process-instance=\<value\> #### --process-instance=\<value\>

View File

@@ -24,17 +24,20 @@ namespace mpvnet
public static bool AutoLoadFolder { get; set; } = true; public static bool AutoLoadFolder { get; set; } = true;
public static bool AutoPlay { get; set; } public static bool AutoPlay { get; set; }
public static bool DebugMode { get; set; } public static bool DebugMode { get; set; }
public static bool Exit { get; set; }
public static bool IsTerminalAttached { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes"; public static bool IsTerminalAttached { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes";
public static bool KeepOpenExit { get; set; } public static bool MediaInfo { get; set; } = true;
public static bool Queue { get; set; } public static bool Queue { get; set; }
public static bool RememberVolume { get; set; } = true; public static bool RememberVolume { get; set; } = true;
public static bool RememberWindowPosition { get; set; } public static bool RememberWindowPosition { get; set; }
public static bool ShowLogo { get; set; } = true; public static bool ShowLogo { get; set; } = true;
public static bool ShowSantaLogo { get; set; } = true;
public static int StartThreshold { get; set; } = 1500; public static int StartThreshold { get; set; } = 1500;
public static int RecentCount { get; set; } = 15; public static int RecentCount { get; set; } = 15;
public static float MinimumAspectRatio { get; set; } = 1.2f; public static float MinimumAspectRatio { get; set; } = 1.2f;
public static float QuickBookmark { get; set; }
public static Extension Extension { get; set; } public static Extension Extension { get; set; }
@@ -242,8 +245,8 @@ namespace mpvnet
case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true; case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true;
case "debug-mode": DebugMode = value == "yes"; return true; case "debug-mode": DebugMode = value == "yes"; return true;
case "image-file-extensions": CorePlayer.ImageTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; case "image-file-extensions": CorePlayer.ImageTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;
case "keep-open-exit": KeepOpenExit = value == "yes"; return true;
case "light-theme": LightTheme = value.Trim('\'', '"'); return true; case "light-theme": LightTheme = value.Trim('\'', '"'); return true;
case "media-info": MediaInfo = value == "yes"; return true;
case "minimum-aspect-ratio": MinimumAspectRatio = value.ToFloat(); return true; case "minimum-aspect-ratio": MinimumAspectRatio = value.ToFloat(); return true;
case "process-instance": ProcessInstance = value; return true; case "process-instance": ProcessInstance = value; return true;
case "queue": Queue = value == "yes"; return true; case "queue": Queue = value == "yes"; return true;
@@ -251,6 +254,7 @@ namespace mpvnet
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 "show-logo": ShowLogo = value == "yes"; return true; case "show-logo": ShowLogo = value == "yes"; return true;
case "show-santa-logo": ShowSantaLogo = value == "yes"; return true;
case "start-size": StartSize = value; return true; case "start-size": StartSize = value; return true;
case "start-threshold": StartThreshold = value.ToInt(); return true; case "start-threshold": StartThreshold = value.ToInt(); return true;
case "video-file-extensions": CorePlayer.VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; case "video-file-extensions": CorePlayer.VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;
@@ -269,5 +273,16 @@ namespace mpvnet
if (File.Exists(dir + "mpvnet.exe") && !File.Exists(dir + "mpvnet.com")) if (File.Exists(dir + "mpvnet.exe") && !File.Exists(dir + "mpvnet.com"))
File.Copy(Folder.Startup + "mpvnet.com", dir + "mpvnet.com"); File.Copy(Folder.Startup + "mpvnet.com", dir + "mpvnet.com");
} }
public static (string Title, string Path) GetTitleAndPath(string input)
{
if (input.Contains("|"))
{
var a = input.Split('|');
return (a[1], a[0]);
}
return (input, input);
}
} }
} }

View File

@@ -25,7 +25,7 @@ namespace mpvnet
static void Execute(string file) static void Execute(string file)
{ {
string code = File.ReadAllText(file); string code = File.ReadAllText(file);
string filename = Path.GetFileNameWithoutExtension(file) + " " + StringHelp.GetMD5Hash(code) + ".dll"; string filename = Path.GetFileNameWithoutExtension(file) + " " + StringHelp.GetMD5Hash(code) + "-v6.dll";
string outputFile = Path.Combine(Path.GetTempPath(), filename); string outputFile = Path.Combine(Path.GetTempPath(), filename);
if (!File.Exists(outputFile)) if (!File.Exists(outputFile))

View File

@@ -6,15 +6,15 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Windows; using System.Windows;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Interop; using System.Windows.Interop;
using System.Windows.Media;
using WinForms = System.Windows.Forms; using WinForms = System.Windows.Forms;
using static mpvnet.Global; using static mpvnet.Global;
using System.Windows.Media;
using System.Text.RegularExpressions;
namespace mpvnet namespace mpvnet
{ {
@@ -38,8 +38,10 @@ namespace mpvnet
case "playlist-add": PlaylistAdd(Convert.ToInt32(args[0])); break; case "playlist-add": PlaylistAdd(Convert.ToInt32(args[0])); break;
case "playlist-first": PlaylistFirst(); break; case "playlist-first": PlaylistFirst(); break;
case "playlist-last": PlaylistLast(); break; case "playlist-last": PlaylistLast(); break;
case "quick-bookmark": QuickBookmark(); break;
case "reg-file-assoc": RegisterFileAssociations(args[0]); break; case "reg-file-assoc": RegisterFileAssociations(args[0]); break;
case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break; case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
case "select-profile": SelectProfile(); break;
case "shell-execute": ProcessHelp.ShellExecute(args[0]); break; case "shell-execute": ProcessHelp.ShellExecute(args[0]); break;
case "show-about": ShowDialog(typeof(AboutWindow)); break; case "show-about": ShowDialog(typeof(AboutWindow)); break;
case "show-audio-devices": Msg.ShowInfo(Core.GetPropertyOsdString("audio-device-list")); break; case "show-audio-devices": Msg.ShowInfo(Core.GetPropertyOsdString("audio-device-list")); break;
@@ -65,8 +67,6 @@ namespace mpvnet
case "show-subtitle-tracks": ShowSubtitleTracks(); break; case "show-subtitle-tracks": ShowSubtitleTracks(); break;
case "show-text": ShowText(args[0], Convert.ToInt32(args[1]), Convert.ToInt32(args[2])); break; case "show-text": ShowText(args[0], Convert.ToInt32(args[1]), Convert.ToInt32(args[2])); break;
case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break; case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break;
default: Terminal.WriteError($"No command '{id}' found, reset input.conf by deleting it."); break;
} }
} }
@@ -88,21 +88,15 @@ namespace mpvnet
public static void OpenFiles(params string[] args) public static void OpenFiles(params string[] args)
{ {
bool append = Control.ModifierKeys.HasFlag(Keys.Control); bool append = Control.ModifierKeys.HasFlag(Keys.Control);
bool loadFolder = true;
foreach (string arg in args) foreach (string arg in args)
{
if (arg == "append") if (arg == "append")
append = true; append = true;
if (arg == "no-folder")
loadFolder = false;
}
App.InvokeOnMainThread(new Action(() => { App.InvokeOnMainThread(new Action(() => {
using (var d = new OpenFileDialog() { Multiselect = true }) using (var d = new OpenFileDialog() { Multiselect = true })
if (d.ShowDialog() == DialogResult.OK) if (d.ShowDialog() == DialogResult.OK)
Core.LoadFiles(d.FileNames, loadFolder, append); Core.LoadFiles(d.FileNames, true, append);
})); }));
} }
@@ -116,18 +110,15 @@ namespace mpvnet
public static void PlaylistFirst() public static void PlaylistFirst()
{ {
int pos = Core.GetPropertyInt("playlist-pos"); if (Core.PlaylistPos != 0)
if (pos != 0)
Core.SetPropertyInt("playlist-pos", 0); Core.SetPropertyInt("playlist-pos", 0);
} }
public static void PlaylistLast() public static void PlaylistLast()
{ {
int pos = Core.GetPropertyInt("playlist-pos");
int count = Core.GetPropertyInt("playlist-count"); int count = Core.GetPropertyInt("playlist-count");
if (pos < count - 1) if (Core.PlaylistPos < count - 1)
Core.SetPropertyInt("playlist-pos", count - 1); Core.SetPropertyInt("playlist-pos", count - 1);
} }
@@ -163,10 +154,22 @@ namespace mpvnet
} }
} }
static int LastShowInfo;
public static void ShowInfo() public static void ShowInfo()
{ {
try if (Core.PlaylistPos == -1)
return;
if (Environment.TickCount - LastShowInfo < 5000)
{ {
Core.Command("script-message-to mpvnet show-media-info osd");
LastShowInfo = 0;
return;
}
LastShowInfo = Environment.TickCount;
string performer, title, album, genre, date, duration, text = ""; string performer, title, album, genre, date, duration, text = "";
long fileSize = 0; long fileSize = 0;
string path = Core.GetPropertyString("path"); string path = Core.GetPropertyString("path");
@@ -179,6 +182,8 @@ namespace mpvnet
fileSize = new FileInfo(path).Length; fileSize = new FileInfo(path).Length;
if (CorePlayer.AudioTypes.Contains(path.Ext())) if (CorePlayer.AudioTypes.Contains(path.Ext()))
{
if (App.MediaInfo)
{ {
using (MediaInfo mediaInfo = new MediaInfo(path)) using (MediaInfo mediaInfo = new MediaInfo(path))
{ {
@@ -198,26 +203,47 @@ namespace mpvnet
text += "Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n"; text += "Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n";
text += "Type: " + path.Ext().ToUpper(); text += "Type: " + path.Ext().ToUpper();
}
}
else
{
text = "File: " + path.FileName() + "\n";
duration = TimeSpan.FromSeconds((int)Core.GetPropertyDouble("duration")).ToString();
if (duration != "") text += "Length: " + duration + "\n";
if (fileSize > 0) text += "Size: " + Convert.ToInt32(fileSize / 1024.0 / 1024.0) + " MB\n";
text += "Type: " + path.Ext().ToUpper();
}
Core.CommandV("show-text", text, "5000"); Core.CommandV("show-text", text, "5000");
return; return;
}
} }
else if (CorePlayer.ImageTypes.Contains(path.Ext())) else if (CorePlayer.ImageTypes.Contains(path.Ext()))
{
if (App.MediaInfo)
{ {
using (MediaInfo mediaInfo = new MediaInfo(path)) using (MediaInfo mediaInfo = new MediaInfo(path))
{ {
text = text = "Width: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Width") + "\n" +
"Width: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Width") + "\n" +
"Height: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Height") + "\n" + "Height: " + mediaInfo.GetInfo(MediaInfoStreamKind.Image, "Height") + "\n" +
"Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n" + "Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n" +
"Type: " + path.Ext().ToUpper(); "Type: " + path.Ext().ToUpper();
}
}
else
{
text = "Width: " + Core.GetPropertyInt("width") + "\n" +
"Height: " + Core.GetPropertyInt("height") + "\n" +
"Size: " + Convert.ToInt32(fileSize / 1024.0) + " KB\n" +
"Type: " + path.Ext().ToUpper();
}
Core.CommandV("show-text", text, "5000"); Core.CommandV("show-text", text, "5000");
return; return;
} }
} }
}
string videoFormat = Core.GetPropertyString("video-format").ToUpper(); string videoFormat = Core.GetPropertyString("video-format").ToUpper();
string audioCodec = Core.GetPropertyString("audio-codec-name").ToUpper(); string audioCodec = Core.GetPropertyString("audio-codec-name").ToUpper();
@@ -232,11 +258,6 @@ namespace mpvnet
Core.CommandV("show-text", text, "5000"); Core.CommandV("show-text", text, "5000");
} }
catch (Exception e)
{
App.ShowException(e);
}
}
static string FormatTime(double value) => ((int)value).ToString("00"); static string FormatTime(double value) => ((int)value).ToString("00");
@@ -248,7 +269,8 @@ namespace mpvnet
string text = FormatTime(position.TotalMinutes) + ":" + string text = FormatTime(position.TotalMinutes) + ":" +
FormatTime(position.Seconds) + " / " + FormatTime(position.Seconds) + " / " +
FormatTime(duration.TotalMinutes) + ":" + FormatTime(duration.TotalMinutes) + ":" +
FormatTime(duration.Seconds); FormatTime(duration.Seconds) + " " +
DateTime.Now.ToString("H:mm dddd d MMMM", CultureInfo.InvariantCulture);
Core.CommandV("show-text", text, "5000"); Core.CommandV("show-text", text, "5000");
} }
@@ -263,15 +285,19 @@ namespace mpvnet
else else
{ {
string clipboard = WinForms.Clipboard.GetText(); string clipboard = WinForms.Clipboard.GetText();
List<string> files = new List<string>();
if (string.IsNullOrEmpty(clipboard) || (!clipboard.Contains("://") && !File.Exists(clipboard)) || foreach (string i in clipboard.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
clipboard.Contains("\n")) if (i.Contains("://") || File.Exists(i))
files.Add(i);
if (files.Count == 0)
{ {
App.ShowError("The clipboard does not contain a valid URL or file."); App.ShowError("The clipboard does not contain a valid URL or file.");
return; return;
} }
Core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control)); Core.LoadFiles(files.ToArray(), false, Control.ModifierKeys.HasFlag(Keys.Control));
} }
}); });
@@ -311,10 +337,13 @@ namespace mpvnet
public static void CycleAudio() public static void CycleAudio()
{ {
MediaTrack[] audioTracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray(); Core.UpdateExternalTracks();
int len = audioTracks.Length;
if (len < 1) lock (Core.MediaTracksLock)
{
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray();
if (tracks.Length < 1)
{ {
Core.CommandV("show-text", "No audio tracks"); Core.CommandV("show-text", "No audio tracks");
return; return;
@@ -322,15 +351,16 @@ namespace mpvnet
int aid = Core.GetPropertyInt("aid"); int aid = Core.GetPropertyInt("aid");
if (len > 1) if (tracks.Length > 1)
{ {
if (++aid > len) if (++aid > tracks.Length)
aid = 1; aid = 1;
Core.CommandV("set", "aid", aid.ToString()); Core.CommandV("set", "aid", aid.ToString());
} }
Core.CommandV("show-text", aid + "/" + len + ": " + audioTracks[aid - 1].Text.Substring(3), "5000"); Core.CommandV("show-text", aid + "/" + tracks.Length + ": " + tracks[aid - 1].Text.Substring(3), "5000");
}
} }
public static void ShowCommands() public static void ShowCommands()
@@ -360,7 +390,7 @@ namespace mpvnet
public static void ScaleWindow(float factor) => Core.RaiseScaleWindow(factor); public static void ScaleWindow(float factor) => Core.RaiseScaleWindow(factor);
public static void WindowScale(float value) => Core.RaiseWindowScale(value); public static void WindowScale(float value) => Core.RaiseWindowScaleNET(value);
public static void ShowText(string text, int duration = 0, int fontSize = 0) public static void ShowText(string text, int duration = 0, int fontSize = 0)
{ {
@@ -382,10 +412,11 @@ namespace mpvnet
if (args == null || args.Length == 0) if (args == null || args.Length == 0)
{ {
(string Name, string Value)[] pairs = { (string Name, string Value)[] pairs = {
("Show text box", "script-message mpv.net show-media-info default"), ("Show text box", "script-message-to mpvnet show-media-info default"),
("Show text editor", "script-message mpv.net show-media-info editor"), ("Show text editor", "script-message-to mpvnet show-media-info editor"),
("Show full", "script-message mpv.net show-media-info editor full"), ("Show on screen", "script-message-to mpvnet show-media-info osd"),
("Show raw", "script-message mpv.net show-media-info editor full raw") }; ("Show full", "script-message-to mpvnet show-media-info editor full"),
("Show raw", "script-message-to mpvnet show-media-info editor full raw") };
var list = pairs.Select(i => new CommandPaletteItem(i.Name, () => Core.Command(i.Value))); var list = pairs.Select(i => new CommandPaletteItem(i.Name, () => Core.Command(i.Value)));
CommandPalette.Instance.SetItems(list); CommandPalette.Instance.SetItems(list);
@@ -395,28 +426,36 @@ namespace mpvnet
} }
string path = Core.GetPropertyString("path"); string path = Core.GetPropertyString("path");
string text = "";
if (File.Exists(path) && !path.Contains(@"\\.\pipe\"))
{
using (MediaInfo mediaInfo = new MediaInfo(path))
{
bool full = args.Contains("full"); bool full = args.Contains("full");
bool raw = args.Contains("raw"); bool raw = args.Contains("raw");
bool editor = args.Contains("editor"); bool editor = args.Contains("editor");
bool osd = args.Contains("osd");
string text = mediaInfo.GetSummary(full, raw); if (App.MediaInfo && !osd && File.Exists(path) && !path.Contains(@"\\.\pipe\"))
text = Regex.Replace(text, "Unique ID.+", ""); using (MediaInfo mediaInfo = new MediaInfo(path))
text = Regex.Replace(mediaInfo.GetSummary(full, raw), "Unique ID.+", "");
else
{
Core.UpdateExternalTracks();
lock (Core.MediaTracksLock)
foreach (MediaTrack track in Core.MediaTracks)
text += track.Text + BR;
}
text = text.TrimEx();
if (editor) if (editor)
ShowTextWithEditor("media-info", text); ShowTextWithEditor("media-info", text);
else if (osd)
ShowText(text.Replace("\r", ""), 5000, 17);
else else
{ {
MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Consolas"); MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Consolas");
Msg.ShowInfo(text); Msg.ShowInfo(text);
MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Segoe UI"); MsgBoxEx.MessageBoxEx.MsgFontFamily = new FontFamily("Segoe UI");
} }
}
}
}); });
public static void ShowCommandPalette() => App.InvokeOnMainThread(() => public static void ShowCommandPalette() => App.InvokeOnMainThread(() =>
@@ -428,10 +467,13 @@ namespace mpvnet
public static void ShowAudioTracks() => App.InvokeOnMainThread(() => public static void ShowAudioTracks() => App.InvokeOnMainThread(() =>
{ {
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray(); Core.UpdateExternalTracks();
int len = tracks.Length;
if (len < 1) lock (Core.MediaTracksLock)
{
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray();
if (tracks.Length < 1)
{ {
Core.CommandV("show-text", "No audio tracks"); Core.CommandV("show-text", "No audio tracks");
return; return;
@@ -448,7 +490,7 @@ namespace mpvnet
Text = track.Text, Text = track.Text,
Action = () => { Action = () => {
Core.CommandV("set", "aid", track.ID.ToString()); Core.CommandV("set", "aid", track.ID.ToString());
Core.CommandV("show-text", track.ID + "/" + len + ": " + Core.CommandV("show-text", track.ID + "/" + tracks.Length + ": " +
tracks[track.ID - 1].Text.Substring(3), "5000"); tracks[track.ID - 1].Text.Substring(3), "5000");
} }
}; };
@@ -459,14 +501,19 @@ namespace mpvnet
CommandPalette.Instance.SetItems(items); CommandPalette.Instance.SetItems(items);
MainForm.Instance.ShowCommandPalette(); MainForm.Instance.ShowCommandPalette();
CommandPalette.Instance.SelectFirst(); CommandPalette.Instance.SelectFirst();
}
}); });
public static void ShowSubtitleTracks() => App.InvokeOnMainThread(() => public static void ShowSubtitleTracks() => App.InvokeOnMainThread(() =>
{ {
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "s").ToArray(); Core.UpdateExternalTracks();
int len = tracks.Length;
if (len < 1) lock (Core.MediaTracksLock)
{
MediaTrack[] tracks = Core.MediaTracks.Where(track => track.Type == "s").ToArray();
if (tracks.Length < 1)
{ {
Core.CommandV("show-text", "No subtitle tracks"); Core.CommandV("show-text", "No subtitle tracks");
return; return;
@@ -483,7 +530,7 @@ namespace mpvnet
Text = track.Text, Text = track.Text,
Action = () => { Action = () => {
Core.CommandV("set", "sid", track.ID.ToString()); Core.CommandV("set", "sid", track.ID.ToString());
Core.CommandV("show-text", track.ID + "/" + len + ": " + Core.CommandV("show-text", track.ID + "/" + tracks.Length + ": " +
tracks[track.ID - 1].Text.Substring(3), "5000"); tracks[track.ID - 1].Text.Substring(3), "5000");
} }
}; };
@@ -494,6 +541,7 @@ namespace mpvnet
CommandPalette.Instance.SetItems(items); CommandPalette.Instance.SetItems(items);
MainForm.Instance.ShowCommandPalette(); MainForm.Instance.ShowCommandPalette();
CommandPalette.Instance.SelectFirst(); CommandPalette.Instance.SelectFirst();
}
}); });
public static void ShowPlaylist() => App.InvokeOnMainThread(() => public static void ShowPlaylist() => App.InvokeOnMainThread(() =>
@@ -515,12 +563,7 @@ namespace mpvnet
CommandPaletteItem item = new CommandPaletteItem() CommandPaletteItem item = new CommandPaletteItem()
{ {
Text = file.FileName(), Text = file.FileName(),
Action = () => { Action = () => Core.SetPropertyInt("playlist-pos", index)
Core.SetPropertyInt("playlist-pos", index);
if (App.AutoPlay && Core.Paused)
Core.SetPropertyBool("pause", false);
}
}; };
items.Add(item); items.Add(item);
@@ -575,14 +618,14 @@ namespace mpvnet
{ {
List<CommandPaletteItem> items = new List<CommandPaletteItem>(); List<CommandPaletteItem> items = new List<CommandPaletteItem>();
foreach (string i in App.Settings.RecentFiles) foreach (string path in App.Settings.RecentFiles)
{ {
string file = i; var file = App.GetTitleAndPath(path);
CommandPaletteItem item = new CommandPaletteItem() CommandPaletteItem item = new CommandPaletteItem()
{ {
Text = file.ShortPath(60), Text = file.Title.ShortPath(60),
Action = () => Core.LoadFiles(new[] { file }, true, Control.ModifierKeys.HasFlag(Keys.Control)) Action = () => Core.LoadFiles(new[] { file.Path }, true, Control.ModifierKeys.HasFlag(Keys.Control))
}; };
items.Add(item); items.Add(item);
@@ -651,10 +694,10 @@ namespace mpvnet
public static void ShowSetupDialog() => App.InvokeOnMainThread(() => public static void ShowSetupDialog() => App.InvokeOnMainThread(() =>
{ {
(string Name, string Value)[] pairs = { (string Name, string Value)[] pairs = {
("Register video file associations", "script-message mpv.net reg-file-assoc video"), ("Register video file associations", "script-message-to mpvnet reg-file-assoc video"),
("Register audio file associations", "script-message mpv.net reg-file-assoc audio"), ("Register audio file associations", "script-message-to mpvnet reg-file-assoc audio"),
("Register image file associations", "script-message mpv.net reg-file-assoc image"), ("Register image file associations", "script-message-to mpvnet reg-file-assoc image"),
("Unregister file associations", "script-message mpv.net reg-file-assoc unreg") }; ("Unregister file associations", "script-message-to mpvnet reg-file-assoc unreg") };
var list = pairs.Select(i => new CommandPaletteItem(i.Name, () => Core.Command(i.Value))); var list = pairs.Select(i => new CommandPaletteItem(i.Name, () => Core.Command(i.Value)));
CommandPalette.Instance.SetItems(list); CommandPalette.Instance.SetItems(list);
@@ -662,11 +705,24 @@ namespace mpvnet
CommandPalette.Instance.SelectFirst(); CommandPalette.Instance.SelectFirst();
}); });
public static void SelectProfile() => App.InvokeOnMainThread(() =>
{
var items = Core.ProfileNames.Where(i => !i.StartsWith("extension."))
.Select(i => new CommandPaletteItem(i, () => {
Core.CommandV("show-text", i);
Core.CommandV("apply-profile", i);
}));
CommandPalette.Instance.SetItems(items);
MainForm.Instance.ShowCommandPalette();
CommandPalette.Instance.SelectFirst();
});
public static void ShowMenu() => Core.RaiseShowMenu(); public static void ShowMenu() => Core.RaiseShowMenu();
public static void PlaylistAdd(int value) public static void PlaylistAdd(int value)
{ {
int pos = Core.GetPropertyInt("playlist-pos"); int pos = Core.PlaylistPos;
int count = Core.GetPropertyInt("playlist-count"); int count = Core.GetPropertyInt("playlist-count");
if (count < 2) if (count < 2)
@@ -682,5 +738,21 @@ namespace mpvnet
Core.SetPropertyInt("playlist-pos", pos); Core.SetPropertyInt("playlist-pos", pos);
} }
public static void QuickBookmark()
{
if (App.QuickBookmark == 0)
{
App.QuickBookmark = (float)Core.GetPropertyDouble("time-pos");
if (App.QuickBookmark != 0)
Core.Command("show-text 'Bookmark Saved'");
}
else
{
Core.SetPropertyDouble("time-pos", App.QuickBookmark);
App.QuickBookmark = 0;
}
}
} }
} }

View File

@@ -3,7 +3,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
@@ -35,7 +34,6 @@ namespace mpvnet
int TaskbarButtonCreatedMessage; int TaskbarButtonCreatedMessage;
bool WasMaximized; bool WasMaximized;
bool WasShown;
public MainForm() public MainForm()
{ {
@@ -45,14 +43,16 @@ namespace mpvnet
{ {
Instance = this; Instance = this;
Core.Shutdown += Core_Shutdown;
Core.ShowMenu += Core_ShowMenu;
Core.VideoSizeChanged += Core_VideoSizeChanged;
Core.ScaleWindow += Core_ScaleWindow;
Core.WindowScale += Core_WindowScale;
Core.FileLoaded += Core_FileLoaded; Core.FileLoaded += Core_FileLoaded;
Core.Seek += () => UpdateProgressBar(); Core.Pause += Core_Pause;
Core.PlaylistPosChanged += (value) => SetTitle(); Core.PlaylistPosChanged += (value) => SetTitle();
Core.ScaleWindow += Core_ScaleWindow;
Core.Seek += () => UpdateProgressBar();
Core.ShowMenu += Core_ShowMenu;
Core.Shutdown += Core_Shutdown;
Core.VideoSizeChanged += Core_VideoSizeChanged;
Core.WindowScaleMpv += Core_WindowScaleMpv;
Core.WindowScaleNET += Core_WindowScaleNET;
if (Core.GPUAPI != "vulkan") if (Core.GPUAPI != "vulkan")
Init(); Init();
@@ -119,6 +119,7 @@ namespace mpvnet
{ {
Core.Init(Handle); Core.Init(Handle);
// bool methods not working correctly
Core.ObserveProperty("window-maximized", PropChangeWindowMaximized); Core.ObserveProperty("window-maximized", PropChangeWindowMaximized);
Core.ObserveProperty("window-minimized", PropChangeWindowMinimized); Core.ObserveProperty("window-minimized", PropChangeWindowMinimized);
@@ -126,7 +127,6 @@ namespace mpvnet
Core.ObservePropertyBool("fullscreen", PropChangeFullscreen); Core.ObservePropertyBool("fullscreen", PropChangeFullscreen);
Core.ObservePropertyBool("keepaspect-window", value => Core.KeepaspectWindow = value); Core.ObservePropertyBool("keepaspect-window", value => Core.KeepaspectWindow = value);
Core.ObservePropertyBool("ontop", PropChangeOnTop); Core.ObservePropertyBool("ontop", PropChangeOnTop);
Core.ObservePropertyBool("pause", PropChangePause);
Core.ObservePropertyString("sid", PropChangeSid); Core.ObservePropertyString("sid", PropChangeSid);
Core.ObservePropertyString("aid", PropChangeAid); Core.ObservePropertyString("aid", PropChangeAid);
@@ -136,8 +136,6 @@ namespace mpvnet
Core.ObservePropertyInt("edition", PropChangeEdition); Core.ObservePropertyInt("edition", PropChangeEdition);
Core.ObservePropertyDouble("window-scale", WindowScale);
Core.ProcessCommandLine(false); Core.ProcessCommandLine(false);
} }
@@ -172,7 +170,7 @@ namespace mpvnet
})); }));
} }
void Core_WindowScale(float scale) void Core_WindowScaleNET(float scale)
{ {
BeginInvoke(new Action(() => { BeginInvoke(new Action(() => {
SetSize( SetSize(
@@ -183,9 +181,9 @@ namespace mpvnet
})); }));
} }
void WindowScale(double scale) void Core_WindowScaleMpv(double scale)
{ {
if (!WasShown) if (!Core.Shown)
return; return;
BeginInvoke(new Action(() => { BeginInvoke(new Action(() => {
@@ -227,7 +225,9 @@ namespace mpvnet
void UpdateMenu() void UpdateMenu()
{ {
lock (Core.MediaTracks) Core.UpdateExternalTracks();
lock (Core.MediaTracksLock)
{ {
var trackMenuItem = FindMenuItem("Track"); var trackMenuItem = FindMenuItem("Track");
@@ -235,42 +235,42 @@ namespace mpvnet
{ {
trackMenuItem.Items.Clear(); trackMenuItem.Items.Clear();
MediaTrack[] audTracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray(); var audTracks = Core.MediaTracks.Where(track => track.Type == "a");
MediaTrack[] subTracks = Core.MediaTracks.Where(track => track.Type == "s").ToArray(); var subTracks = Core.MediaTracks.Where(track => track.Type == "s");
MediaTrack[] vidTracks = Core.MediaTracks.Where(track => track.Type == "v").ToArray(); var vidTracks = Core.MediaTracks.Where(track => track.Type == "v");
MediaTrack[] ediTracks = Core.MediaTracks.Where(track => track.Type == "e").ToArray(); var ediTracks = Core.MediaTracks.Where(track => track.Type == "e");
foreach (MediaTrack track in vidTracks) foreach (MediaTrack track in vidTracks)
{ {
var mi = new WpfControls.MenuItem() { Header = track.Text }; var mi = new WpfControls.MenuItem() { Header = track.Text.Replace("_", "__") };
mi.Click += (sender, args) => Core.CommandV("set", "vid", track.ID.ToString()); mi.Click += (sender, args) => Core.CommandV("set", "vid", track.ID.ToString());
mi.IsChecked = Core.VID == track.ID.ToString(); mi.IsChecked = Core.VID == track.ID.ToString();
trackMenuItem.Items.Add(mi); trackMenuItem.Items.Add(mi);
} }
if (vidTracks.Length > 0) if (vidTracks.Count() > 0)
trackMenuItem.Items.Add(new WpfControls.Separator()); trackMenuItem.Items.Add(new WpfControls.Separator());
foreach (MediaTrack track in audTracks) foreach (MediaTrack track in audTracks)
{ {
var mi = new WpfControls.MenuItem() { Header = track.Text }; var mi = new WpfControls.MenuItem() { Header = track.Text.Replace("_", "__") };
mi.Click += (sender, args) => Core.CommandV("set", "aid", track.ID.ToString()); mi.Click += (sender, args) => Core.CommandV("set", "aid", track.ID.ToString());
mi.IsChecked = Core.AID == track.ID.ToString(); mi.IsChecked = Core.AID == track.ID.ToString();
trackMenuItem.Items.Add(mi); trackMenuItem.Items.Add(mi);
} }
if (subTracks.Length > 0) if (subTracks.Count() > 0)
trackMenuItem.Items.Add(new WpfControls.Separator()); trackMenuItem.Items.Add(new WpfControls.Separator());
foreach (MediaTrack track in subTracks) foreach (MediaTrack track in subTracks)
{ {
var mi = new WpfControls.MenuItem() { Header = track.Text }; var mi = new WpfControls.MenuItem() { Header = track.Text.Replace("_", "__") };
mi.Click += (sender, args) => Core.CommandV("set", "sid", track.ID.ToString()); mi.Click += (sender, args) => Core.CommandV("set", "sid", track.ID.ToString());
mi.IsChecked = Core.SID == track.ID.ToString(); mi.IsChecked = Core.SID == track.ID.ToString();
trackMenuItem.Items.Add(mi); trackMenuItem.Items.Add(mi);
} }
if (subTracks.Length > 0) if (subTracks.Count() > 0)
{ {
var mi = new WpfControls.MenuItem() { Header = "S: No subtitles" }; var mi = new WpfControls.MenuItem() { Header = "S: No subtitles" };
mi.Click += (sender, args) => Core.CommandV("set", "sid", "no"); mi.Click += (sender, args) => Core.CommandV("set", "sid", "no");
@@ -278,12 +278,12 @@ namespace mpvnet
trackMenuItem.Items.Add(mi); trackMenuItem.Items.Add(mi);
} }
if (ediTracks.Length > 0) if (ediTracks.Count() > 0)
trackMenuItem.Items.Add(new WpfControls.Separator()); trackMenuItem.Items.Add(new WpfControls.Separator());
foreach (MediaTrack track in ediTracks) foreach (MediaTrack track in ediTracks)
{ {
var mi = new WpfControls.MenuItem() { Header = track.Text }; var mi = new WpfControls.MenuItem() { Header = track.Text.Replace("_", "__") };
mi.Click += (sender, args) => Core.CommandV("set", "edition", track.ID.ToString()); mi.Click += (sender, args) => Core.CommandV("set", "edition", track.ID.ToString());
mi.IsChecked = Core.Edition == track.ID; mi.IsChecked = Core.Edition == track.ID;
trackMenuItem.Items.Add(mi); trackMenuItem.Items.Add(mi);
@@ -301,8 +301,13 @@ namespace mpvnet
foreach (var pair in Core.Chapters) foreach (var pair in Core.Chapters)
{ {
string caption = TimeSpan.FromSeconds(pair.Value).ToString();
if (caption.ContainsEx("."))
caption = caption.Substring(0, caption.LastIndexOf("."));
var chapterMenuItem = new WpfControls.MenuItem() { Header = pair.Key }; var chapterMenuItem = new WpfControls.MenuItem() { Header = pair.Key };
chapterMenuItem.InputGestureText = TimeSpan.FromSeconds(pair.Value).ToString().Substring(0, 8); chapterMenuItem.InputGestureText = caption;
chapterMenuItem.Click += (sender, args) => Core.CommandV("seek", pair.Value.ToString(CultureInfo.InvariantCulture), "absolute"); chapterMenuItem.Click += (sender, args) => Core.CommandV("seek", pair.Value.ToString(CultureInfo.InvariantCulture), "absolute");
chaptersMenuItem.Items.Add(chapterMenuItem); chaptersMenuItem.Items.Add(chapterMenuItem);
} }
@@ -317,11 +322,12 @@ namespace mpvnet
foreach (string path in App.Settings.RecentFiles) foreach (string path in App.Settings.RecentFiles)
{ {
var mi = MenuHelp.Add(recentMenuItem.Items, path.ShortPath(100)); var file = App.GetTitleAndPath(path);
var mi = MenuHelp.Add(recentMenuItem.Items, file.Title.ShortPath(100));
if (mi != null) if (mi != null)
mi.Click += (sender, args) => mi.Click += (sender, args) =>
Core.LoadFiles(new[] { path }, true, ModifierKeys.HasFlag(Keys.Control)); Core.LoadFiles(new[] { file.Path }, true, ModifierKeys.HasFlag(Keys.Control));
} }
recentMenuItem.Items.Add(new WpfControls.Separator()); recentMenuItem.Items.Add(new WpfControls.Separator());
@@ -369,7 +375,7 @@ namespace mpvnet
{ {
profilesMenuItem.Items.Clear(); profilesMenuItem.Items.Clear();
foreach (string profile in ProfileNames) foreach (string profile in Core.ProfileNames)
{ {
if (!profile.StartsWith("extension.")) if (!profile.StartsWith("extension."))
{ {
@@ -387,23 +393,6 @@ namespace mpvnet
} }
} }
private string[] _ProfileNames;
public string[] ProfileNames {
get {
if (_ProfileNames == null)
{
string[] ignore = { "builtin-pseudo-gui", "encoding", "libmpv", "pseudo-gui", "default" };
string profileList = Core.GetPropertyString("profile-list");
var json = profileList.FromJson<List<Dictionary<string, object>>>();
_ProfileNames = json.Select(i => i["name"].ToString())
.Where(i => !ignore.Contains(i)).ToArray();
}
return _ProfileNames;
}
}
public WpfControls.MenuItem FindMenuItem(string text) => FindMenuItem(text, ContextMenu.Items); public WpfControls.MenuItem FindMenuItem(string text) => FindMenuItem(text, ContextMenu.Items);
WpfControls.MenuItem FindMenuItem(string text, WpfControls.ItemCollection items) WpfControls.MenuItem FindMenuItem(string text, WpfControls.ItemCollection items)
@@ -667,10 +656,9 @@ namespace mpvnet
public void BuildMenu() public void BuildMenu()
{ {
string content = File.ReadAllText(Core.InputConfPath); var items = CommandItem.GetItems(Core.InputConfContent);
var items = CommandItem.GetItems(content);
if (!content.Contains("#menu:")) if (!Core.InputConfContent.Contains("#menu:"))
{ {
var defaultItems = CommandItem.GetItems(Properties.Resources.input_conf); var defaultItems = CommandItem.GetItems(Properties.Resources.input_conf);
@@ -715,8 +703,6 @@ namespace mpvnet
void Core_FileLoaded() void Core_FileLoaded()
{ {
string path = Core.GetPropertyString("path");
BeginInvoke(new Action(() => { BeginInvoke(new Action(() => {
Text = Core.Expand(Title); Text = Core.Expand(Title);
@@ -732,15 +718,30 @@ namespace mpvnet
UpdateProgressBar(); UpdateProgressBar();
})); }));
string path = Core.GetPropertyString("path");
if (path.Contains(":/") && !path.Contains("://"))
path = path.Replace("/", "\\");
if (path.Contains("://"))
{
string title = Core.GetPropertyString("media-title");
if (!string.IsNullOrEmpty(title) && path != title)
path = path + "|" + title;
}
if (!string.IsNullOrEmpty(path) && path != @"bd://" && path != @"dvd://")
{
if (App.Settings.RecentFiles.Contains(path)) if (App.Settings.RecentFiles.Contains(path))
App.Settings.RecentFiles.Remove(path); App.Settings.RecentFiles.Remove(path);
if (path != @"bd://" && path != @"dvd://")
App.Settings.RecentFiles.Insert(0, path); App.Settings.RecentFiles.Insert(0, path);
while (App.Settings.RecentFiles.Count > App.RecentCount) while (App.Settings.RecentFiles.Count > App.RecentCount)
App.Settings.RecentFiles.RemoveAt(App.RecentCount); App.Settings.RecentFiles.RemoveAt(App.RecentCount);
} }
}
void SetTitle() => BeginInvoke(new Action(() => Text = Core.Expand(Title))); void SetTitle() => BeginInvoke(new Action(() => Text = Core.Expand(Title)));
@@ -752,7 +753,7 @@ namespace mpvnet
void SaveWindowProperties() void SaveWindowProperties()
{ {
if (WindowState == FormWindowState.Normal && WasShown) if (WindowState == FormWindowState.Normal && Core.Shown)
{ {
SavePosition(); SavePosition();
App.Settings.WindowSize = ClientSize; App.Settings.WindowSize = ClientSize;
@@ -863,7 +864,7 @@ namespace mpvnet
break; break;
case 0x02E0: // WM_DPICHANGED case 0x02E0: // WM_DPICHANGED
{ {
if (!WasShown) if (!Core.Shown)
break; break;
RECT rect = Marshal.PtrToStructure<RECT>(m.LParam); RECT rect = Marshal.PtrToStructure<RECT>(m.LParam);
@@ -954,7 +955,7 @@ namespace mpvnet
void UpdateProgressBar() void UpdateProgressBar()
{ {
if (Core.TaskbarProgress && Taskbar != null) if (Core.TaskbarProgress && Taskbar != null)
Taskbar.SetValue(Core.GetPropertyDouble("time-pos"), Core.Duration.TotalSeconds); Taskbar.SetValue(Core.GetPropertyDouble("time-pos", false), Core.Duration.TotalSeconds);
} }
void PropChangeOnTop(bool value) => BeginInvoke(new Action(() => TopMost = value)); void PropChangeOnTop(bool value) => BeginInvoke(new Action(() => TopMost = value));
@@ -971,7 +972,7 @@ namespace mpvnet
void PropChangeWindowMaximized() void PropChangeWindowMaximized()
{ {
if (!WasShown) if (!Core.Shown)
return; return;
BeginInvoke(new Action(() => BeginInvoke(new Action(() =>
@@ -987,7 +988,7 @@ namespace mpvnet
void PropChangeWindowMinimized() void PropChangeWindowMinimized()
{ {
if (!WasShown) if (!Core.Shown)
return; return;
BeginInvoke(new Action(() => BeginInvoke(new Action(() =>
@@ -1016,13 +1017,11 @@ namespace mpvnet
})); }));
} }
void PropChangePause(bool paused) void Core_Pause()
{ {
Core.Paused = paused;
if (Taskbar != null && Core.TaskbarProgress) if (Taskbar != null && Core.TaskbarProgress)
{ {
if (paused) if (Core.Paused)
Taskbar.SetState(TaskbarStates.Paused); Taskbar.SetState(TaskbarStates.Paused);
else else
Taskbar.SetState(TaskbarStates.Normal); Taskbar.SetState(TaskbarStates.Normal);
@@ -1036,6 +1035,8 @@ namespace mpvnet
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold); Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
LastCycleFullscreen = Environment.TickCount; LastCycleFullscreen = Environment.TickCount;
SetFormPosAndSize(); SetFormPosAndSize();
if (Core.PlaylistPos == -1)
Core.ShowLogo();
} }
protected override void OnActivated(EventArgs e) protected override void OnActivated(EventArgs e)
@@ -1070,7 +1071,7 @@ namespace mpvnet
App.RunTask(() => App.Extension = new Extension()); App.RunTask(() => App.Extension = new Extension());
App.RunTask(() => App.CopyMpvnetCom()); App.RunTask(() => App.CopyMpvnetCom());
CSharpScriptHost.ExecuteScriptsInFolder(Core.ConfigFolder + "scripts-cs"); CSharpScriptHost.ExecuteScriptsInFolder(Core.ConfigFolder + "scripts-cs");
WasShown = true; Core.Shown = true;
} }
void ContextMenu_Closed(object sender, System.Windows.RoutedEventArgs e) void ContextMenu_Closed(object sender, System.Windows.RoutedEventArgs e)
@@ -1083,7 +1084,7 @@ namespace mpvnet
base.OnResize(e); base.OnResize(e);
SaveWindowProperties(); SaveWindowProperties();
if (Core.IsLogoVisible) if (Core.PlaylistPos == -1 && Core.Shown)
Core.ShowLogo(); Core.ShowLogo();
if (FormBorderStyle != FormBorderStyle.None) if (FormBorderStyle != FormBorderStyle.None)
@@ -1094,7 +1095,7 @@ namespace mpvnet
WasMaximized = false; WasMaximized = false;
} }
if (WasShown) if (Core.Shown)
{ {
if (WindowState == FormWindowState.Minimized) if (WindowState == FormWindowState.Minimized)
Core.SetPropertyBool("window-minimized", true); Core.SetPropertyBool("window-minimized", true);

View File

@@ -134,9 +134,10 @@ namespace mpvnet
public class MediaTrack public class MediaTrack
{ {
public string Text { get; set; }
public string Type { get; set; }
public int ID { get; set; } public int ID { get; set; }
public bool External { get; set; }
public string Text { get; set; } = "";
public string Type { get; set; }
} }
public class CommandItem : INotifyPropertyChanged public class CommandItem : INotifyPropertyChanged
@@ -227,7 +228,6 @@ namespace mpvnet
get { get {
if (_Items is null) if (_Items is null)
_Items = GetItems(File.ReadAllText(Core.InputConfPath)); _Items = GetItems(File.ReadAllText(Core.InputConfPath));
return _Items; return _Items;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@ namespace mpvnet
public Point WindowLocation; public Point WindowLocation;
public Point WindowPosition; public Point WindowPosition;
public Size WindowSize; public Size WindowSize;
public string ConfigEditorSearch = ""; public string ConfigEditorSearch = "Video:";
public string Mute = "no"; public string Mute = "no";
public string UpdateCheckVersion = ""; public string UpdateCheckVersion = "";
} }

View File

@@ -8,6 +8,9 @@ public class libmpv
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr mpv_create(); public static extern IntPtr mpv_create();
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr mpv_create_client(IntPtr mpvHandle, [MarshalAs(UnmanagedType.LPUTF8Str)] string command);
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern mpv_error mpv_initialize(IntPtr mpvHandle); public static extern mpv_error mpv_initialize(IntPtr mpvHandle);
@@ -26,9 +29,6 @@ public class libmpv
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr mpv_error_string(mpv_error error); public static extern IntPtr mpv_error_string(mpv_error error);
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int mpv_terminate_destroy(IntPtr mpvHandle);
[DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern mpv_error mpv_request_log_messages(IntPtr mpvHandle, [MarshalAs(UnmanagedType.LPUTF8Str)] string min_level); public static extern mpv_error mpv_request_log_messages(IntPtr mpvHandle, [MarshalAs(UnmanagedType.LPUTF8Str)] string min_level);

View File

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

View File

@@ -1,4 +1,62 @@
[setting]
name = process-instance
file = mpvnet
default = single
filter = General
help = Defines if more then one mpv.net process is allowed. (mpv.net specific option)\n\nTip: Whenever the control key is pressed when files or URLs are opened, the playlist is not cleared but the files or URLs are appended to the playlist. This not only works on process startup but in all mpv.net features that open files and URLs.
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
[setting]
name = recent-count
file = mpvnet
filter = General
help = <int> Amount of recent files to be remembered. Default: 15 (mpv.net specific option)
[setting]
name = media-info
file = mpvnet
default = yes
filter = General
help = Usage of the media info library instead of mpv to access media information. Default: no (mpv.net specific option)
option = yes
option = no
[setting]
name = video-file-extensions
file = mpvnet
filter = General
width = 500
help = Video file extensions used to create file associations and used by the auto-load-folder feature. (mpv.net specific option)
[setting]
name = audio-file-extensions
file = mpvnet
filter = General
width = 500
help = Audio file extensions used to create file associations and used by the auto-load-folder feature. (mpv.net specific option)
[setting]
name = image-file-extensions
file = mpvnet
filter = General
width = 500
help = Image file extensions used to create file associations and used by the auto-load-folder feature. (mpv.net specific option)
[setting]
name = debug-mode
file = mpvnet
default = no
filter = General
help = Enable this only when a developer asks for it. (mpv.net specific option)
option = yes
option = no
[setting] [setting]
name = vo name = vo
file = mpv file = mpv
@@ -234,7 +292,7 @@ file = mpv
filter = Audio filter = Audio
type = string type = string
url = https://mpv.io/manual/master/#options-audio-device url = https://mpv.io/manual/master/#options-audio-device
help = <name> Use the given audio device. This consists of the audio output name, e.g. alsa, followed by /, followed by the audio output specific device name. The default value for this option is auto, which tries every audio output in preference order with the default device.\nAvailable devices can be found in the mpv.net context menu under:\nView > Show Audio Devices help = <name> Use the given audio device. This consists of the audio output name, e.g. alsa, followed by /, followed by the audio output specific device name. The default value for this option is auto, which tries every audio output in preference order with the default device.\nAvailable devices can be found in the context menu under:\nView > Advanced > Show Audio Devices
[setting] [setting]
name = slang name = slang
@@ -421,80 +479,6 @@ help = Start with a maximized window.
option = yes option = yes
option = no option = no
[setting]
name = screenshot-directory
file = mpv
width = 500
type = folder
filter = Screen
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.
[setting]
name = screenshot-format
file = mpv
default = jpg
filter = Screen
help = Set the image file type used for saving screenshots.
option = jpg
option = png
[setting]
name = screenshot-tag-colorspace
file = mpv
default = no
filter = Screen
help = Tag screenshots with the appropriate colorspace. Note that not all formats are supported.
option = yes
option = no
[setting]
name = screenshot-high-bit-depth
file = mpv
default = yes
filter = Screen
help = If possible, write screenshots with a bit depth similar to the source video. This is interesting in particular for PNG, as this sometimes triggers writing 16 bit PNGs with huge file sizes. This will also include an unused alpha channel in the resulting files if 16 bit is used.
option = yes
option = no
[setting]
name = screenshot-jpeg-source-chroma
file = mpv
default = yes
filter = Screen
help = Write JPEG files with the same chroma subsampling as the video. If disabled, the libjpeg default is used.
option = yes
option = no
[setting]
name = screenshot-template
file = mpv
filter = Screen
type = string
help = Specify the filename template used to save screenshots. The template specifies the filename without file extension, and can contain format specifiers, which will be substituted when taking a screenshot. By default, the template is mpv-shot%n, which results in filenames like mpv-shot0012.png for example.\n\nFind the full documentation here:
url = https://mpv.io/manual/master/#options-screenshot-template
[setting]
name = screenshot-jpeg-quality
file = mpv
filter = Screen
help = <0-100> Set the JPEG quality level. Higher means better quality. The default is 90.
[setting]
name = screenshot-png-compression
file = mpv
filter = Screen
help = <0-9> Set the PNG compression level. Higher means better compression. This will affect the file size of the written screenshot file and the time it takes to write a screenshot. Too high compression might occupy enough CPU time to interrupt playback. The default is 7.
[setting]
name = screenshot-png-filter
file = mpv
filter = Screen
help = <0-5> Set the filter applied prior to PNG compression. 0 is none, 1 is 'sub', 2 is 'up', 3 is 'average', 4 is 'Paeth', and 5 is 'mixed'. This affects the level of compression that can be achieved. For most images, 'mixed' achieves the best compression ratio, hence it is the default.
[setting] [setting]
name = taskbar-progress name = taskbar-progress
file = mpv file = mpv
@@ -510,10 +494,9 @@ name = keep-open
file = mpv file = mpv
default = no default = no
filter = Playback filter = Playback
help = Using no, mpv would terminate after the last file but mpv.net never terminates automatically.
option = yes If the current file ends, go to the next file, keep the last file open. option = yes If the current file ends, go to the next file, keep the last file open.
option = no If the current file ends, go to the next file. If keep-open-exit is set to yes, mpv.net exits after the last file. option = no If the current file ends, go to the next file. If idle is set to no, the player exits after the last file.
option = always Playback will never automatically advance to the next file. option = always Playback will never automatically advance to the next file.
[setting] [setting]
@@ -527,21 +510,22 @@ option = yes
option = no option = no
[setting] [setting]
name = keep-open-exit name = idle
file = mpvnet file = mpv
default = no default = yes
filter = Playback filter = Playback
help = If set to yes and keep-open is set to no, mpv.net exits after the last file ends. In mpv the idle property would be used, it's not possible for mpv.net to use the idle property. help = If set to no and keep-open is also set to no, the player exits after the last file ends.
option = yes option = yes
option = no option = no
option = once
[setting] [setting]
name = auto-play name = auto-play
file = mpvnet file = mpvnet
default = no default = no
filter = Playback filter = Playback
help = Sets pause=no on file load and selecting from the playlist. (mpv.net specific option) help = Sets pause=no on file load. (mpv.net specific option)
option = yes option = yes
option = no option = no
@@ -619,54 +603,6 @@ file = mpv
filter = Input filter = Input
help = Number of key presses to generate per second on autorepeat. help = Number of key presses to generate per second on autorepeat.
[setting]
name = process-instance
file = mpvnet
default = single
filter = General
help = Defines if more then one mpv.net process is allowed. (mpv.net specific option)\n\nTip: Whenever the control key is pressed when files or URLs are opened, the playlist is not cleared but the files or URLs are appended to the playlist. This not only works on process startup but in all mpv.net features that open files and URLs.
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
[setting]
name = recent-count
file = mpvnet
filter = General
help = <int> Amount of recent files to be remembered. Default: 15 (mpv.net specific option)
[setting]
name = video-file-extensions
file = mpvnet
filter = General
width = 500
help = Video file extensions used to create file associations and used by the auto-load-folder feature. (mpv.net specific option)
[setting]
name = audio-file-extensions
file = mpvnet
filter = General
width = 500
help = Audio file extensions used to create file associations and used by the auto-load-folder feature. (mpv.net specific option)
[setting]
name = image-file-extensions
file = mpvnet
filter = General
width = 500
help = Image file extensions used to create file associations and used by the auto-load-folder feature. (mpv.net specific option)
[setting]
name = debug-mode
file = mpvnet
default = no
filter = General
help = Enable this only when a developer asks for it. (mpv.net specific option)
option = yes
option = no
[setting] [setting]
name = dark-mode name = dark-mode
file = mpvnet file = mpvnet
@@ -701,3 +637,106 @@ help = Draws the blue mpv.net logo ontop of the native OSC logo.
option = yes option = yes
option = no option = no
[setting]
name = show-santa-logo
file = mpvnet
default = yes
filter = UI
help = Draws the blue mpv.net logo with a santa hat in december, the option is called green and grumpy in mpv.
option = yes
option = no
[setting]
name = screenshot-directory
file = mpv
width = 500
type = folder
filter = 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.
[setting]
name = screenshot-format
file = mpv
default = jpg
filter = Screenshot
help = Set the image file type used for saving screenshots.
option = jpg
option = png
[setting]
name = screenshot-tag-colorspace
file = mpv
default = no
filter = Screenshot
help = Tag screenshots with the appropriate colorspace. Note that not all formats are supported.
option = yes
option = no
[setting]
name = screenshot-high-bit-depth
file = mpv
default = yes
filter = Screenshot
help = If possible, write screenshots with a bit depth similar to the source video. This is interesting in particular for PNG, as this sometimes triggers writing 16 bit PNGs with huge file sizes. This will also include an unused alpha channel in the resulting files if 16 bit is used.
option = yes
option = no
[setting]
name = screenshot-jpeg-source-chroma
file = mpv
default = yes
filter = Screenshot
help = Write JPEG files with the same chroma subsampling as the video. If disabled, the libjpeg default is used.
option = yes
option = no
[setting]
name = screenshot-template
file = mpv
filter = Screenshot
type = string
help = Specify the filename template used to save screenshots. The template specifies the filename without file extension, and can contain format specifiers, which will be substituted when taking a screenshot. By default, the template is mpv-shot%n, which results in filenames like mpv-shot0012.png for example.\n\nFind the full documentation here:
url = https://mpv.io/manual/master/#options-screenshot-template
[setting]
name = screenshot-jpeg-quality
file = mpv
filter = Screenshot
help = <0-100> Set the JPEG quality level. Higher means better quality. The default is 90.
[setting]
name = screenshot-png-compression
file = mpv
filter = Screenshot
help = <0-9> Set the PNG compression level. Higher means better compression. This will affect the file size of the written screenshot file and the time it takes to write a screenshot. Too high compression might occupy enough CPU time to interrupt playback. The default is 7.
[setting]
name = screenshot-png-filter
file = mpv
filter = Screenshot
help = <0-5> Set the filter applied prior to PNG compression. 0 is none, 1 is 'sub', 2 is 'up', 3 is 'average', 4 is 'Paeth', and 5 is 'mixed'. This affects the level of compression that can be achieved. For most images, 'mixed' achieves the best compression ratio, hence it is the default.
[setting]
name = cache
file = mpv
default = auto
filter = Cache
help = Decide whether to use network cache settings.
url = https://mpv.io/manual/master/#options-cache
option = yes
option = no
option = auto
[setting]
name = demuxer-max-bytes
file = mpv
filter = Demuxer
help = <bytesize> Controls how much the demuxer is allowed to buffer ahead.\nSuffixes such as KiB and MiB are supported.
url = https://mpv.io/manual/master/#options-demuxer-max-bytes

View File

@@ -1,28 +1,28 @@
# https://github.com/stax76/mpv.net/blob/master/docs/Manual.md#input-and-context-menu # https://github.com/stax76/mpv.net/blob/master/docs/Manual.md#input-and-context-menu
o script-message mpv.net open-files #menu: Open > Open Files... o script-message-to mpvnet open-files #menu: Open > Open Files...
Ctrl+v script-message mpv.net open-clipboard #menu: Open > Open URL or file from clipboard V script-message-to mpvnet open-clipboard #menu: Open > Open URL or file from clipboard
_ script-message mpv.net open-optical-media #menu: Open > Open DVD/Blu-ray Drive/Folder... _ script-message-to mpvnet open-optical-media #menu: Open > Open DVD/Blu-ray Drive/Folder...
_ ignore #menu: Open > - _ ignore #menu: Open > -
Alt+a script-message mpv.net load-audio #menu: Open > Load external audio files... Alt+a script-message-to mpvnet load-audio #menu: Open > Load external audio files...
Alt+s script-message mpv.net load-sub #menu: Open > Load external subtitle files... Alt+s script-message-to mpvnet load-sub #menu: Open > Load external subtitle files...
_ ignore #menu: Open > - _ ignore #menu: Open > -
_ script-message mpv.net open-files append #menu: Open > Add files to playlist... _ script-message-to mpvnet open-files append #menu: Open > Add files to playlist...
_ ignore #menu: Open > - _ ignore #menu: Open > -
_ ignore #menu: Open > Recent _ ignore #menu: Open > Recent
_ ignore #menu: - _ ignore #menu: -
Space script-message mpv.net play-pause #menu: Play/Pause Space script-message-to mpvnet play-pause #menu: Play/Pause
Ctrl+s stop #menu: Stop Ctrl+s stop #menu: Stop
_ ignore #menu: - _ ignore #menu: -
Enter cycle fullscreen #menu: Toggle Fullscreen Enter cycle fullscreen #menu: Toggle Fullscreen
F11 script-message mpv.net playlist-add -1; set pause no #menu: Navigate > Previous File F11 script-message-to mpvnet playlist-add -1 #menu: Navigate > Previous File
F12 script-message mpv.net playlist-add 1; set pause no #menu: Navigate > Next File F12 script-message-to mpvnet playlist-add 1 #menu: Navigate > Next File
_ ignore #menu: Navigate > - _ ignore #menu: Navigate > -
Home script-message mpv.net playlist-first #menu: Navigate > First File Home script-message-to mpvnet playlist-first #menu: Navigate > First File
End script-message mpv.net playlist-last #menu: Navigate > Last File End script-message-to mpvnet playlist-last #menu: Navigate > Last File
_ ignore #menu: Navigate > - _ ignore #menu: Navigate > -
PGUP add chapter 1 #menu: Navigate > Next Chapter PGUP add chapter 1 #menu: Navigate > Next Chapter
PGDWN add chapter -1 #menu: Navigate > Previous Chapter PGDWN add chapter -1 #menu: Navigate > Previous Chapter
@@ -73,7 +73,7 @@ d cycle deinterlace #menu: Video > Toggle Deinterlace
a cycle-values video-aspect 16:9 4:3 2.35:1 -1 #menu: Video > Cycle Aspect Ratio a cycle-values video-aspect 16:9 4:3 2.35:1 -1 #menu: Video > Cycle Aspect Ratio
Ctrl+r cycle-values video-rotate 90 180 270 0 #menu: Video > Rotate Video Ctrl+r cycle-values video-rotate 90 180 270 0 #menu: Video > Rotate Video
KP7 script-message mpv.net cycle-audio #menu: Audio > Cycle/Next KP7 script-message-to mpvnet cycle-audio #menu: Audio > Cycle/Next
_ ignore #menu: Audio > - _ ignore #menu: Audio > -
Ctrl+d add audio-delay 0.1 #menu: Audio > Delay +0.1 Ctrl+d add audio-delay 0.1 #menu: Audio > Delay +0.1
Ctrl+D add audio-delay -0.1 #menu: Audio > Delay -0.1 Ctrl+D add audio-delay -0.1 #menu: Audio > Delay -0.1
@@ -105,74 +105,78 @@ _ ignore #menu: Speed > -
_ ignore #menu: Speed > - _ ignore #menu: Speed > -
BS set speed 1 #menu: Speed > Reset BS set speed 1 #menu: Speed > Reset
Alt++ script-message mpv.net scale-window 1.2 #menu: View > Zoom > Enlarge Alt++ script-message-to mpvnet scale-window 1.2 #menu: View > Zoom > Enlarge
Alt+- script-message mpv.net scale-window 0.8 #menu: View > Zoom > Shrink Alt+- script-message-to mpvnet scale-window 0.8 #menu: View > Zoom > Shrink
_ ignore #menu: View > Zoom > - _ ignore #menu: View > Zoom > -
Alt+0 script-message mpv.net window-scale 0.5 #menu: View > Zoom > 50 % Alt+0 script-message-to mpvnet window-scale 0.5 #menu: View > Zoom > 50 %
Alt+1 script-message mpv.net window-scale 1.0 #menu: View > Zoom > 100 % Alt+1 script-message-to mpvnet window-scale 1.0 #menu: View > Zoom > 100 %
Alt+2 script-message mpv.net window-scale 2.0 #menu: View > Zoom > 200 % Alt+2 script-message-to mpvnet window-scale 2.0 #menu: View > Zoom > 200 %
Alt+3 script-message mpv.net window-scale 3.0 #menu: View > Zoom > 300 % Alt+3 script-message-to mpvnet window-scale 3.0 #menu: View > Zoom > 300 %
F8 script-message mpv.net show-playlist #menu: View > Show Playlist F8 script-message-to mpvnet show-playlist #menu: View > Show Playlist
Ctrl+7 script-message mpv.net show-audio-tracks #menu: View > Show Audio Tracks Ctrl+p script-message-to mpvnet select-profile #menu: View > Show Profile Selection
Ctrl+8 script-message mpv.net show-subtitle-tracks #menu: View > Show Subtitle Tracks Ctrl+P script-message-to mpvnet show-profiles #menu: View > Show Profiles
Ctrl+7 script-message-to mpvnet show-audio-tracks #menu: View > Show Audio Tracks
Ctrl+8 script-message-to mpvnet show-subtitle-tracks #menu: View > Show Subtitle Tracks
b cycle border #menu: View > Toggle Border b cycle border #menu: View > Toggle Border
Ctrl+t cycle ontop #menu: View > Toggle On Top Ctrl+t cycle ontop #menu: View > Toggle On Top
t script-binding stats/display-stats-toggle #menu: View > Toggle Statistics t script-binding stats/display-stats-toggle #menu: View > Toggle Statistics
Del script-binding osc/visibility #menu: View > Toggle OSC Visibility Del script-binding osc/visibility #menu: View > Toggle OSC Visibility
i script-message mpv.net show-info #menu: View > Show File/Stream Info i script-message-to mpvnet show-info #menu: View > Show File/Stream Info
p show-progress #menu: View > Show Progress p show-progress #menu: View > Show Progress
Ctrl+p script-message mpv.net show-profiles #menu: View > Show Profiles F9 script-message-to mpvnet show-media-info osd #menu: View > Show Tracks
F9 show-text ${track-list} 5000 #menu: View > Show Tracks Ctrl+m script-message-to mpvnet show-media-info #menu: View > Show Media Info
Ctrl+m script-message mpv.net show-media-info #menu: View > Show Media Info Alt+r script-message-to mpvnet show-recent #menu: View > Show Recent
Alt+r script-message mpv.net show-recent #menu: View > Show Recent
` script-binding console/enable #menu: View > Advanced > Show Console ` script-binding console/enable #menu: View > Advanced > Show Console
_ script-message mpv.net show-audio-devices #menu: View > Advanced > Show Audio Devices _ script-message-to mpvnet show-audio-devices #menu: View > Advanced > Show Audio Devices
P script-message mpv.net show-properties #menu: View > Advanced > Show Properties P script-message-to mpvnet show-properties #menu: View > Advanced > Show Properties
C script-message mpv.net show-commands #menu: View > Advanced > Show Commands C script-message-to mpvnet show-commands #menu: View > Advanced > Show Commands
_ script-message mpv.net show-demuxers #menu: View > Advanced > Show Demuxers _ script-message-to mpvnet show-demuxers #menu: View > Advanced > Show Demuxers
_ script-message mpv.net show-decoders #menu: View > Advanced > Show Decoders _ script-message-to mpvnet show-decoders #menu: View > Advanced > Show Decoders
_ script-message mpv.net show-protocols #menu: View > Advanced > Show Protocols _ script-message-to mpvnet show-protocols #menu: View > Advanced > Show Protocols
_ script-message mpv.net show-keys #menu: View > Advanced > Show Keys _ script-message-to mpvnet show-keys #menu: View > Advanced > Show Keys
_ ignore #menu: Profile _ ignore #menu: Profile
c script-message mpv.net show-conf-editor #menu: Settings > Show Config Editor c script-message-to mpvnet show-conf-editor #menu: Settings > Show Config Editor
Ctrl+i script-message mpv.net show-input-editor #menu: Settings > Show Input Editor Ctrl+i script-message-to mpvnet show-input-editor #menu: Settings > Show Input Editor
Ctrl+f script-message mpv.net open-conf-folder #menu: Settings > Open Config Folder Ctrl+f script-message-to mpvnet open-conf-folder #menu: Settings > Open Config Folder
_ script-message mpv.net reg-file-assoc video #menu: Settings > Setup > Register video file associations _ script-message-to mpvnet reg-file-assoc video #menu: Settings > Setup > Register video file associations
_ script-message mpv.net reg-file-assoc audio #menu: Settings > Setup > Register audio file associations _ script-message-to mpvnet reg-file-assoc audio #menu: Settings > Setup > Register audio file associations
_ script-message mpv.net reg-file-assoc image #menu: Settings > Setup > Register image file associations _ script-message-to mpvnet reg-file-assoc image #menu: Settings > Setup > Register image file associations
_ script-message mpv.net reg-file-assoc unreg #menu: Settings > Setup > Unregister file associations _ script-message-to mpvnet reg-file-assoc unreg #menu: Settings > Setup > Unregister file associations
h script-message mpv.net show-history #menu: Tools > Show History h script-message-to mpvnet show-history #menu: Tools > Show History
l ab-loop #menu: Tools > Set/clear A-B loop points l ab-loop #menu: Tools > Set/clear A-B loop points
L cycle-values loop-file inf no #menu: Tools > Toggle infinite file looping L cycle-values loop-file inf no #menu: Tools > Toggle infinite file looping
_ playlist-shuffle #menu: Tools > Shuffle Playlist _ playlist-shuffle #menu: Tools > Shuffle Playlist
Ctrl+h cycle-values hwdec auto no #menu: Tools > Toggle Hardware Decoding Ctrl+h cycle-values hwdec auto no #menu: Tools > Toggle Hardware Decoding
Q quit-watch-later #menu: Tools > Exit Watch Later Q quit-watch-later #menu: Tools > Exit Watch Later
_ script-message mpv.net shell-execute https://mpv.io #menu: Help > Website mpv _ script-message-to mpvnet shell-execute https://mpv.io #menu: Help > Website mpv
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net #menu: Help > Website mpv.net _ script-message-to mpvnet shell-execute https://github.com/stax76/mpv.net #menu: Help > Website mpv.net
_ ignore #menu: Help > - _ ignore #menu: Help > -
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > Manual mpv _ script-message-to mpvnet shell-execute https://mpv.io/manual/stable/ #menu: Help > Manual mpv
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/docs/Manual.md #menu: Help > Manual mpv.net _ script-message-to mpvnet shell-execute https://github.com/stax76/mpv.net/blob/master/docs/Manual.md #menu: Help > Manual mpv.net
_ ignore #menu: Help > - _ ignore #menu: Help > -
_ script-message mpv.net show-about #menu: Help > About mpv.net _ script-message-to mpvnet show-about #menu: Help > About mpv.net
F1 script-message mpv.net show-command-palette #menu: Command Palette F1 script-message-to mpvnet show-command-palette #menu: Command Palette
_ ignore #menu: - _ ignore #menu: -
Esc quit #menu: Exit Esc quit #menu: Exit
MBTN_Right script-message mpv.net show-menu MBTN_Right script-message-to mpvnet show-menu
6 script-message mpv.net show-progress 6 script-message-to mpvnet show-progress
KP6 script-message mpv.net show-progress KP6 script-message-to mpvnet show-progress
7 script-message mpv.net cycle-audio 9 ab-loop
Sharp script-message mpv.net cycle-audio KP9 ab-loop
Ctrl+F11 script-message mpv.net playlist-add -10 7 script-message-to mpvnet cycle-audio
Ctrl+F12 script-message mpv.net playlist-add 10 Sharp script-message-to mpvnet cycle-audio
Ctrl+F11 script-message-to mpvnet playlist-add -10
Ctrl+F12 script-message-to mpvnet playlist-add 10
Alt+q script-message-to mpvnet quick-bookmark
8 cycle sub 8 cycle sub
j cycle sub j cycle sub
q quit q quit
@@ -204,8 +208,6 @@ Shift+Up no-osd seek 5 exact
Shift+Down no-osd seek -5 exact Shift+Down no-osd seek -5 exact
Shift+BS revert-seek # undo the previous (or marked) seek Shift+BS revert-seek # undo the previous (or marked) seek
Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek
Shift+g add sub-scale +0.1 # increase the subtitle font size
Shift+f add sub-scale -0.1 # decrease the subtitle font size
Ctrl+Shift+Left no-osd sub-seek -1 # seek to the previous subtitle Ctrl+Shift+Left no-osd sub-seek -1 # seek to the previous subtitle
Ctrl+Shift+Right no-osd sub-seek 1 # seek to the next subtitle Ctrl+Shift+Right no-osd sub-seek 1 # seek to the next subtitle
Ctrl+Wheel_Up no-osd seek 7 Ctrl+Wheel_Up no-osd seek 7

View File

@@ -25,7 +25,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="105" /> <ColumnDefinition Width="110" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
@@ -76,10 +76,8 @@
</ListBox> </ListBox>
<TextBlock Name="ShowMpvNetSpecific" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{Binding Theme.Heading}" MouseUp="ShowMpvNetSpecific_MouseUp">Show mpv.net specific options</TextBlock> <TextBlock Name="ShowMpvNetSpecific" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{Binding Theme.Heading}" MouseUp="ShowMpvNetSpecific_MouseUp">Show mpv.net specific options</TextBlock>
<TextBlock Name="OpenSettingsTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{Binding Theme.Heading}" MouseUp="OpenSettingsTextBlock_MouseUp">Open config folder</TextBlock>
<TextBlock Name="PreviewTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{Binding Theme.Heading}" MouseUp="PreviewTextBlock_MouseUp">Preview mpv.conf</TextBlock> <TextBlock Name="PreviewTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{Binding Theme.Heading}" MouseUp="PreviewTextBlock_MouseUp">Preview mpv.conf</TextBlock>
<TextBlock Name="ShowManualTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{Binding Theme.Heading}" MouseUp="ShowManualTextBlock_MouseUp">Show mpv manual</TextBlock> <TextBlock Name="ShowManualTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{Binding Theme.Heading}" MouseUp="ShowManualTextBlock_MouseUp">Show mpv manual</TextBlock>
<TextBlock Name="SupportTextBlock" Margin="0,15,0,0" Cursor="Hand" TextWrapping="WrapWithOverflow" Foreground="{Binding Theme.Heading}" MouseUp="SupportTextBlock_MouseUp">Show support forum</TextBlock>
</StackPanel> </StackPanel>
</Grid> </Grid>
</Window> </Window>

View File

@@ -63,10 +63,10 @@ namespace mpvnet
switch (setting) switch (setting)
{ {
case StringSetting s: case StringSetting s:
MainStackPanel.Children.Add(new StringSettingControl(s)); MainStackPanel.Children.Add(new StringSettingControl(s) { Visibility = Visibility.Collapsed });
break; break;
case OptionSetting s: case OptionSetting s:
MainStackPanel.Children.Add(new OptionSettingControl(s)); MainStackPanel.Children.Add(new OptionSettingControl(s) { Visibility = Visibility.Collapsed });
break; break;
} }
} }
@@ -90,15 +90,7 @@ namespace mpvnet
if (item.File == "mpv") if (item.File == "mpv")
{ {
Core.ProcessProperty(item.Name, item.Value); Core.ProcessProperty(item.Name, item.Value);
Core.SetPropertyString(item.Name, item.Value);
try
{
Core.SetPropertyString(item.Name, item.Value, true);
}
catch (Exception ex)
{
App.ShowError(ex.Message);
}
} }
else if (item.File == "mpvnet") else if (item.File == "mpvnet")
App.ProcessProperty(item.Name, item.Value, true); App.ProcessProperty(item.Name, item.Value, true);
@@ -285,15 +277,16 @@ namespace mpvnet
void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e) void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e)
{ {
string activeFilter = ""; string activeFilter = "";
string searchText = SearchControl.Text;
foreach (var i in FilterStrings) foreach (string i in FilterStrings)
if (SearchControl.Text == i + ":") if (searchText == i + ":")
activeFilter = i; activeFilter = i;
if (activeFilter == "") if (activeFilter == "")
{ {
foreach (UIElement i in MainStackPanel.Children) foreach (UIElement i in MainStackPanel.Children)
if ((i as ISettingControl).Contains(SearchControl.Text)) if ((i as ISettingControl).Contains(searchText) && searchText.Length > 1)
i.Visibility = Visibility.Visible; i.Visibility = Visibility.Visible;
else else
i.Visibility = Visibility.Collapsed; i.Visibility = Visibility.Collapsed;
@@ -325,18 +318,11 @@ namespace mpvnet
SearchControl.Text = e.AddedItems[0] + ":"; SearchControl.Text = e.AddedItems[0] + ":";
} }
void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e) => void PreviewTextBlock_MouseUp(object sender, MouseButtonEventArgs e) => Msg.ShowInfo(GetContent("mpv"));
ProcessHelp.ShellExecute(Path.GetDirectoryName(Core.ConfPath));
void PreviewTextBlock_MouseUp(object sender, MouseButtonEventArgs e) =>
Msg.ShowInfo("mpv.conf Preview" + BR2 + GetContent("mpv"));
void ShowManualTextBlock_MouseUp(object sender, MouseButtonEventArgs e) => void ShowManualTextBlock_MouseUp(object sender, MouseButtonEventArgs e) =>
ProcessHelp.ShellExecute("https://mpv.io/manual/master/"); ProcessHelp.ShellExecute("https://mpv.io/manual/master/");
void SupportTextBlock_MouseUp(object sender, MouseButtonEventArgs e) =>
ProcessHelp.ShellExecute("https://github.com/stax76/mpv.net/blob/master/docs/Manual.md#support");
protected override void OnKeyDown(KeyEventArgs e) protected override void OnKeyDown(KeyEventArgs e)
{ {
base.OnKeyDown(e); base.OnKeyDown(e);