-
This commit is contained in:
@@ -201,6 +201,13 @@ mpv.net bugs and requests: <https://github.com/stax76/mpv.net/issues>
|
|||||||
|
|
||||||
### Changelog
|
### Changelog
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
- on the start screen the mpv.net logo is shown instead of the mpv logo
|
||||||
|
- everytime only one file is opened mpv.net loads the complete folder
|
||||||
|
in the playlist
|
||||||
|
- the info command (i key) shows the audio format
|
||||||
|
|
||||||
### 3.7
|
### 3.7
|
||||||
|
|
||||||
- new icon design
|
- new icon design
|
||||||
|
|||||||
@@ -154,7 +154,8 @@ namespace mpvnet
|
|||||||
|
|
||||||
TimeSpan position = TimeSpan.FromSeconds(mp.get_property_number("time-pos"));
|
TimeSpan position = TimeSpan.FromSeconds(mp.get_property_number("time-pos"));
|
||||||
TimeSpan duration2 = TimeSpan.FromSeconds(mp.get_property_number("duration"));
|
TimeSpan duration2 = TimeSpan.FromSeconds(mp.get_property_number("duration"));
|
||||||
string videoCodec = mp.get_property_string("video-format").ToUpper();
|
string videoFormat = mp.get_property_string("video-format").ToUpper();
|
||||||
|
string audioCodec = mp.get_property_string("audio-codec-name").ToUpper();
|
||||||
|
|
||||||
text = Path.GetFileName(path) + "\n" +
|
text = Path.GetFileName(path) + "\n" +
|
||||||
FormatTime(position.TotalMinutes) + ":" +
|
FormatTime(position.TotalMinutes) + ":" +
|
||||||
@@ -166,7 +167,7 @@ namespace mpvnet
|
|||||||
if (fileSize > 0)
|
if (fileSize > 0)
|
||||||
text += Convert.ToInt32(fileSize / 1024.0 / 1024.0).ToString() + " MB\n";
|
text += Convert.ToInt32(fileSize / 1024.0 / 1024.0).ToString() + " MB\n";
|
||||||
|
|
||||||
text += $"{videoCodec}\n";
|
text += $"{videoFormat}\n{audioCodec}";
|
||||||
|
|
||||||
mp.commandv("show-text", text, "5000");
|
mp.commandv("show-text", text, "5000");
|
||||||
string FormatTime(double value) => ((int)value).ToString("00");
|
string FormatTime(double value) => ((int)value).ToString("00");
|
||||||
|
|||||||
79
mpv.net/Properties/Resources.Designer.cs
generated
79
mpv.net/Properties/Resources.Designer.cs
generated
@@ -60,30 +60,109 @@ namespace mpvnet.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to
|
||||||
|
/// # This file defines the input (keys and mouse) bindings of mpv and mpv.net
|
||||||
|
/// # and it also defines the context menu of mpv.net. mpv.net has an input
|
||||||
|
/// # editor and an config editor as alternative to editing conf text files.
|
||||||
|
/// # The input and config editor can be found in mpv.net's context menu at:
|
||||||
|
///
|
||||||
|
/// # Settings > Show Config Editor
|
||||||
|
/// # Settings > Show Input Editor
|
||||||
|
///
|
||||||
|
/// # The defaults of this file can be found at:
|
||||||
|
///
|
||||||
|
/// # https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt
|
||||||
|
///
|
||||||
|
/// # th [rest of string was truncated]";.
|
||||||
|
/// </summary>
|
||||||
internal static string inputConf {
|
internal static string inputConf {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("inputConf", resourceCulture);
|
return ResourceManager.GetString("inputConf", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to
|
||||||
|
/// # This file defines the input (keys and mouse) bindings of mpv and mpv.net
|
||||||
|
/// # and it also defines the context menu of mpv.net. mpv.net has an input
|
||||||
|
/// # editor and an config editor as alternatives to editing conf text files.
|
||||||
|
/// # The input and config editor can be found in mpv.net's context menu at:
|
||||||
|
///
|
||||||
|
/// # Settings > Show Config Editor
|
||||||
|
/// # Settings > Show Input Editor
|
||||||
|
///
|
||||||
|
/// # The defaults of this file can be found at:
|
||||||
|
///
|
||||||
|
/// # https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/inputConf.txt
|
||||||
|
///
|
||||||
|
/// # t [rest of string was truncated]";.
|
||||||
|
/// </summary>
|
||||||
internal static string inputConfHeader {
|
internal static string inputConfHeader {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("inputConfHeader", resourceCulture);
|
return ResourceManager.GetString("inputConfHeader", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to
|
||||||
|
///# mpv manual: https://mpv.io/manual/master/
|
||||||
|
///
|
||||||
|
///# mpv.net mpv.conf defaults: https://github.com/stax76/mpv.net/blob/master/mpv.net/Resources/mpvConf.txt
|
||||||
|
///
|
||||||
|
///input-ar-delay = 500
|
||||||
|
///input-ar-rate = 20
|
||||||
|
///volume = 50
|
||||||
|
///hwdec = yes
|
||||||
|
///keep-open = yes
|
||||||
|
///keep-open-pause = no
|
||||||
|
///osd-playing-msg = ${filename}
|
||||||
|
///screenshot-directory = ~~desktop/
|
||||||
|
///input-default-bindings = no
|
||||||
|
///.
|
||||||
|
/// </summary>
|
||||||
internal static string mpvConf {
|
internal static string mpvConf {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("mpvConf", resourceCulture);
|
return ResourceManager.GetString("mpvConf", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to [[settings]]
|
||||||
|
///name = "hwdec"
|
||||||
|
///default = "no"
|
||||||
|
///filter = "Video"
|
||||||
|
///helpurl = "https://mpv.io/manual/master/#options-hwdec"
|
||||||
|
///help = "--hwdec=<mode> Specify the hardware video decoding API that should be used if possible. Whether hardware decoding is actually done depends on the video codec. If hardware decoding is not possible, mpv will fall back on software decoding.\n\nFor more information visit:"
|
||||||
|
///options = [{ name = "no", help = "always use software decoding (Default)" },
|
||||||
|
/// { name = "aut [rest of string was truncated]";.
|
||||||
|
/// </summary>
|
||||||
internal static string mpvConfToml {
|
internal static string mpvConfToml {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("mpvConfToml", resourceCulture);
|
return ResourceManager.GetString("mpvConfToml", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap mpvnet {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("mpvnet", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to [[settings]]
|
||||||
|
///name = "dark-mode"
|
||||||
|
///default = "always"
|
||||||
|
///filter = "mpv.net"
|
||||||
|
///help = "Enables a dark theme."
|
||||||
|
///options = [{ name = "always" },
|
||||||
|
/// { name = "system" , help = "Available on Windows 10 or higher" },
|
||||||
|
/// { name = "never" }].
|
||||||
|
/// </summary>
|
||||||
internal static string mpvNetConfToml {
|
internal static string mpvNetConfToml {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("mpvNetConfToml", resourceCulture);
|
return ResourceManager.GetString("mpvNetConfToml", resourceCulture);
|
||||||
|
|||||||
@@ -130,6 +130,9 @@
|
|||||||
<data name="mpvConfToml" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="mpvConfToml" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\mpvConfToml.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
<value>..\Resources\mpvConfToml.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="mpvnet" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\mpvnet.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="mpvNetConfToml" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="mpvNetConfToml" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\mpvNetConfToml.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
<value>..\Resources\mpvNetConfToml.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
BIN
mpv.net/Resources/mpvnet.png
Normal file
BIN
mpv.net/Resources/mpvnet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
@@ -548,7 +548,13 @@ namespace mpvnet
|
|||||||
BuildMenu();
|
BuildMenu();
|
||||||
ContextMenuStrip = ContextMenu;
|
ContextMenuStrip = ContextMenu;
|
||||||
IgnoreDpiChanged = false;
|
IgnoreDpiChanged = false;
|
||||||
CheckURL();
|
CheckURL();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnResize(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnResize(e);
|
||||||
|
if (mp.IsLogoVisible) mp.ShowLogo();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnFormClosed(FormClosedEventArgs e)
|
protected override void OnFormClosed(FormClosedEventArgs e)
|
||||||
|
|||||||
@@ -244,6 +244,7 @@
|
|||||||
<Content Include="mpvnet.ico" />
|
<Content Include="mpvnet.ico" />
|
||||||
<Content Include="Resources\mpvConf.txt" />
|
<Content Include="Resources\mpvConf.txt" />
|
||||||
<Content Include="Resources\mpvConfToml.txt" />
|
<Content Include="Resources\mpvConfToml.txt" />
|
||||||
|
<None Include="Resources\mpvnet.png" />
|
||||||
<Content Include="Resources\mpvNetConfToml.txt" />
|
<Content Include="Resources\mpvNetConfToml.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -53,6 +55,7 @@ namespace mpvnet
|
|||||||
public static IntPtr MpvHandle { get; set; }
|
public static IntPtr MpvHandle { get; set; }
|
||||||
public static IntPtr MpvWindowHandle { get; set; }
|
public static IntPtr MpvWindowHandle { get; set; }
|
||||||
public static Addon Addon { get; set; }
|
public static Addon Addon { get; set; }
|
||||||
|
public static bool IsLogoVisible { set; get; }
|
||||||
public static List<KeyValuePair<string, Action<bool>>> BoolPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<bool>>>();
|
public static List<KeyValuePair<string, Action<bool>>> BoolPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<bool>>>();
|
||||||
public static List<KeyValuePair<string, Action<int>>> IntPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<int>>>();
|
public static List<KeyValuePair<string, Action<int>>> IntPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<int>>>();
|
||||||
public static List<KeyValuePair<string, Action<string>>> StringPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<string>>>();
|
public static List<KeyValuePair<string, Action<string>>> StringPropChangeActions { get; set; } = new List<KeyValuePair<string, Action<string>>>();
|
||||||
@@ -157,6 +160,7 @@ namespace mpvnet
|
|||||||
set_property_string("force-window", "yes");
|
set_property_string("force-window", "yes");
|
||||||
set_property_string("input-media-keys", "yes");
|
set_property_string("input-media-keys", "yes");
|
||||||
mpv_initialize(MpvHandle);
|
mpv_initialize(MpvHandle);
|
||||||
|
ShowLogo();
|
||||||
ProcessCommandLine();
|
ProcessCommandLine();
|
||||||
Task.Run(() => { LoadScripts(); });
|
Task.Run(() => { LoadScripts(); });
|
||||||
Task.Run(() => { Addon = new Addon(); });
|
Task.Run(() => { Addon = new Addon(); });
|
||||||
@@ -226,11 +230,12 @@ namespace mpvnet
|
|||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_END_FILE:
|
case mpv_event_id.MPV_EVENT_END_FILE:
|
||||||
var end_fileData = (mpv_event_end_file)Marshal.PtrToStructure(evt.data, typeof(mpv_event_end_file));
|
var end_fileData = (mpv_event_end_file)Marshal.PtrToStructure(evt.data, typeof(mpv_event_end_file));
|
||||||
EndFile?.Invoke((EndFileEventMode)end_fileData.reason);
|
EndFileEventMode reason = (EndFileEventMode)end_fileData.reason;
|
||||||
|
EndFile?.Invoke(reason);
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_FILE_LOADED:
|
case mpv_event_id.MPV_EVENT_FILE_LOADED:
|
||||||
|
HideLogo();
|
||||||
FileLoaded?.Invoke();
|
FileLoaded?.Invoke();
|
||||||
LoadFolder();
|
|
||||||
WriteHistory(mp.get_property_string("path"));
|
WriteHistory(mp.get_property_string("path"));
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_TRACKS_CHANGED:
|
case mpv_event_id.MPV_EVENT_TRACKS_CHANGED:
|
||||||
@@ -241,6 +246,8 @@ namespace mpvnet
|
|||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_IDLE:
|
case mpv_event_id.MPV_EVENT_IDLE:
|
||||||
Idle?.Invoke();
|
Idle?.Invoke();
|
||||||
|
if (mp.get_property_int("playlist-count") == 0)
|
||||||
|
ShowLogo();
|
||||||
break;
|
break;
|
||||||
case mpv_event_id.MPV_EVENT_PAUSE:
|
case mpv_event_id.MPV_EVENT_PAUSE:
|
||||||
Pause?.Invoke();
|
Pause?.Invoke();
|
||||||
@@ -343,6 +350,15 @@ namespace mpvnet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void HideLogo()
|
||||||
|
{
|
||||||
|
if (IsLogoVisible)
|
||||||
|
{
|
||||||
|
mp.commandv("overlay-remove", "0");
|
||||||
|
IsLogoVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static List<PythonEventObject> PythonEventObjects = new List<PythonEventObject>();
|
static List<PythonEventObject> PythonEventObjects = new List<PythonEventObject>();
|
||||||
|
|
||||||
public static void register_event(string name, IronPython.Runtime.PythonFunction pyFunc)
|
public static void register_event(string name, IronPython.Runtime.PythonFunction pyFunc)
|
||||||
@@ -518,12 +534,13 @@ namespace mpvnet
|
|||||||
protected static void ProcessCommandLine()
|
protected static void ProcessCommandLine()
|
||||||
{
|
{
|
||||||
var args = Environment.GetCommandLineArgs().Skip(1);
|
var args = Environment.GetCommandLineArgs().Skip(1);
|
||||||
|
List<string> files = new List<string>();
|
||||||
|
|
||||||
foreach (string i in args)
|
foreach (string i in args)
|
||||||
if (!i.StartsWith("--") && File.Exists(i))
|
if (!i.StartsWith("--") && File.Exists(i))
|
||||||
mp.commandv("loadfile", i, "append");
|
files.Add(i);
|
||||||
|
|
||||||
mp.set_property_string("playlist-pos", "0");
|
mp.LoadFiles(files.ToArray());
|
||||||
|
|
||||||
foreach (string i in args)
|
foreach (string i in args)
|
||||||
{
|
{
|
||||||
@@ -543,6 +560,8 @@ namespace mpvnet
|
|||||||
|
|
||||||
public static void LoadFiles(params string[] files)
|
public static void LoadFiles(params string[] files)
|
||||||
{
|
{
|
||||||
|
if (files is null || files.Length == 0) return;
|
||||||
|
HideLogo();
|
||||||
int count = mp.get_property_int("playlist-count");
|
int count = mp.get_property_int("playlist-count");
|
||||||
|
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
@@ -553,18 +572,13 @@ namespace mpvnet
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
mp.commandv("playlist-remove", "0");
|
mp.commandv("playlist-remove", "0");
|
||||||
|
|
||||||
mp.LoadFolder();
|
mp.LoadFolder(files[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool WasFolderLoaded;
|
static void LoadFolder(string path)
|
||||||
|
|
||||||
static void LoadFolder()
|
|
||||||
{
|
{
|
||||||
if (WasFolderLoaded) return;
|
|
||||||
|
|
||||||
if (get_property_int("playlist-count") == 1)
|
if (get_property_int("playlist-count") == 1)
|
||||||
{
|
{
|
||||||
string path = get_property_string("path");
|
|
||||||
if (!File.Exists(path)) return;
|
if (!File.Exists(path)) return;
|
||||||
List<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
|
List<string> files = Directory.GetFiles(Path.GetDirectoryName(path)).ToList();
|
||||||
files = files.Where((file) => App.VideoTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) ||
|
files = files.Where((file) => App.VideoTypes.Contains(Path.GetExtension(file).TrimStart('.').ToLower()) ||
|
||||||
@@ -577,8 +591,6 @@ namespace mpvnet
|
|||||||
if (index > 0)
|
if (index > 0)
|
||||||
commandv("playlist-move", "0", (index + 1).ToString());
|
commandv("playlist-move", "0", (index + 1).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
WasFolderLoaded = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
|
static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
|
||||||
@@ -642,6 +654,28 @@ namespace mpvnet
|
|||||||
LastHistoryStartDateTime = DateTime.Now;
|
LastHistoryStartDateTime = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ShowLogo()
|
||||||
|
{
|
||||||
|
if (MainForm.Instance is null) return;
|
||||||
|
Rectangle cr = MainForm.Instance.ClientRectangle;
|
||||||
|
|
||||||
|
using (Bitmap b = new Bitmap(cr.Width, cr.Height))
|
||||||
|
{
|
||||||
|
using (Graphics g = Graphics.FromImage(b))
|
||||||
|
{
|
||||||
|
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||||
|
g.Clear(Color.Black);
|
||||||
|
int iconWidth = cr.Height / 7;
|
||||||
|
Rectangle r = new Rectangle(cr.Width / 2 - iconWidth / 2, cr.Height / 2 - iconWidth / 2, iconWidth, iconWidth);
|
||||||
|
g.DrawImage(Properties.Resources.mpvnet, r);
|
||||||
|
BitmapData bd = b.LockBits(cr, ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb);
|
||||||
|
mp.commandv("overlay-add", "0", "0", "0", "&" + bd.Scan0.ToInt64().ToString(), "0", "bgra", bd.Width.ToString(), bd.Height.ToString(), bd.Stride.ToString());
|
||||||
|
b.UnlockBits(bd);
|
||||||
|
IsLogoVisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void ReadMetaData()
|
static void ReadMetaData()
|
||||||
{
|
{
|
||||||
lock (MediaTracks)
|
lock (MediaTracks)
|
||||||
|
|||||||
Reference in New Issue
Block a user