voutgl.m 3.25 KB
Newer Older
1 2 3
/*****************************************************************************
 * voutgl.m: MacOS X OpenGL provider
 *****************************************************************************
4
 * Copyright (C) 2001-2007 the VideoLAN team
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
 * $Id$
 *
 * Authors: Colin Delacroix <colin@zoy.org>
 *          Florian G. Pflug <fgp@phlo.org>
 *          Jon Lech Johansen <jon-vl@nanocrew.net>
 *          Derk-Jan Hartman <hartman at videolan dot org>
 *          Eric Petit <titer@m0k.org>
 *          Benjamin Pracht <bigben at videolan dot org>
 *          Damien Fouilleul <damienf at videolan dot org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#include "intf.h"
#include "voutgl.h"

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
36
int OpenVideoGL  ( vlc_object_t * p_this )
37 38 39 40 41 42
{
    vout_thread_t * p_vout = (vout_thread_t *) p_this;
    vlc_value_t value_drawable;

    if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) )
    {
43
        msg_Warn( p_vout, "No OpenGL hardware acceleration found. "
44 45 46 47 48 49 50 51 52 53 54 55 56
                          "Video display will be slow" );
        return( 1 );
    }

    msg_Dbg( p_vout, "display is Quartz Extreme accelerated" );

    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
    if( p_vout->p_sys == NULL )
        return( 1 );

    memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );

    var_Get( p_vout->p_libvlc, "drawable", &value_drawable );
57
 
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
    if( 0 /* Are we in the mozilla plugin ? XXX: get that from drawable */ )
    {
        p_vout->pf_init             = aglInit;
        p_vout->pf_end              = aglEnd;
        p_vout->pf_manage           = aglManage;
        p_vout->pf_control          = aglControl;
        p_vout->pf_swap             = aglSwap;
        p_vout->pf_lock             = aglLock;
        p_vout->pf_unlock           = aglUnlock;
    }
    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;
    }
79
    p_vout->p_sys->b_got_frame = false;
80 81 82 83

    return VLC_SUCCESS;
}

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
84
void CloseVideoGL ( vlc_object_t * p_this )
85 86 87 88 89
{
    vout_thread_t * p_vout = (vout_thread_t *) p_this;
    /* Clean up */
    free( p_vout->p_sys );
}