Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

xvideo.c

00001 /*****************************************************************************
00002  * xvideo.c : Xvideo plugin for vlc
00003  *****************************************************************************
00004  * Copyright (C) 1998-2001 the VideoLAN team
00005  * $Id: xvideo.c 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Shane Harper <[email protected]>
00008  *          Vincent Seguin <[email protected]>
00009  *          Samuel Hocevar <[email protected]>
00010  *          David Kennedy <[email protected]>
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00025  *****************************************************************************/
00026 
00027 /*****************************************************************************
00028  * Preamble
00029  *****************************************************************************/
00030 #include <stdlib.h>                                      /* malloc(), free() */
00031 #include <string.h>                                            /* strerror() */
00032 
00033 #include <vlc/vlc.h>
00034 
00035 /*****************************************************************************
00036  * Exported prototypes
00037  *****************************************************************************/
00038 extern int  E_(Activate)   ( vlc_object_t * );
00039 extern void E_(Deactivate) ( vlc_object_t * );
00040 
00041 /*****************************************************************************
00042  * Module descriptor
00043  *****************************************************************************/
00044 #define ADAPTOR_TEXT N_("XVideo adaptor number")
00045 #define ADAPTOR_LONGTEXT N_( \
00046     "If you graphics card provides several adaptors, this option allows you " \
00047     "to choose which one will be used (you shouldn't have to change this).")
00048 
00049 #define ALT_FS_TEXT N_("Alternate fullscreen method")
00050 #define ALT_FS_LONGTEXT N_( \
00051     "There are two ways to make a fullscreen window, unfortunately each one " \
00052     "has its drawbacks.\n" \
00053     "1) Let the window manager handle your fullscreen window (default), but " \
00054     "things like taskbars will likely show on top of the video.\n" \
00055     "2) Completely bypass the window manager, but then nothing will be able " \
00056     "to show on top of the video.")
00057 
00058 #define DISPLAY_TEXT N_("X11 display name")
00059 #define DISPLAY_LONGTEXT N_( \
00060     "Specify the X11 hardware display you want to use. By default VLC will " \
00061     "use the value of the DISPLAY environment variable.")
00062 
00063 #define CHROMA_TEXT N_("XVimage chroma format")
00064 #define CHROMA_LONGTEXT N_( \
00065     "Force the XVideo renderer to use a specific chroma format instead of " \
00066     "trying to improve performances by using the most efficient one.")
00067 
00068 #define SHM_TEXT N_("Use shared memory")
00069 #define SHM_LONGTEXT N_( \
00070     "Use shared memory to communicate between VLC and the X server.")
00071 
00072 #define SCREEN_TEXT N_("Screen to be used for fullscreen mode.")
00073 #define SCREEN_LONGTEXT N_( \
00074     "Choose the screen you want to use in fullscreen mode. For instance " \
00075     "set it to 0 for first screen, 1 for the second.")
00076 
00077 vlc_module_begin();
00078     set_shortname( "XVideo" );
00079     set_category( CAT_VIDEO );
00080     set_subcategory( SUBCAT_VIDEO_VOUT );
00081     add_string( "xvideo-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT, VLC_TRUE );
00082     add_integer( "xvideo-adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT, VLC_TRUE );
00083     add_bool( "xvideo-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT, VLC_TRUE );
00084     add_string( "xvideo-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT, VLC_TRUE );
00085 #ifdef HAVE_SYS_SHM_H
00086     add_bool( "xvideo-shm", 1, NULL, SHM_TEXT, SHM_LONGTEXT, VLC_TRUE );
00087 #endif
00088 #ifdef HAVE_XINERAMA
00089     add_integer ( "xvideo-xineramascreen", 0, NULL, SCREEN_TEXT, SCREEN_LONGTEXT, VLC_TRUE );
00090 #endif
00091 
00092     set_description( _("XVideo extension video output") );
00093     set_capability( "video output", 150 );
00094     set_callbacks( E_(Activate), E_(Deactivate) );
00095 vlc_module_end();
00096 
00097 /* following functions are local */
00098 
00099 #if 0
00100 /*****************************************************************************
00101  * XVideoSetAttribute
00102  *****************************************************************************
00103  * This function can be used to set attributes, e.g. XV_BRIGHTNESS and
00104  * XV_CONTRAST. "f_value" should be in the range of 0 to 1.
00105  *****************************************************************************/
00106 static void XVideoSetAttribute( vout_thread_t *p_vout,
00107                                 char *attr_name, float f_value )
00108 {
00109     int             i_attrib;
00110     XvAttribute    *p_attrib;
00111     Display        *p_display = p_vout->p_sys->p_display;
00112     int             i_xvport  = p_vout->p_sys->i_xvport;
00113 
00114     p_attrib = XvQueryPortAttributes( p_display, i_xvport, &i_attrib );
00115 
00116     do
00117     {
00118         i_attrib--;
00119 
00120         if( i_attrib >= 0 && !strcmp( p_attrib[ i_attrib ].name, attr_name ) )
00121         {
00122             int i_sv = f_value * ( p_attrib[ i_attrib ].max_value
00123                                     - p_attrib[ i_attrib ].min_value + 1 )
00124                         + p_attrib[ i_attrib ].min_value;
00125 
00126             XvSetPortAttribute( p_display, i_xvport,
00127                             XInternAtom( p_display, attr_name, False ), i_sv );
00128             break;
00129         }
00130 
00131     } while( i_attrib > 0 );
00132 
00133     if( p_attrib )
00134         XFree( p_attrib );
00135 }
00136 #endif
00137 

Generated on Tue Dec 20 10:14:56 2005 for vlc-0.8.4a by  doxygen 1.4.2