summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorder richter <der.richter@gmx.de>2024-02-25 23:59:11 +0100
committerder richter <der.richter@gmx.de>2024-02-27 14:01:38 +0100
commita7c4a113b82dc57641c08e1da5c3df9acb704be4 (patch)
tree7c2937343e2345a9050a320c868195c85f5ed437 /video
parent3dcc661de7e884e147965615749965df5f80a443 (diff)
downloadmpv-a7c4a113b82dc57641c08e1da5c3df9acb704be4.tar.bz2
mpv-a7c4a113b82dc57641c08e1da5c3df9acb704be4.tar.xz
cocoa-cb: remove pre-allocation and initialise only when used
cocoa-cb was always pre-allocated in the Application itself because libmpv needs to be set up before usage, an opengl context has to be set and because it was decided mac specific code should be kept out of libmpv. this means that a completely working libmpv and opengl renderer was set up even if it wasn't used. leading to unnecessary log message, resources being used or reserved on the system that might not be used, triggering of dedicated GPU unnecessarily and many other things. even if not optimal, this wasn't the biggest problem since we only had that one working vo on macOS. though now that we have a vulkan gpu(-next) backend on macOS that was made the default, we always have that dangling cocoa-cb instance, which is completely unnecessary. move the cocoa-cb initialisation into libmpv preinit function and only init cocoa-cb when we are a standalone App and cocoa-cb support is build into.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_libmpv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/video/out/vo_libmpv.c b/video/out/vo_libmpv.c
index 942882ca9c..ea13e83e97 100644
--- a/video/out/vo_libmpv.c
+++ b/video/out/vo_libmpv.c
@@ -27,6 +27,10 @@
#include "libmpv.h"
+#if HAVE_MACOS_COCOA_CB
+#include "osdep/macosx_events.h"
+#endif
+
/*
* mpv_render_context is managed by the host application - the host application
* can access it any time, even if the VO is destroyed (or not created yet).
@@ -705,7 +709,9 @@ static void uninit(struct vo *vo)
static int preinit(struct vo *vo)
{
-#if !HAVE_MACOS_COCOA_CB
+#if HAVE_MACOS_COCOA_CB
+ cocoa_init_cocoa_cb();
+#else
if (vo->probing)
return -1;
#endif