[vlc-commits] vout/caopengllayer.m: fix vlc_gl_t creation

Thomas Guillem git at videolan.org
Mon Dec 19 15:04:08 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Dec 19 14:59:17 2016 +0100| [c55c92d3b054734f1815ec15364203a418d69f9a] | committer: Thomas Guillem

vout/caopengllayer.m: fix vlc_gl_t creation

These changes makes use of vlc_gl_Create to create an object of type vlc_gl_t,
effectively making sure that it is a valid VLC_OBJECT (instead of only looking
like such).

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

 modules/video_output/caopengllayer.m | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index b3c60c9..33abaf1 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -101,7 +101,7 @@ struct vout_display_sys_t {
 
     CGLContextObj glContext;
 
-    vlc_gl_t gl;
+    vlc_gl_t *gl;
     vout_display_opengl_t *vgl;
 
     vout_display_place_t place;
@@ -171,19 +171,21 @@ static int Open (vlc_object_t *p_this)
             msg_Warn(vd, "we might not have an OpenGL context yet");
 
         /* Initialize common OpenGL video display */
-        sys->gl.makeCurrent = OpenglLock;
-        sys->gl.releaseCurrent = OpenglUnlock;
-        sys->gl.swap = OpenglSwap;
-        sys->gl.getProcAddress = OurGetProcAddress;
-        sys->gl.sys = sys;
+        sys->gl = vlc_gl_Create(vd);
+        if (unlikely(!sys->gl))
+            goto bailout;
+        sys->gl->makeCurrent = OpenglLock;
+        sys->gl->releaseCurrent = OpenglUnlock;
+        sys->gl->swap = OpenglSwap;
+        sys->gl->getProcAddress = OurGetProcAddress;
+        sys->gl->sys = sys;
 
         const vlc_fourcc_t *subpicture_chromas;
         video_format_t fmt = vd->fmt;
-        sys->vgl = vout_display_opengl_New(&vd->fmt, &subpicture_chromas, &sys->gl,
+        sys->vgl = vout_display_opengl_New(&vd->fmt, &subpicture_chromas, sys->gl,
                                            &vd->cfg->viewpoint);
         if (!sys->vgl) {
             msg_Err(vd, "Error while initializing opengl display.");
-            sys->gl.sys = NULL;
             goto bailout;
         }
 
@@ -297,9 +299,12 @@ static void Close (vlc_object_t *p_this)
     if (sys->embed)
         vout_display_DeleteWindow(vd, sys->embed);
 
-    if (sys->gl.sys != NULL)
+    if (sys->vgl != NULL)
         vout_display_opengl_Delete(sys->vgl);
 
+    if (sys->gl != NULL)
+        vlc_gl_Destroy(sys->gl);
+
     if (sys->glContext)
         CGLReleaseContext(sys->glContext);
 



More information about the vlc-commits mailing list