Commit 75968315 authored by Thomas Guillem's avatar Thomas Guillem

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

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

Also fix a wrong var_Destroy() on error path.
parent 4d3db120
......@@ -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");
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];
......@@ -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)
var_Destroy(vd->obj.parent, "macosx-ns-opengl-context");
var_Destroy(vd->obj.parent, "macosx-glcontext");
if (sys->vgl != NULL)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment