filter_common.h
上传用户:riyaled888
上传日期:2009-03-27
资源大小:7338k
文件大小:6k
源码类别:

多媒体

开发平台:

MultiPlatform

  1. /*****************************************************************************
  2.  * filter_common.h: Common filter functions
  3.  *****************************************************************************
  4.  * Copyright (C) 2001, 2002, 2003 VideoLAN
  5.  * $Id: filter_common.h 8171 2004-07-12 06:42:47Z zorglub $
  6.  *
  7.  * Authors: Samuel Hocevar <sam@zoy.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  22.  *****************************************************************************/
  23. #define ALLOCATE_DIRECTBUFFERS( i_max ) 
  24.     /* Try to initialize i_max direct buffers */                              
  25.     while( I_OUTPUTPICTURES < ( i_max ) )                                     
  26.     {                                                                         
  27.         p_pic = NULL;                                                         
  28.                                                                               
  29.         /* Find an empty picture slot */                                      
  30.         for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )          
  31.         {                                                                     
  32.             if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )       
  33.             {                                                                 
  34.                 p_pic = p_vout->p_picture + i_index;                          
  35.                 break;                                                        
  36.             }                                                                 
  37.         }                                                                     
  38.                                                                               
  39.         if( p_pic == NULL )                                                   
  40.         {                                                                     
  41.             break;                                                            
  42.         }                                                                     
  43.                                                                               
  44.         /* Allocate the picture */                                            
  45.         vout_AllocatePicture( VLC_OBJECT(p_vout), p_pic, p_vout->output.i_chroma, 
  46.                               p_vout->output.i_width,                         
  47.                               p_vout->output.i_height,                        
  48.                               p_vout->output.i_aspect );                      
  49.                                                                               
  50.         if( !p_pic->i_planes )                                                
  51.         {                                                                     
  52.             break;                                                            
  53.         }                                                                     
  54.                                                                               
  55.         p_pic->i_status = DESTROYED_PICTURE;                                  
  56.         p_pic->i_type   = DIRECT_PICTURE;                                     
  57.                                                                               
  58.         PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;                         
  59.                                                                               
  60.         I_OUTPUTPICTURES++;                                                   
  61.     }                                                                         
  62. /*****************************************************************************
  63.  * SetParentVal: forward variable value to parent whithout triggering the
  64.  *               callback
  65.  *****************************************************************************/
  66. static int SetParentVal( vlc_object_t *p_this, char const *psz_var,
  67.                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
  68. {
  69.     var_Change( (vlc_object_t *)p_data, psz_var, VLC_VAR_SETVALUE,
  70.                  &newval, NULL );
  71.     return VLC_SUCCESS;
  72. }
  73. #define ADD_CALLBACKS( newvout, handler ) 
  74.     var_AddCallback( newvout, "fullscreen", SetParentVal, p_vout );           
  75.     var_AddCallback( newvout, "mouse-x", SendEvents, p_vout );                
  76.     var_AddCallback( newvout, "mouse-y", SendEvents, p_vout );                
  77.     var_AddCallback( newvout, "mouse-moved", SendEvents, p_vout );            
  78.     var_AddCallback( newvout, "mouse-clicked", SendEvents, p_vout );
  79. #define DEL_CALLBACKS( newvout, handler ) 
  80.     var_DelCallback( newvout, "fullscreen", SetParentVal, p_vout );           
  81.     var_DelCallback( newvout, "mouse-x", SendEvents, p_vout );                
  82.     var_DelCallback( newvout, "mouse-y", SendEvents, p_vout );                
  83.     var_DelCallback( newvout, "mouse-moved", SendEvents, p_vout );            
  84.     var_DelCallback( newvout, "mouse-clicked", SendEvents, p_vout );
  85. #define ADD_PARENT_CALLBACKS( handler ) 
  86.     var_AddCallback( p_vout, "fullscreen", handler, NULL );                   
  87.     var_AddCallback( p_vout, "aspect-ratio", handler, NULL );                 
  88.     var_AddCallback( p_vout, "crop", handler, NULL );
  89. #define DEL_PARENT_CALLBACKS( handler ) 
  90.     var_DelCallback( p_vout, "fullscreen", handler, NULL );                   
  91.     var_DelCallback( p_vout, "aspect-ratio", handler, NULL );                 
  92.     var_DelCallback( p_vout, "crop", handler, NULL );
  93. static int  SendEventsToChild( vlc_object_t *, char const *,
  94.                                vlc_value_t, vlc_value_t, void * );