1 /*****************************************************************************
2 * filter_common.h: Common filter functions
3 *****************************************************************************
4 * Copyright (C) 2001, 2002, 2003 VideoLAN
5 * $Id: filter_common.h,v 1.2 2003/01/17 16:18:03 sam Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
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.
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.
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 *****************************************************************************/
24 #define ALLOCATE_DIRECTBUFFERS( i_max ) \
25 /* Try to initialize i_max direct buffers */ \
26 while( I_OUTPUTPICTURES < ( i_max ) ) \
30 /* Find an empty picture slot */ \
31 for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ ) \
33 if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE ) \
35 p_pic = p_vout->p_picture + i_index; \
45 /* Allocate the picture */ \
46 vout_AllocatePicture( p_vout, p_pic, \
47 p_vout->output.i_width, \
48 p_vout->output.i_height, \
49 p_vout->output.i_chroma ); \
51 if( !p_pic->i_planes ) \
56 p_pic->i_status = DESTROYED_PICTURE; \
57 p_pic->i_type = DIRECT_PICTURE; \
59 PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic; \
64 #define ADD_CALLBACKS( newvout, handler ) \
65 var_AddCallback( newvout, "mouse-x", SendEvents, p_vout ); \
66 var_AddCallback( newvout, "mouse-y", SendEvents, p_vout ); \
67 var_AddCallback( newvout, "mouse-moved", SendEvents, p_vout ); \
68 var_AddCallback( newvout, "mouse-clicked", SendEvents, p_vout ); \
69 var_AddCallback( newvout, "key-pressed", SendEvents, p_vout )
71 #define DEL_CALLBACKS( newvout, handler ) \
72 var_DelCallback( newvout, "mouse-x", SendEvents, p_vout ); \
73 var_DelCallback( newvout, "mouse-y", SendEvents, p_vout ); \
74 var_DelCallback( newvout, "mouse-moved", SendEvents, p_vout ); \
75 var_DelCallback( newvout, "mouse-clicked", SendEvents, p_vout ); \
76 var_DelCallback( newvout, "key-pressed", SendEvents, p_vout )