From 6157a017013078907582b951260511c01374068b Mon Sep 17 00:00:00 2001 From: stax76 Date: Mon, 11 Jul 2022 06:57:10 +0200 Subject: [PATCH] disable unused mpv events --- src/Misc/Player.cs | 12 ++++++++++++ src/Native/libmpv.cs | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/Misc/Player.cs b/src/Misc/Player.cs index 9933c0f..efe28c6 100644 --- a/src/Misc/Player.cs +++ b/src/Misc/Player.cs @@ -118,6 +118,18 @@ namespace mpvnet Handle = mpv_create(); + mpv_event_id[] events = { + mpv_event_id.MPV_EVENT_START_FILE, + mpv_event_id.MPV_EVENT_AUDIO_RECONFIG, + mpv_event_id.MPV_EVENT_FILE_LOADED, + mpv_event_id.MPV_EVENT_VIDEO_RECONFIG, + mpv_event_id.MPV_EVENT_PLAYBACK_RESTART, + mpv_event_id.MPV_EVENT_END_FILE + }; + + foreach (mpv_event_id i in events) + mpv_request_event(Handle, i, 0); + mpv_request_log_messages(Handle, "no"); App.RunTask(() => MainEventLoop()); diff --git a/src/Native/libmpv.cs b/src/Native/libmpv.cs index 422aeb0..0d3989d 100644 --- a/src/Native/libmpv.cs +++ b/src/Native/libmpv.cs @@ -65,6 +65,9 @@ public class libmpv [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr mpv_wait_event(IntPtr mpvHandle, double timeout); + [DllImport("mpv-2.dll", CallingConvention = CallingConvention.Cdecl)] + public static extern mpv_error mpv_request_event(IntPtr mpvHandle, mpv_event_id id, int enable); + public enum mpv_error { MPV_ERROR_SUCCESS = 0,