[vlc-commits] vout/macosx: fix vlc_gl_t creation

Filip Roséen git at videolan.org
Mon Dec 19 15:04:07 CET 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Dec 19 03:16:11 2016 +0100| [928c87ecc86ea6de9cf7eb7a761423ee894ff027] | committer: Thomas Guillem

vout/macosx: 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).

refs #17795

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/video_output/macosx.m | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index a5b0c82..a3ae7ba 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -116,7 +116,7 @@ struct vout_display_sys_t
     NSColorSpace *nsColorSpace;
 
     vout_window_t *embed;
-    vlc_gl_t gl;
+    vlc_gl_t *gl;
     vout_display_opengl_t *vgl;
 
     picture_pool_t *pool;
@@ -148,8 +148,9 @@ static int Open (vlc_object_t *this)
 
         vd->sys = sys;
         sys->pool = NULL;
-        sys->gl.sys = NULL;
         sys->embed = NULL;
+        sys->vgl = NULL;
+        sys->gl = NULL;
 
         /* Get the drawable object */
         id container = var_CreateGetAddress (vd, "drawable-nsobject");
@@ -253,18 +254,23 @@ static int Open (vlc_object_t *this)
         }
 
         /* 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(this);
+
+        if( unlikely( !sys->gl ) )
+            goto error;
+
+        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;
 
-        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 error;
         }
 
@@ -316,9 +322,12 @@ void Close (vlc_object_t *this)
                                       withObject:nil
                                    waitUntilDone:NO];
 
-        if (sys->gl.sys != NULL)
+        if (sys->vgl != NULL)
             vout_display_opengl_Delete (sys->vgl);
 
+        if (sys->gl != NULL)
+            vlc_gl_Destroy (sys->gl);
+
         [sys->glView release];
 
         if (sys->cgColorSpace != nil)



More information about the vlc-commits mailing list