]> git.sesse.net Git - vlc/blob - modules/video_output/x11/xvideo.c
update module LIST file.
[vlc] / modules / video_output / x11 / xvideo.c
1 /*****************************************************************************
2  * xvideo.c : Xvideo plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 1998-2001 the VideoLAN team
5  * $Id$
6  *
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>
11  *
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.
16  *
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.
21  *
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 /*****************************************************************************
28  * Preamble
29  *****************************************************************************/
30
31 #ifdef HAVE_CONFIG_H
32 # include "config.h"
33 #endif
34
35 #include <vlc/vlc.h>
36
37 /*****************************************************************************
38  * Exported prototypes
39  *****************************************************************************/
40 extern int  E_(Activate)   ( vlc_object_t * );
41 extern void E_(Deactivate) ( vlc_object_t * );
42
43 /*****************************************************************************
44  * Module descriptor
45  *****************************************************************************/
46 #define ADAPTOR_TEXT N_("XVideo adaptor number")
47 #define ADAPTOR_LONGTEXT N_( \
48     "If your graphics card provides several adaptors, you need to choose " \
49     "which one will be used (you shouldn't have to change this).")
50
51 #define ALT_FS_TEXT N_("Alternate fullscreen method")
52 #define ALT_FS_LONGTEXT N_( \
53     "There are two ways to make a fullscreen window, unfortunately each one " \
54     "has its drawbacks.\n" \
55     "1) Let the window manager handle your fullscreen window (default), but " \
56     "things like taskbars will likely show on top of the video.\n" \
57     "2) Completely bypass the window manager, but then nothing will be able " \
58     "to show on top of the video.")
59
60 #define DISPLAY_TEXT N_("X11 display")
61 #define DISPLAY_LONGTEXT N_( \
62     "X11 hardware display to use. By default VLC will " \
63     "use the value of the DISPLAY environment variable.")
64
65 #define CHROMA_TEXT N_("XVimage chroma format")
66 #define CHROMA_LONGTEXT N_( \
67     "Force the XVideo renderer to use a specific chroma format instead of " \
68     "trying to improve performances by using the most efficient one.")
69
70 #define SHM_TEXT N_("Use shared memory")
71 #define SHM_LONGTEXT N_( \
72     "Use shared memory to communicate between VLC and the X server.")
73
74 #define SCREEN_TEXT N_("Screen for fullscreen mode.")
75 #define SCREEN_LONGTEXT N_( \
76     "Screen to use in fullscreen mode. For instance " \
77     "set it to 0 for first screen, 1 for the second.")
78
79 vlc_module_begin();
80     set_shortname( "XVideo" );
81     set_category( CAT_VIDEO );
82     set_subcategory( SUBCAT_VIDEO_VOUT );
83     add_string( "xvideo-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, VLC_TRUE );
84     add_integer( "xvideo-adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT, VLC_TRUE );
85     add_bool( "xvideo-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT, VLC_TRUE );
86     add_string( "xvideo-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, VLC_TRUE );
87 #ifdef HAVE_SYS_SHM_H
88     add_bool( "xvideo-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT, VLC_TRUE );
89 #endif
90 #ifdef HAVE_XINERAMA
91     add_integer ( "xvideo-xineramascreen", 0, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, VLC_TRUE );
92 #endif
93
94     set_description( _("XVideo extension video output") );
95     set_capability( "video output", 150 );
96     set_callbacks( E_(Activate), E_(Deactivate) );
97 vlc_module_end();
98
99 /* following functions are local */
100
101 #if 0
102 /*****************************************************************************
103  * XVideoSetAttribute
104  *****************************************************************************
105  * This function can be used to set attributes, e.g. XV_BRIGHTNESS and
106  * XV_CONTRAST. "f_value" should be in the range of 0 to 1.
107  *****************************************************************************/
108 static void XVideoSetAttribute( vout_thread_t *p_vout,
109                                 char *attr_name, float f_value )
110 {
111     int             i_attrib;
112     XvAttribute    *p_attrib;
113     Display        *p_display = p_vout->p_sys->p_display;
114     int             i_xvport  = p_vout->p_sys->i_xvport;
115
116     p_attrib = XvQueryPortAttributes( p_display, i_xvport, &i_attrib );
117
118     do
119     {
120         i_attrib--;
121
122         if( i_attrib >= 0 && !strcmp( p_attrib[ i_attrib ].name, attr_name ) )
123         {
124             int i_sv = f_value * ( p_attrib[ i_attrib ].max_value
125                                     - p_attrib[ i_attrib ].min_value + 1 )
126                         + p_attrib[ i_attrib ].min_value;
127
128             XvSetPortAttribute( p_display, i_xvport,
129                             XInternAtom( p_display, attr_name, False ), i_sv );
130             break;
131         }
132
133     } while( i_attrib > 0 );
134
135     if( p_attrib )
136         XFree( p_attrib );
137 }
138 #endif
139