Compare commits

..

14 Commits

Author SHA1 Message Date
stax76
a0d5a6f234 libmpv update 2022-05-08 15:08:32 +02:00
stax76
d9afd172f9 5.9.0.0 Beta 2022-05-08 15:01:45 +02:00
stax76
3b9368230c fix #414 2022-05-05 12:31:13 +02:00
stax76
7d510a8ba7 update about 2022-05-04 15:25:51 +02:00
stax76
e7f08bf0a7 about update 2022-05-04 13:12:33 +02:00
stax76
ad3235bb96 update project description 2022-05-04 12:33:47 +02:00
stax76
b5b18f2a1a try to fix #413 2022-05-04 12:06:20 +02:00
stax76
28f9df1cee New mpv.net specific option keep-open-exit added 2022-05-03 15:18:42 +02:00
stax76
cd2f2aeec8 Fix config editor handling keep-open incorrectly 2022-05-03 14:25:15 +02:00
stax76
a15d2cdbbe playlist-add command added 2022-05-01 01:01:51 +02:00
stax76
f489d59168 Fix multi monitor setup with different DPI values 2022-04-28 21:53:50 +02:00
stax76
309ddbf08e Fix #398 keyboard layout change not working 2022-04-08 19:16:18 +02:00
stax76
1bc6fb9509 Merge pull request #400 from hooke007/dev
update manual_chs for v5.8.0.0
2022-04-05 19:55:19 +02:00
hooke007
88e5628d7b update manual_chs for v5.8.0.0 2022-04-03 21:29:07 +01:00
15 changed files with 384 additions and 154 deletions

View File

@@ -6,8 +6,19 @@
🎞 mpv.net
==========
mpv.net is a modern media player for Windows based on the popular [mpv](https://mpv.io) player.
mpv.net is a modern desktop media player for Windows based on the popular [mpv](https://mpv.io) player.
mpv.net is designed to be mpv compatible, almost all mpv features are available
because they are all contained in libmpv, this means the official
[mpv manual](https://mpv.io/manual/master/) applies to mpv.net.
mpv focuses on the usage of the command line and the terminal,
mpv.net retains the ability to be used from the command line and
the terminal and adds a modern Windows GUI on top of it.
Like mpv, mpv.net is designed for power users, for regular users there is a
[mpv.net-next](https://github.com/mpv-net-player/mpv.net-next)
project under construction.
#### Graphical User Interface

View File

@@ -1,9 +1,24 @@
5.9.0.0 Beta (2022-05-08)
- Fix startup without media file not working with gpu-api=vulkan.
- Fix keyboard layout change not working.
- Fix multi monitor setup with different DPI values not working.
- Fix config editor handling `keep-open` and `keep-open-pause` incorrectly.
- New mpv.net specific option `keep-open-exit` added. If set to yes and
keep-open is set to no, mpv.net exits after the last file ends.
- New `playlist-add` command added to change the playlist position,
jumps to the other end when the beginning or end is reached.
Ctrl+F11 goes 10 positions backward.
Ctrl+F12 goes 10 positions forward.
- libmpv zhongfly 2022-05-07
5.8.0.0 Beta (2022-04-02)
- Fix crash on Windows 7 systems without PowerShell.
- Fix showing incorrect timestamps in About dialog of Store version.
- Fix Store page showing non existant ARM and x86 support.
- Fix Store page showing non-existent ARM and x86 support.
- Fix opening zip files.
- The list of available input commands is like before shown
by the text editor, so it's like everything else searchable.
@@ -18,7 +33,7 @@
- Workaround not reproducible logo drawing crash.
- Info command shows the length.
- New mpv.net specific option `show-logo` that allows to disable
the drawing of the blue mpv.net logo ontop of the native OSC logo.
the drawing of the blue mpv.net logo on top of the native OSC logo.
- MediaInfo 22.03

View File

@@ -42,6 +42,10 @@ mpv focuses on the usage of the command line and the terminal,
mpv.net retains the ability to be used from the command line and
the terminal and adds a modern Windows GUI on top of it.
Like mpv, mpv.net is designed for power users, for regular users there is a
[mpv.net-next](https://github.com/mpv-net-player/mpv.net-next)
project under construction.
Download
--------
@@ -255,6 +259,10 @@ or multiple files in the file clipboard format.
Cycles the pause property. In case the playlist is empty,
the most recent file from the recent files list is loaded.
### playlist-add \<integer\>
Changes the playlist position by adding the supplied integer value.
If the position goes out of range, it jumpes to the opposite end.
### playlist-first
Jumps to the first playlist entry, if the loaded file is
already the first entry, nothing happens.
@@ -438,6 +446,10 @@ Can be suppressed via shift key. Default: yes
If the player is paused and another file is loaded,
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

View File

@@ -2,7 +2,7 @@
mpv.net手册
==============
同步源提交_[20211114](https://github.com/stax76/mpv.net/commit/243b45326ef8defa038edacd01fafee13f6a009a#diff-bf7b5e59783955f479505de4969f792255eca0a69945ccfe3ec5dda409495bbe)
同步源提交_[20220402](https://github.com/stax76/mpv.net/commit/27dc98af2195622d3443cc048b3c856c5238b9f5)
**[ENGLISH](Manual.md)** | **简体中文**
@@ -15,8 +15,10 @@ mpv.net手册
* [支持](#支持)
* [设置](#设置)
* [快捷键和上下文菜单](#快捷键和上下文菜单)
* [命令面板](#命令面板)
* [命令行界面](#命令行界面)
* [终端](#终端)
* [mpv.net的专属命令](#mpvnet的专属命令)
* [mpv.net的专属选项](#mpvnet的专属选项)
* [外部工具](#外部工具)
* [脚本](#脚本)
@@ -57,7 +59,8 @@ mpv专注命令行与终端的使用而mpv.net保留了这些并加入了现
mpv.net需要.NET Framework 4.8运行库和高于win7版本的系统以及一张不太旧的显卡。
对于网络流,必须手动下载安装yt-dlp它必须位于环境变量 PATH 或启动目录中。
对于来自YouTube和类似网站的网络流,必须将yt-dlp复制到mpv.net的文件夹中
或编辑用户环境变量PATH使其包括yt-dlp的文件夹。
#### 文件关联
@@ -66,14 +69,16 @@ mpv.net需要.NET Framework 4.8运行库和高于win7版本的系统以及一张
注册完文件关联后,进入 "Windows设置 > 应用 > 默认应用" (Win+I, ms-settings:defaultapps)
然后选择mpv. net作为视频/音频/图像的默认程序。
另一种注册文件关联的方式是使用文件资源管理器,选中媒体文件后,选择上下文菜单的 '打开方式 > 选择其它应用' 。
另一种注册文件关联的方式是使用文件资源管理器,选中媒体文件后,
选择上下文菜单的 '打开方式 > 选择其它应用' 。
[Open with++](#open-with) 可用来扩展资源管理器的上下文菜单
[Play with mpv.net](https://github.com/stax76/OpenWithPlusPlus#play-with-mpvnet) 和
[Add to mpv.net playlist](https://github.com/stax76/OpenWithPlusPlus#add-to-mpvnet-playlist).
可用来获取 'Play with mpv.net' 和 'Add to mpv.net playlist' 的菜单子项
当在资源管理器中选择多个文件并按 enter 键时文件会在mpv.net随机排序打开最多限制15个文件。
当在资源管理器中选择多个文件并按 enter 键时文件会在mpv.net随机排序打开
最多限制15个文件。
支持
@@ -104,9 +109,7 @@ mpv.net的专属选项保存在 mpvnet.conf 文件中,
----------------------
键鼠的快捷键和上下文菜单的操作保存在 input.conf 文件中,
如果设置目录中不存在,将使用以下文件生成默认的初始设置:
[input.conf defaults](../../../tree/master/src/Resources/input.conf.txt)
如果设置目录中不存在,mpv.net会用默认值生成它。
请注意,一旦 input.conf 存在, mpv.net 就不能更新它,这意味着当 mpv.net 升级了
新的版本或改变了的默认菜单项时,菜单条目就会过时。获得最新菜单的唯一方法是
@@ -136,6 +139,35 @@ mpv的input选项
https://mpv.io/manual/master/#input
命令面板
---------------
命令面板能用来快速查找、选择和执行命令。
它也可以用来方便的找到快捷键。
命令面板提供了以下功能:
- 以不同方式显示 mediainfo
- 显示和选择音轨
- 显示和选择字幕轨
- 显示和选择播放列表的文件
- 显示和选择最近的文件
- 显示可用的mpv属性
- 显示可用的解码器
- 显示可用的解复用器
- 显示可用的按键
- 显示可用的协议
| 按键 | 动作 |
| ----- | -------------- |
| F1 | 显示命令面板 |
| Esc | 隐藏命令面板 |
| Enter | 执行所选的条目 |
| Up | 光标向上移动 |
| Down | 光标向下移动 |
命令行界面
----------------------
@@ -161,12 +193,12 @@ mpv的参数与mpv.net共通例如
https://mpv.io/manual/master/#properties
mpv.net可以使用以下功能列出所有属性
mpv.net可以使用以下功能列出所有可用的属性:
'Context Menu > View > Show Properties'
_Context Menu > View > Advanced > Show Properties_
mpv.net通常不支持非属性的运行时状态切换
mpv有一些基于非属性的开关在mpv.net中一般不受支持。
终端
@@ -174,11 +206,143 @@ mpv.net通常不支持非属性的运行时状态切换
当mpv. net从终端启动时它将输出状态、错误和调试消息并接受终端的输入。
在菜单中的 'Tools > Setup' 可以将mpv.net添加到环境变量PATH。
终端的常见用处是脚本调试。
mpv.net的专属命令
-------------------------
`script-message mpv.net <command> <arguments>`
mpv.net命令可在mpv命令不存在或缺乏某种功能时使用。
### cycle-audio
切换到下一个音轨并显示该音轨的信息。
### load-audio
显示一个资源管理器的对话框来加载外部音频文件。
### load-sub
显示一个资源管理器的对话框来加载外部字幕文件。
### open-conf-folder
用Windows资源管理器打开配置文件夹。
### open-files [\<flags\>]
**no-folder**
对于单个文件,防止将文件夹内的全部文件加载到播放列表中。
**append**
追加文件到播放列表中。
打开一个资源管理器的对话框,以便选择要打开的文件。资源管理器的对话框支持多选以
一次性加载多个文件。按住CTRL键可以将这些文件追加到播放列表中。
### open-optical-media
显示一个资源管理器的对话框来打开一个DVD或BD文件夹。ISO镜像不需要被挂载
但可以直接用 open-files 命令打开。
### open-clipboard
从剪贴板打开单个的URL或文件路径或以文件剪贴板中的格式打开多个文件。
### play-pause
循环切换 pause 的属性。如果播放列表为空,将加载最近文件列表中的最新文件。
### playlist-first
跳转到播放列表的第一个条目,如果加载的文件已经是第一个条目,则无动作。
### playlist-last
跳转到播放列表的最后一个条目,如果加载的文件已经是最后一个条目,则无动作。
### reg-file-assoc \<audio|video|image\>
注册文件关联。
### scale-window \<factor\>
减小或增大窗口的尺寸。
### shell-execute \<file|URL\>
Shell执行单个文件或URL。
### show-about
显示 "关于" 的对话框。
### show-audio-devices
在一个信息框中显示可用的音频设备。
### show-audio-tracks
在命令面板中显示可用的音轨,并允许加载选中的音轨。
### show-command-palette
显示命令面板。
### show-commands
显示可用的mpv输入命令。
### show-conf-editor
显示配置编辑器。
### show-decoders
显示可用的解码器。
### show-demuxers
显示可用的解复用器。
### show-history
显示已有的历史文件。
### show-info
显示一个简易的文件信息。
### show-input-editor
显示器快捷键编辑器。
### show-keys
在命令面板中显示可用的按键。(与 `--input-keylist` 显示的内容一致)
### show-media-info [\<flags\>]
**msgbox**
在一个信息框中显示mediainfo
**editor**
在一个文本编辑器中显示mediainfo
**full**
显示mediainfo的完整细节
**raw**
显示带有原始属性名的mediainfo
### show-menu
显示上下文菜单。
### show-playlist
在命令面板中显示播放列表,并允许播放选中的条目。
### show-profiles
用一个信息框显示可用的profile
### show-progress
显示一个简易的OSD进度条信息。
### show-properties
在命令面板中显示可用的属性,并允许显示所选属性的值。
### show-protocols
在命令面板中显示可用的协议。
### show-recent
在命令面板中显示最近播放的文件和URL并允许选择和播放条目。
### show-subtitle-tracks
在命令面板中显示可用的字幕轨,并允许激活选中的字幕。
### show-text \<text\> \<duration\> \<font-size\>
显示一个具有指定文本、持续时间和字体大小的OSD信息。
### window-scale \<factor\>
职能类似于mpv的属性 [window-scale](https://mpv.io/manual/master/#command-interface-window-scale)
mpv.net的专属选项
------------------------
@@ -255,6 +419,11 @@ mpv.net的专属选项
打开单个文件时,自动将整个目录加载到播放列表中。可以通过 shift 键临时禁用。默认yes
#### --auto-play=\<yes|no\>
如果在播放器暂停时,加载另一个文件,会自动恢复播放。
### General
#### --process-instance=\<value\>
@@ -315,7 +484,7 @@ mpv.net的专属选项
从不
#### ---dark-theme=\<string\>
#### --dark-theme=\<string\>
深色模式中使用的配色主题。默认dark
@@ -329,6 +498,11 @@ mpv.net的专属选项
[配色主题](#配色主题)
#### --show-logo=\<yes|no\>
在原始OSC标志的基础上绘制蓝色的mpvnet图标。更改将在应用程序重新启动后生效。默认yes
外部工具
--------------
@@ -385,6 +559,15 @@ Universal Remote 的 File Browser 功能十分有用。
Philips code 0556 和 FLIRC USB (gen2) 一同被使用。
### External Application Button
视频可以通过Chrome扩展程序的外部应用按钮进行流式传输或轻松下载对于下载推荐
path: `wt`
args: `-- pwsh -NoLogo -Command "yt-dlp --ignore-errors --download-archive 'C:\External Application Button.txt' --output 'C:\YouTube\%(channel)s - %(title)s.%(ext)s' ('[HREF]' -replace '&list=.+','')"`
脚本
---------
@@ -396,13 +579,17 @@ Philips code 0556 和 FLIRC USB (gen2) 一同被使用。
Lua脚本的host由libmpv内建。
没有调试支持,只有错误和调试消息输出在终端上。
错误和调试消息输出在终端上。
Lua脚本在第一个媒体文件打开之前加载。
[mpv Lua 文档](https://mpv.io/manual/master/#lua-scripting)
[mpv用户脚本](https://github.com/mpv-player/mpv/wiki/User-Scripts)
[mpv 用户脚本 wiki](https://github.com/mpv-player/mpv/wiki/User-Scripts)
[mpv 用户脚本 GitHub](https://github.com/topics/mpv-script)
[mpv 用户脚本 Google](https://www.google.com/search?q=mpv+script)
#### JavaScript
@@ -413,7 +600,7 @@ Lua脚本在第一个媒体文件打开之前加载。
JavaScriptLua脚本的host由libmpv内建。
没有调试支持,只有错误和调试消息输出在终端上。
错误和调试消息输出在终端上。
JavaScript脚本在第一个媒体文件打开之前加载。
@@ -445,6 +632,7 @@ mpv.net没有定义脚本接口而是公开了它的完整内部没有兼
脚本代码可以在C#[扩展](../../../tree/master/src/Extensions)中编写,这样就可以获得
完整的代码和调试器支持。一旦代码被调试和开发完成,就可以将其从扩展转移到轻量级的独立脚本。
脚本host使用的是旧的C#版本,像字符串插值这样的现代功能是不存在的。
C#脚本的host类似于[扩展](../../../tree/master/src/Extensions),在打开媒体文件前尚未初始化。

View File

@@ -25,6 +25,7 @@ namespace mpvnet
public static bool AutoPlay { get; set; }
public static bool DebugMode { get; set; }
public static bool IsTerminalAttached { get; } = Environment.GetEnvironmentVariable("_started_from_console") == "yes";
public static bool KeepOpenExit { get; set; }
public static bool Queue { get; set; }
public static bool RememberVolume { get; set; } = true;
public static bool RememberWindowPosition { get; set; }
@@ -241,14 +242,15 @@ namespace mpvnet
case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true;
case "debug-mode": DebugMode = value == "yes"; 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 "minimum-aspect-ratio": MinimumAspectRatio = value.ToFloat(); return true;
case "process-instance": ProcessInstance = value; return true;
case "queue": Queue = value == "yes"; return true;
case "recent-count": RecentCount = value.ToInt(); return true;
case "remember-volume": RememberVolume = value == "yes"; return true;
case "show-logo": ShowLogo = value == "yes"; return true;
case "remember-window-position": RememberWindowPosition = value == "yes"; return true;
case "show-logo": ShowLogo = value == "yes"; return true;
case "start-size": StartSize = value; return true;
case "start-threshold": StartThreshold = value.ToInt(); return true;
case "video-file-extensions": CorePlayer.VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;

View File

@@ -35,6 +35,7 @@ namespace mpvnet
case "open-optical-media": Open_DVD_Or_BD_Folder(); break;
case "open-url": OpenFromClipboard(); break; // deprecated 2022
case "play-pause": PlayPause(); break;
case "playlist-add": PlaylistAdd(Convert.ToInt32(args[0])); break;
case "playlist-first": PlaylistFirst(); break;
case "playlist-last": PlaylistLast(); break;
case "reg-file-assoc": RegisterFileAssociations(args[0]); break;
@@ -662,5 +663,24 @@ namespace mpvnet
});
public static void ShowMenu() => Core.RaiseShowMenu();
public static void PlaylistAdd(int value)
{
int pos = Core.GetPropertyInt("playlist-pos");
int count = Core.GetPropertyInt("playlist-count");
if (count < 2)
return;
pos = pos + value;
if (pos < 0)
pos = count - 1;
if (pos > count - 1)
pos = 0;
Core.SetPropertyInt("playlist-pos", pos);
}
}
}

View File

@@ -22,8 +22,8 @@ namespace mpvnet
public partial class MainForm : Form
{
public ElementHost CommandPaletteHost { get; set; }
public IntPtr mpvWindowHandle { get; set; }
public static MainForm Instance { get; set; }
public static IntPtr Hwnd { get; set; }
new WpfControls.ContextMenu ContextMenu { get; set; }
AutoResetEvent MenuAutoResetEvent { get; } = new AutoResetEvent(false);
@@ -44,8 +44,6 @@ namespace mpvnet
try
{
Instance = this;
Hwnd = Handle;
Core.Init();
Core.Shutdown += Core_Shutdown;
Core.ShowMenu += Core_ShowMenu;
@@ -56,27 +54,8 @@ namespace mpvnet
Core.Seek += () => UpdateProgressBar();
Core.PlaylistPosChanged += (value) => SetTitle();
Core.ObserveProperty("window-maximized", PropChangeWindowMaximized);
Core.ObserveProperty("window-minimized", PropChangeWindowMinimized);
Core.ObservePropertyBool("border", PropChangeBorder);
Core.ObservePropertyBool("fullscreen", PropChangeFullscreen);
Core.ObservePropertyBool("keepaspect-window", value => Core.KeepaspectWindow = value);
Core.ObservePropertyBool("ontop", PropChangeOnTop);
Core.ObservePropertyBool("pause", PropChangePause);
Core.ObservePropertyString("sid", PropChangeSid);
Core.ObservePropertyString("aid", PropChangeAid);
Core.ObservePropertyString("vid", PropChangeVid);
Core.ObservePropertyString("title", PropChangeTitle);
Core.ObservePropertyInt("edition", PropChangeEdition);
Core.ObservePropertyDouble("window-scale", WindowScale);
if (Core.GPUAPI != "vulkan")
Core.ProcessCommandLine(false);
Init();
AppDomain.CurrentDomain.UnhandledException += (sender, e) => App.ShowException(e.ExceptionObject);
Application.ThreadException += (sender, e) => App.ShowException(e.Exception);
@@ -136,7 +115,33 @@ namespace mpvnet
}
}
private void Core_ShowMenu()
void Init()
{
Core.Init(Handle);
Core.ObserveProperty("window-maximized", PropChangeWindowMaximized);
Core.ObserveProperty("window-minimized", PropChangeWindowMinimized);
Core.ObservePropertyBool("border", PropChangeBorder);
Core.ObservePropertyBool("fullscreen", PropChangeFullscreen);
Core.ObservePropertyBool("keepaspect-window", value => Core.KeepaspectWindow = value);
Core.ObservePropertyBool("ontop", PropChangeOnTop);
Core.ObservePropertyBool("pause", PropChangePause);
Core.ObservePropertyString("sid", PropChangeSid);
Core.ObservePropertyString("aid", PropChangeAid);
Core.ObservePropertyString("vid", PropChangeVid);
Core.ObservePropertyString("title", PropChangeTitle);
Core.ObservePropertyInt("edition", PropChangeEdition);
Core.ObservePropertyDouble("window-scale", WindowScale);
Core.ProcessCommandLine(false);
}
void Core_ShowMenu()
{
BeginInvoke(new Action(() => {
if (IsMouseInOSC())
@@ -812,8 +817,14 @@ namespace mpvnet
case 0x20b: // WM_XBUTTONDOWN
case 0x20c: // WM_XBUTTONUP
case 0x20e: // WM_MOUSEHWHEEL
if (Core.WindowHandle != IntPtr.Zero)
m.Result = SendMessage(Core.WindowHandle, m.Msg, m.WParam, m.LParam);
if (mpvWindowHandle == IntPtr.Zero)
mpvWindowHandle = FindWindowEx(Handle, IntPtr.Zero, "mpv", null);
if (mpvWindowHandle != IntPtr.Zero)
m.Result = SendMessage(mpvWindowHandle, m.Msg, m.WParam, m.LParam);
break;
case 0x051: // WM_INPUTLANGCHANGE
ActivateKeyboardLayout(m.LParam, 0x00000100u /*KLF_SETFORPROCESS*/);
break;
case 0x319: // WM_APPCOMMAND
{
@@ -1021,7 +1032,8 @@ namespace mpvnet
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
if (Core.GPUAPI != "vulkan")
Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold);
LastCycleFullscreen = Environment.TickCount;
SetFormPosAndSize();
}
@@ -1036,12 +1048,12 @@ namespace mpvnet
{
base.OnShown(e);
if (Core.GPUAPI == "vulkan")
Init();
if (WindowState == FormWindowState.Maximized)
Core.SetPropertyBool("window-maximized", true);
if (Core.GPUAPI == "vulkan")
Core.ProcessCommandLine(false);
WPF.Init();
App.UpdateWpfColors();
MessageBoxEx.MessageForeground = Theme.Current.GetBrush("heading");

View File

@@ -71,7 +71,6 @@ namespace mpvnet
public List<KeyValuePair<string, double>> Chapters { get; set; } = new List<KeyValuePair<string, double>>();
public List<TimeSpan> BluRayTitles { get; } = new List<TimeSpan>();
public IntPtr Handle { get; set; }
public IntPtr WindowHandle { get; set; }
public Size VideoSize { get; set; }
public TimeSpan Duration;
@@ -108,7 +107,7 @@ namespace mpvnet
public float AutofitSmaller { get; set; } = 0.3f;
public float AutofitLarger { get; set; } = 0.8f;
public void Init()
public void Init(IntPtr handle)
{
ApplyShowMenuFix();
@@ -128,22 +127,20 @@ namespace mpvnet
SetPropertyString("msg-level", "osd/libass=fatal");
}
SetPropertyInt("osd-duration", 2000);
SetPropertyLong("wid", handle.ToInt64());
SetPropertyBool("input-default-bindings", true);
SetPropertyBool("input-builtin-bindings", false);
SetPropertyString("watch-later-options", "mute");
SetPropertyString("screenshot-directory", "~~desktop/");
SetPropertyString("osd-playing-msg", "${filename}");
SetPropertyString("wid", MainForm.Hwnd.ToString());
SetPropertyString("osc", "yes");
SetPropertyString("force-window", "yes");
SetPropertyString("config-dir", ConfigFolder);
SetPropertyString("config", "yes");
SetPropertyInt("osd-duration", 2000);
SetPropertyBool("keep-open", true);
SetPropertyBool("keep-open-pause", false);
SetPropertyBool("input-default-bindings", true);
SetPropertyBool("input-builtin-bindings", false);
ProcessCommandLine(true);
mpv_error err = mpv_initialize(Handle);
@@ -162,7 +159,7 @@ namespace mpvnet
{
ShowLogo();
if (GetPropertyString("keep-open") == "no")
if (GetPropertyString("keep-open") == "no" && App.KeepOpenExit)
Core.CommandV("quit");
}
});
@@ -271,7 +268,7 @@ namespace mpvnet
_ConfigFolder = _ConfigFolder.AddSep();
if (!File.Exists(_ConfigFolder + "input.conf"))
File.WriteAllText(_ConfigFolder + "input.conf", PatchInput(Properties.Resources.input_conf));
File.WriteAllText(_ConfigFolder + "input.conf", Properties.Resources.input_conf);
}
return _ConfigFolder;
@@ -301,28 +298,6 @@ namespace mpvnet
}
}
string PatchInput(string value)
{
if (Environment.GetEnvironmentVariable("username") == "frank" && Directory.Exists(@"D:\Projects\CS\mpv.net"))
value = value.Replace("volume 2 ", "volume 10")
.Replace("volume -2 ", "volume -10");
value += @"
KP2 script-message rate-file 2
2 script-message rate-file 2
KP3 script-message rate-file 3
3 script-message rate-file 3
KP4 script-message rate-file 4
4 script-message rate-file 4
KP5 script-message rate-file 5
5 script-message rate-file 5
KP0 script-binding delete_current_file/delete
0 script-binding delete_current_file/delete
KP1 script-binding delete_current_file/confirm
1 script-binding delete_current_file/confirm";
return value;
}
public void LoadScripts()
{
if (Directory.Exists(ConfigFolder + "scripts-ps"))
@@ -412,24 +387,6 @@ KP1 script-binding delete_current_file/confirm
IntPtr ptr = mpv_wait_event(Handle, -1);
mpv_event evt = (mpv_event)Marshal.PtrToStructure(ptr, typeof(mpv_event));
if (WindowHandle == IntPtr.Zero)
{
WindowHandle = Native.FindWindowEx(MainForm.Hwnd, IntPtr.Zero, "mpv", null);
if (WindowHandle != IntPtr.Zero)
{
int GWL_STYLE = -16;
uint WS_CHILD = 0x40000000;
uint WS_CLIPSIBLINGS = 0x04000000;
uint WS_DISABLED = 0x08000000;
uint WS_VISIBLE = 0x10000000;
Native.SetWindowLong(WindowHandle, GWL_STYLE,
WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS);
}
}
try
{
switch (evt.event_id)
@@ -800,6 +757,14 @@ KP1 script-binding delete_current_file/confirm
HandleError(err, throwException, $"error setting property: {name} = {value}");
}
public void SetPropertyLong(string name, long value, bool throwException = false)
{
mpv_error err = mpv_set_property(Handle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_INT64, ref value);
if (err < 0)
HandleError(err, throwException, $"error setting property: {name} = {value}");
}
public long GetPropertyLong(string name, bool throwException = false)
{
mpv_error err = mpv_get_property(Handle, GetUtf8Bytes(name),
@@ -811,15 +776,6 @@ KP1 script-binding delete_current_file/confirm
return lpBuffer.ToInt64();
}
public void SetPropertyLong(string name, long value, bool throwException = false)
{
long val = value;
mpv_error err = mpv_set_property(Handle, GetUtf8Bytes(name), mpv_format.MPV_FORMAT_INT64, ref val);
if (err < 0)
HandleError(err, throwException, $"error setting property: {name} = {value}");
}
public double GetPropertyDouble(string name, bool throwException = false)
{
mpv_error err = mpv_get_property(Handle, GetUtf8Bytes(name),
@@ -1330,41 +1286,34 @@ KP1 script-binding delete_current_file/confirm
public void ShowLogo()
{
if (!App.ShowLogo || (MainForm.Instance == null || App.Settings.LogoCrash))
if (!App.ShowLogo || MainForm.Instance == null || Core.Handle == IntPtr.Zero)
return;
try
bool december = DateTime.Now.Month == 12;
Rectangle cr = MainForm.Instance.ClientRectangle;
int len = Convert.ToInt32(cr.Height / (december ? 4.5 : 5));
if (len < 16 || cr.Height < 16)
return;
using (Bitmap bmp = new Bitmap(len, len))
{
bool december = DateTime.Now.Month == 12;
Rectangle cr = MainForm.Instance.ClientRectangle;
int len = Convert.ToInt32(cr.Height / (december ? 4.5 : 5));
if (len == 0)
return;
using (Bitmap bmp = new Bitmap(len, len))
using (Graphics gx = Graphics.FromImage(bmp))
{
using (Graphics gx = Graphics.FromImage(bmp))
{
gx.InterpolationMode = InterpolationMode.HighQualityBicubic;
gx.Clear(Color.Black);
Rectangle rect = new Rectangle(0, 0, len, len);
Bitmap bmp2 = december ? Properties.Resources.mpvnet_santa : Properties.Resources.mpvnet;
gx.DrawImage(bmp2, rect);
BitmapData bd = bmp.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);
int x = Convert.ToInt32((cr.Width - len) / (december ? 1.95 : 2));
int y = Convert.ToInt32((cr.Height - len) / 2.0 * (december ? 0.85 : 0.9));
CommandV("overlay-add", "0", $"{x}", $"{y}", "&" + bd.Scan0.ToInt64().ToString(), "0", "bgra", bd.Width.ToString(), bd.Height.ToString(), bd.Stride.ToString());
bmp.UnlockBits(bd);
IsLogoVisible = true;
}
gx.InterpolationMode = InterpolationMode.HighQualityBicubic;
gx.Clear(Color.Black);
Rectangle rect = new Rectangle(0, 0, len, len);
Bitmap bmp2 = december ? Properties.Resources.mpvnet_santa : Properties.Resources.mpvnet;
gx.DrawImage(bmp2, rect);
BitmapData bd = bmp.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);
int x = Convert.ToInt32((cr.Width - len) / (december ? 1.95 : 2));
int y = Convert.ToInt32((cr.Height - len) / 2.0 * (december ? 0.85 : 0.9));
CommandV("overlay-add", "0", $"{x}", $"{y}", "&" + bd.Scan0.ToInt64().ToString(), "0", "bgra", bd.Width.ToString(), bd.Height.ToString(), bd.Stride.ToString());
bmp.UnlockBits(bd);
IsLogoVisible = true;
}
}
catch (Exception)
{
App.Settings.LogoCrash = true;
}
}
string GetLanguage(string id)

View File

@@ -15,7 +15,6 @@ namespace mpvnet
public class AppSettings
{
public bool InputDefaultBindingsFixApplied;
public bool LogoCrash;
public bool ShowMenuFixApplied;
public int Volume = 70;
public List<string> RecentFiles = new List<string>();

View File

@@ -18,6 +18,9 @@ namespace mpvnet
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string path);
[DllImport("user32.dll")]
public static extern uint ActivateKeyboardLayout(IntPtr hkl, uint flags);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindowEx(
IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);

View File

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

View File

@@ -5,7 +5,14 @@ $versionInfo = [Diagnostics.FileVersionInfo]::GetVersionInfo($exePath)
$7z = 'C:\Program Files\7-Zip\7z.exe'
$targetDir = $tmpDir + "\mpv.net-$($versionInfo.FileVersion)-beta"
Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude 'System.Management.Automation.xml'
Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude System.Management.Automation.xml
$folders = 'Debug', 'Release', 'x64', 'x86', 'Arm'
foreach ($folder in $folders) {
Remove-Item (Join-Path $targetDir $folder) -Recurse -ErrorAction SilentlyContinue
}
& $7z a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*"
if ($LastExitCode) { throw $LastExitCode }

View File

@@ -505,6 +505,17 @@ help = Show progress in taskbar.
option = yes
option = no
[setting]
name = keep-open
file = mpv
default = no
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 = 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 = always Playback will never automatically advance to the next file.
[setting]
name = keep-open-pause
file = mpv
@@ -516,15 +527,14 @@ option = yes
option = no
[setting]
name = keep-open
file = mpv
name = keep-open-exit
file = mpvnet
default = no
filter = Playback
help = Using no, mpv would terminate after the last file but mpv.net never terminates automatically.
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.
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.
option = always Playback will never automatically advance to the next file.
option = yes
option = no
[setting]
name = auto-play

View File

@@ -18,8 +18,8 @@ Ctrl+s stop #menu: Stop
_ ignore #menu: -
Enter cycle fullscreen #menu: Toggle Fullscreen
F11 playlist-prev; set pause no #menu: Navigate > Previous File
F12 playlist-next; set pause no #menu: Navigate > Next File
F11 script-message mpv.net playlist-add -1; set pause no #menu: Navigate > Previous File
F12 script-message mpv.net playlist-add 1; set pause no #menu: Navigate > Next File
_ ignore #menu: Navigate > -
Home script-message mpv.net playlist-first #menu: Navigate > First File
End script-message mpv.net playlist-last #menu: Navigate > Last File
@@ -171,6 +171,8 @@ MBTN_Right script-message mpv.net show-menu
KP6 script-message mpv.net show-progress
7 script-message mpv.net cycle-audio
Sharp script-message mpv.net cycle-audio
Ctrl+F11 script-message mpv.net playlist-add -10
Ctrl+F12 script-message mpv.net playlist-add 10
8 cycle sub
j cycle sub
q quit

View File

@@ -193,7 +193,7 @@
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Misc\Misc.cs" />
<Compile Include="Misc\CorePlayer.cs" />
<Compile Include="Misc\Player.cs" />
<Compile Include="Misc\Commands.cs" />
<Compile Include="Native\Native.cs" />
<Compile Include="Misc\Program.cs" />