1 /*****************************************************************************
2 * xvideo.c : Xvideo plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 1998-2001 VideoLAN
5 * $Id: xvideo.c,v 1.6 2001/12/30 07:09:56 sam Exp $
7 * Authors: Shane Harper <shanegh@optusnet.com.au>
8 * Vincent Seguin <seguin@via.ecp.fr>
9 * Samuel Hocevar <sam@zoy.org>
10 * David Kennedy <dkennedy@tinytoad.com>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
25 *****************************************************************************/
27 /*****************************************************************************
29 *****************************************************************************/
30 #include <stdlib.h> /* malloc(), free() */
31 #include <string.h> /* strerror() */
33 #include <videolan/vlc.h>
37 /*****************************************************************************
38 * Building configuration tree
39 *****************************************************************************/
41 ADD_WINDOW( "Configuration for xvideo module" )
42 ADD_COMMENT( "For now, the xvideo module cannot be configured" )
46 SET_DESCRIPTION( "XVideo extension module" )
47 ADD_CAPABILITY( VOUT, 150 )
48 ADD_SHORTCUT( "xvideo" )
52 _M( vout_getfunctions )( &p_module->p_functions->vout );
55 MODULE_DEACTIVATE_START
56 MODULE_DEACTIVATE_STOP
58 /* following functions are local */
61 /*****************************************************************************
63 *****************************************************************************
64 * This function can be used to set attributes, e.g. XV_BRIGHTNESS and
65 * XV_CONTRAST. "f_value" should be in the range of 0 to 1.
66 *****************************************************************************/
67 static void XVideoSetAttribute( vout_thread_t *p_vout,
68 char *attr_name, float f_value )
71 XvAttribute *p_attrib;
72 Display *p_display = p_vout->p_sys->p_display;
73 int i_xvport = p_vout->p_sys->i_xvport;
75 p_attrib = XvQueryPortAttributes( p_display, i_xvport, &i_attrib );
81 if( i_attrib >= 0 && !strcmp( p_attrib[ i_attrib ].name, attr_name ) )
83 int i_sv = f_value * ( p_attrib[ i_attrib ].max_value
84 - p_attrib[ i_attrib ].min_value + 1 )
85 + p_attrib[ i_attrib ].min_value;
87 XvSetPortAttribute( p_display, i_xvport,
88 XInternAtom( p_display, attr_name, False ), i_sv );
92 } while( i_attrib > 0 );