]> git.sesse.net Git - vlc/blobdiff - modules/gui/minimal_macosx/voutgl.m
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / gui / minimal_macosx / voutgl.m
index 3db8bc526a8996973a7c316fad76125dd47aca32..6daabe3644284994a24cb16a17d5f9f594914899 100644 (file)
 #include "intf.h"
 #include "voutgl.h"
 
-int E_(OpenVideoGL)  ( vlc_object_t * p_this )
+int OpenVideoGL  ( vlc_object_t * p_this )
 {
     vout_thread_t * p_vout = (vout_thread_t *) p_this;
-    vlc_value_t value_drawable;
+    int i_drawable_agl;
+    int i_drawable_gl;
 
     if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) )
     {
@@ -49,16 +50,16 @@ int E_(OpenVideoGL)  ( vlc_object_t * p_this )
 
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
-    {
-        msg_Err( p_vout, "out of memory" );
         return( 1 );
-    }
 
     memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
 
-    var_Get( p_vout->p_libvlc, "drawable", &value_drawable );
-    
-    if( 0 /* Are we in the mozilla plugin ? XXX: get that from drawable */ )
+    i_drawable_agl = var_GetInteger( p_vout->p_libvlc, "drawable-agl" );
+    i_drawable_gl = var_GetInteger( p_vout->p_libvlc, "drawable-gl" );
+
+    /* Are we in the mozilla plugin, which isn't 64bit compatible ? */
+#ifndef __x86_64__
+    if( i_drawable_agl > 0 )
     {
         p_vout->pf_init             = aglInit;
         p_vout->pf_end              = aglEnd;
@@ -68,7 +69,7 @@ int E_(OpenVideoGL)  ( vlc_object_t * p_this )
         p_vout->pf_lock             = aglLock;
         p_vout->pf_unlock           = aglUnlock;
     }
-    else
+    else /*if( i_drawable_gl > 0 )*/
     {
         /* Let's use the VLCOpenGLVoutView.m class */
         p_vout->pf_init   = cocoaglvoutviewInit;
@@ -79,14 +80,25 @@ int E_(OpenVideoGL)  ( vlc_object_t * p_this )
         p_vout->pf_lock   = cocoaglvoutviewLock;
         p_vout->pf_unlock = cocoaglvoutviewUnlock;
     }
-    p_vout->p_sys->b_got_frame = VLC_FALSE;
+#else
+       /* Let's use the VLCOpenGLVoutView.m class */
+       p_vout->pf_init   = cocoaglvoutviewInit;
+       p_vout->pf_end    = cocoaglvoutviewEnd;
+       p_vout->pf_manage = cocoaglvoutviewManage;
+       p_vout->pf_control= cocoaglvoutviewControl;
+       p_vout->pf_swap   = cocoaglvoutviewSwap;
+       p_vout->pf_lock   = cocoaglvoutviewLock;
+       p_vout->pf_unlock = cocoaglvoutviewUnlock;
+#endif
+    p_vout->p_sys->b_got_frame = false;
 
     return VLC_SUCCESS;
 }
 
-void E_(CloseVideoGL) ( vlc_object_t * p_this )
+void CloseVideoGL ( vlc_object_t * p_this )
 {
     vout_thread_t * p_vout = (vout_thread_t *) p_this;
+    cocoaglvoutviewEnd( p_vout );
     /* Clean up */
     free( p_vout->p_sys );
 }