[vlc-commits] vout: macosx: rework "macosx-ns-opengl-context" var

Thomas Guillem git at videolan.org
Tue Sep 12 16:48:35 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Sep 12 14:50:31 2017 +0200| [75968315be8b16037b3f3b1b10018e823ec65b97] | committer: Thomas Guillem

vout: macosx: rework "macosx-ns-opengl-context" var

Store directly a CGLContext and rename "macosx-ns-opengl-context" to
"macosx-glcontext".

Also fix a wrong var_Destroy() on error path.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=75968315be8b16037b3f3b1b10018e823ec65b97
---

 modules/video_filter/ci_filters.m | 13 +++++++------
 modules/video_output/macosx.m     |  8 +++++---
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/modules/video_filter/ci_filters.m b/modules/video_filter/ci_filters.m
index 4e758bc7aa..f522a76f70 100644
--- a/modules/video_filter/ci_filters.m
+++ b/modules/video_filter/ci_filters.m
@@ -35,7 +35,6 @@
 #include "filter_picture.h"
 #include "vt_utils.h"
 
-#include <AppKit/NSOpenGL.h>
 #include <CoreImage/CIContext.h>
 #include <CoreImage/CIImage.h>
 #include <CoreImage/CIFilter.h>
@@ -532,11 +531,13 @@ Open(vlc_object_t *obj, char const *psz_filter)
                 goto error;
         }
 
-        NSOpenGLContext *context =
-            var_InheritAddress(filter, "macosx-ns-opengl-context");
-        assert(context);
-
-        ctx->ci_ctx = [CIContext contextWithCGLContext: [context CGLContextObj]
+        CGLContextObj glctx = var_InheritAddress(filter, "macosx-glcontext");
+        if (!glctx)
+        {
+            msg_Err(filter, "can't find 'macosx-glcontext' var");
+            goto error;
+        }
+        ctx->ci_ctx = [CIContext contextWithCGLContext: glctx
                                            pixelFormat: nil
                                             colorSpace: nil
                                                options: nil];
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index a300a21493..b1bb29e66b 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -152,6 +152,8 @@ static int Open (vlc_object_t *this)
         sys->vgl = NULL;
         sys->gl = NULL;
 
+        var_Create(vd->obj.parent, "macosx-glcontext", VLC_VAR_ADDRESS);
+
         /* Get the drawable object */
         id container = var_CreateGetAddress (vd, "drawable-nsobject");
         if (container)
@@ -221,8 +223,8 @@ static int Open (vlc_object_t *this)
         sys->gl->swap = OpenglSwap;
         sys->gl->getProcAddress = OurGetProcAddress;
 
-        var_Create(vd->obj.parent, "macosx-ns-opengl-context", VLC_VAR_ADDRESS);
-        var_SetAddress(vd->obj.parent, "macosx-ns-opengl-context", [sys->glView openGLContext]);
+        var_SetAddress(vd->obj.parent, "macosx-glcontext",
+                       [[sys->glView openGLContext] CGLContextObj]);
 
         const vlc_fourcc_t *subpicture_chromas;
 
@@ -286,7 +288,7 @@ void Close (vlc_object_t *this)
                                       withObject:nil
                                    waitUntilDone:NO];
 
-        var_Destroy(vd->obj.parent, "macosx-ns-opengl-context");
+        var_Destroy(vd->obj.parent, "macosx-glcontext");
         if (sys->vgl != NULL)
         {
             vlc_gl_MakeCurrent(sys->gl);



More information about the vlc-commits mailing list