From f5854cde1b2d30e03f92e8cf89900c88009aaa7e Mon Sep 17 00:00:00 2001 From: hooke007 Date: Fri, 17 Dec 2021 07:43:31 +0800 Subject: [PATCH] support mpv-2 drop the support of mpv-1 --- docs/Manual.md | 2 +- src/Misc/App.cs | 2 +- src/Native/libmpv.cs | 40 ++++++++++++++--------------- src/Package/mpv.net.package.wapproj | 4 +-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/Manual.md b/docs/Manual.md index 9f9f517..4217125 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -70,7 +70,7 @@ in the startup directory). mpvnet.exe is platform agnostic, users that need x86 have to replace 3 native tools: -- mpv-1.dll +- mpv-2.dll - MediaInfo.dll - mpvnet.com diff --git a/src/Misc/App.cs b/src/Misc/App.cs index bf9b2e6..f67ef1c 100644 --- a/src/Misc/App.cs +++ b/src/Misc/App.cs @@ -131,7 +131,7 @@ namespace mpvnet public static string Version => "Copyright (C) 2000-2021 mpv.net/mpv/mplayer\n" + $"mpv.net {Application.ProductVersion} ({File.GetLastWriteTime(Application.ExecutablePath).ToShortDateString()})\n" + - $"{Core.GetPropertyString("mpv-version")} ({File.GetLastWriteTime(Folder.Startup + "mpv-1.dll").ToShortDateString()})\nffmpeg {Core.GetPropertyString("ffmpeg-version")}\nGPL v2 License"; + $"{Core.GetPropertyString("mpv-version")} ({File.GetLastWriteTime(Folder.Startup + "mpv-2.dll").ToShortDateString()})\nffmpeg {Core.GetPropertyString("ffmpeg-version")}\nGPL v2 License"; public static void ShowException(object obj) { diff --git a/src/Native/libmpv.cs b/src/Native/libmpv.cs index 8e5a56f..2462bd3 100644 --- a/src/Native/libmpv.cs +++ b/src/Native/libmpv.cs @@ -5,64 +5,64 @@ using System.Text; public class libmpv { - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr mpv_create(); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_initialize(IntPtr mpvHandle); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_command(IntPtr mpvHandle, IntPtr strings); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_command_string(IntPtr mpvHandle, [MarshalAs(UnmanagedType.LPUTF8Str)] string command); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_command_ret(IntPtr mpvHandle, IntPtr strings, IntPtr node); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void mpv_free_node_contents(IntPtr node); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr mpv_error_string(mpv_error error); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int mpv_terminate_destroy(IntPtr mpvHandle); - [DllImport("mpv-1.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); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int mpv_set_option(IntPtr mpvHandle, byte[] name, mpv_format format, ref long data); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int mpv_set_option_string(IntPtr mpvHandle, byte[] name, byte[] value); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_get_property(IntPtr mpvHandle, byte[] name, mpv_format format, out IntPtr data); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_get_property(IntPtr mpvHandle, byte[] name, mpv_format format, out double data); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_set_property(IntPtr mpvHandle, byte[] name, mpv_format format, ref byte[] data); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_set_property(IntPtr mpvHandle, byte[] name, mpv_format format, ref long data); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_set_property(IntPtr mpvHandle, byte[] name, mpv_format format, ref double data); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern mpv_error mpv_observe_property(IntPtr mpvHandle, ulong reply_userdata, [MarshalAs(UnmanagedType.LPUTF8Str)] string name, mpv_format format); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern int mpv_unobserve_property(IntPtr mpvHandle, ulong registered_reply_userdata); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void mpv_free(IntPtr data); - [DllImport("mpv-1.dll", CallingConvention = CallingConvention.Cdecl)] + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr mpv_wait_event(IntPtr mpvHandle, double timeout); public enum mpv_error diff --git a/src/Package/mpv.net.package.wapproj b/src/Package/mpv.net.package.wapproj index 830305c..abe9e94 100644 --- a/src/Package/mpv.net.package.wapproj +++ b/src/Package/mpv.net.package.wapproj @@ -107,8 +107,8 @@ mpv.net\Microsoft.Management.Infrastructure.dll PreserveNewest - - mpv.net\mpv-1.dll + + mpv.net\mpv-2.dll PreserveNewest