voutgl.m
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:4k
源码类别:

midi

开发平台:

Unix_Linux

  1. /*****************************************************************************
  2.  * voutgl.m: MacOS X OpenGL provider
  3.  *****************************************************************************
  4.  * Copyright (C) 2001-2007 the VideoLAN team
  5.  * $Id: 2fd0f41a545b721cfeccab49df4740218576cde4 $
  6.  *
  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>
  14.  *
  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.
  19.  *
  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.
  24.  *
  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.  *****************************************************************************/
  29. /*****************************************************************************
  30.  * Preamble
  31.  *****************************************************************************/
  32. #include "intf.h"
  33. #include "voutgl.h"
  34. int OpenVideoGL  ( vlc_object_t * p_this )
  35. {
  36.     vout_thread_t * p_vout = (vout_thread_t *) p_this;
  37.     int i_drawable_agl;
  38.     int i_drawable_gl;
  39.     if( !CGDisplayUsesOpenGLAcceleration( kCGDirectMainDisplay ) )
  40.     {
  41.         msg_Warn( p_vout, "No OpenGL hardware acceleration found. "
  42.                           "Video display will be slow" );
  43.         return( 1 );
  44.     }
  45.     msg_Dbg( p_vout, "display is Quartz Extreme accelerated" );
  46.     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
  47.     if( p_vout->p_sys == NULL )
  48.         return( 1 );
  49.     memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
  50.     i_drawable_agl = var_GetInteger( p_vout->p_libvlc, "drawable-agl" );
  51.     i_drawable_gl = var_GetInteger( p_vout->p_libvlc, "drawable-gl" );
  52.     /* Are we in the mozilla plugin, which isn't 64bit compatible ? */
  53. #ifndef __x86_64__
  54.     if( i_drawable_agl > 0 )
  55.     {
  56.         p_vout->pf_init             = aglInit;
  57.         p_vout->pf_end              = aglEnd;
  58.         p_vout->pf_manage           = aglManage;
  59.         p_vout->pf_control          = aglControl;
  60.         p_vout->pf_swap             = aglSwap;
  61.         p_vout->pf_lock             = aglLock;
  62.         p_vout->pf_unlock           = aglUnlock;
  63.     }
  64.     else /*if( i_drawable_gl > 0 )*/
  65.     {
  66.         /* Let's use the VLCOpenGLVoutView.m class */
  67.         p_vout->pf_init   = cocoaglvoutviewInit;
  68.         p_vout->pf_end    = cocoaglvoutviewEnd;
  69.         p_vout->pf_manage = cocoaglvoutviewManage;
  70.         p_vout->pf_control= cocoaglvoutviewControl;
  71.         p_vout->pf_swap   = cocoaglvoutviewSwap;
  72.         p_vout->pf_lock   = cocoaglvoutviewLock;
  73.         p_vout->pf_unlock = cocoaglvoutviewUnlock;
  74.     }
  75. #else
  76. /* Let's use the VLCOpenGLVoutView.m class */
  77. p_vout->pf_init   = cocoaglvoutviewInit;
  78. p_vout->pf_end    = cocoaglvoutviewEnd;
  79. p_vout->pf_manage = cocoaglvoutviewManage;
  80. p_vout->pf_control= cocoaglvoutviewControl;
  81. p_vout->pf_swap   = cocoaglvoutviewSwap;
  82. p_vout->pf_lock   = cocoaglvoutviewLock;
  83. p_vout->pf_unlock = cocoaglvoutviewUnlock;
  84. #endif
  85.     p_vout->p_sys->b_got_frame = false;
  86.     return VLC_SUCCESS;
  87. }
  88. void CloseVideoGL ( vlc_object_t * p_this )
  89. {
  90.     vout_thread_t * p_vout = (vout_thread_t *) p_this;
  91.     /* Clean up */
  92.     free( p_vout->p_sys );
  93. }