1 /*****************************************************************************
2 * voutgl.m: MacOS X OpenGL provider
3 *****************************************************************************
4 * Copyright (C) 2001-2007 the VideoLAN team
7 * Authors: Colin Delacroix <colin@zoy.org>
8 * Florian G. Pflug <fgp@phlo.org>
9 * Jon Lech Johansen <jon-vl@nanocrew.net>
10 * Derk-Jan Hartman <hartman at videolan dot org>
11 * Eric Petit <titer@m0k.org>
12 * Benjamin Pracht <bigben at videolan dot org>
13 * Damien Fouilleul <damienf at videolan dot org>
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
28 *****************************************************************************/
30 /*****************************************************************************
32 *****************************************************************************/
36 int OpenVideoGL ( vlc_object_t * p_this )
38 vout_thread_t * p_vout = (vout_thread_t *) p_this;
42 if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) )
44 msg_Warn( p_vout, "No OpenGL hardware acceleration found. "
45 "Video display will be slow" );
49 msg_Dbg( p_vout, "display is Quartz Extreme accelerated" );
51 p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
52 if( p_vout->p_sys == NULL )
55 memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
57 i_drawable_agl = var_GetInteger( p_vout->p_libvlc, "drawable-agl" );
58 i_drawable_gl = var_GetInteger( p_vout->p_libvlc, "drawable-gl" );
60 /* Are we in the mozilla plugin, which isn't 64bit compatible ? */
62 if( i_drawable_agl > 0 )
64 p_vout->pf_init = aglInit;
65 p_vout->pf_end = aglEnd;
66 p_vout->pf_manage = aglManage;
67 p_vout->pf_control = aglControl;
68 p_vout->pf_swap = aglSwap;
69 p_vout->pf_lock = aglLock;
70 p_vout->pf_unlock = aglUnlock;
72 else /*if( i_drawable_gl > 0 )*/
74 /* Let's use the VLCOpenGLVoutView.m class */
75 p_vout->pf_init = cocoaglvoutviewInit;
76 p_vout->pf_end = cocoaglvoutviewEnd;
77 p_vout->pf_manage = cocoaglvoutviewManage;
78 p_vout->pf_control= cocoaglvoutviewControl;
79 p_vout->pf_swap = cocoaglvoutviewSwap;
80 p_vout->pf_lock = cocoaglvoutviewLock;
81 p_vout->pf_unlock = cocoaglvoutviewUnlock;
84 /* Let's use the VLCOpenGLVoutView.m class */
85 p_vout->pf_init = cocoaglvoutviewInit;
86 p_vout->pf_end = cocoaglvoutviewEnd;
87 p_vout->pf_manage = cocoaglvoutviewManage;
88 p_vout->pf_control= cocoaglvoutviewControl;
89 p_vout->pf_swap = cocoaglvoutviewSwap;
90 p_vout->pf_lock = cocoaglvoutviewLock;
91 p_vout->pf_unlock = cocoaglvoutviewUnlock;
93 p_vout->p_sys->b_got_frame = false;
98 void CloseVideoGL ( vlc_object_t * p_this )
100 vout_thread_t * p_vout = (vout_thread_t *) p_this;
101 cocoaglvoutviewEnd( p_vout );
103 free( p_vout->p_sys );