Commit 17cc3626 authored by Thomas Guillem's avatar Thomas Guillem

gl: cvpx: use CVEAGLContextCGLContextObj from ios vout variable

parent c36871f4
......@@ -128,7 +128,6 @@ struct vout_display_sys_t
struct gl_sys
{
CVEAGLContext locked_ctx;
VLCOpenGLES2VideoView *glESView;
};
......@@ -155,6 +154,8 @@ static int Open(vlc_object_t *this)
sys->picturePool = NULL;
sys->gl = NULL;
var_Create(vd->obj.parent, "ios-eaglcontext", VLC_VAR_ADDRESS);
@autoreleasepool {
/* setup the actual OpenGL ES view */
[VLCOpenGLES2VideoView performSelectorOnMainThread:@selector(getNewView:)
......@@ -184,7 +185,6 @@ static int Open(vlc_object_t *this)
vlc_malloc(this, sizeof(struct gl_sys));
if (unlikely(!sys->gl->sys))
goto bailout;
glsys->locked_ctx = NULL;
glsys->glESView = sys->glESView;
/* Initialize common OpenGL video display */
sys->gl->makeCurrent = OpenglESLock;
......@@ -194,6 +194,9 @@ static int Open(vlc_object_t *this)
if (vlc_gl_MakeCurrent(sys->gl) != VLC_SUCCESS)
goto bailout;
var_SetAddress(vd->obj.parent, "ios-eaglcontext", [sys->glESView eaglContext]);
sys->vgl = vout_display_opengl_New(&vd->fmt, &subpicture_chromas,
sys->gl, &vd->cfg->viewpoint);
vlc_gl_ReleaseCurrent(sys->gl);
......@@ -270,6 +273,7 @@ static void Close (vlc_object_t *this)
[sys->glESView release];
}
var_Destroy(vd->obj.parent, "ios-eaglcontext");
}
/*****************************************************************************
......@@ -396,7 +400,6 @@ static int OpenglESLock(vlc_gl_t *gl)
[sys->glESView lock];
[sys->glESView resetBuffers];
sys->locked_ctx = (__bridge CVEAGLContext) ((__bridge void *) [sys->glESView eaglContext]);
return VLC_SUCCESS;
}
......
......@@ -29,10 +29,6 @@
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#include <CoreVideo/CVOpenGLESTextureCache.h>
struct gl_sys
{
CVEAGLContext locked_ctx;
};
#else
#include <IOSurface/IOSurface.h>
#endif
......@@ -174,10 +170,16 @@ Open(vlc_object_t *obj)
const GLenum tex_target = GL_TEXTURE_2D;
{
struct gl_sys *glsys = tc->gl->sys;
CVEAGLContext eagl_ctx = var_InheritAddress(tc->gl, "ios-eaglcontext");
if (!eagl_ctx)
{
msg_Err(tc->gl, "can't find ios-eaglcontext\n");
free(priv);
return VLC_EGENERIC;
}
CVReturn err =
CVOpenGLESTextureCacheCreate(kCFAllocatorDefault, NULL,
glsys->locked_ctx, NULL, &priv->cache);
eagl_ctx, NULL, &priv->cache);
if (err != noErr)
{
msg_Err(tc->gl, "CVOpenGLESTextureCacheCreate failed: %d", err);
......
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