x11.c 3.36 KB
Newer Older
1 2 3
/*****************************************************************************
 * x11.c : X11 plugin for vlc
 *****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
4
 * Copyright (C) 1998-2001 VideoLAN
Sam Hocevar's avatar
 
Sam Hocevar committed
5
 * $Id: x11.c,v 1.11 2002/02/19 00:50:19 sam Exp $
6
 *
Sam Hocevar's avatar
 
Sam Hocevar committed
7 8 9
 * Authors: Vincent Seguin <seguin@via.ecp.fr>
 *          Samuel Hocevar <sam@zoy.org>
 *          David Kennedy <dkennedy@tinytoad.com>
10
 *      
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#include <stdlib.h>                                      /* malloc(), free() */
Sam Hocevar's avatar
 
Sam Hocevar committed
30
#include <string.h>                                            /* strerror() */
31

Sam Hocevar's avatar
 
Sam Hocevar committed
32
#include <videolan/vlc.h>
33

Sam Hocevar's avatar
 
Sam Hocevar committed
34
#include "xcommon.h"
35 36

/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
37
 * Building configuration tree
38
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
39
MODULE_CONFIG_START
Sam Hocevar's avatar
 
Sam Hocevar committed
40 41
    ADD_WINDOW( "Configuration for X11 module" )
        ADD_COMMENT( "For now, the X11 module cannot be configured" )
Sam Hocevar's avatar
 
Sam Hocevar committed
42
MODULE_CONFIG_STOP
43

Sam Hocevar's avatar
 
Sam Hocevar committed
44
MODULE_INIT_START
Sam Hocevar's avatar
 
Sam Hocevar committed
45 46 47
    SET_DESCRIPTION( "X11 module" )
    ADD_CAPABILITY( VOUT, 50 )
    ADD_SHORTCUT( "x11" )
Sam Hocevar's avatar
 
Sam Hocevar committed
48
MODULE_INIT_STOP
49

Sam Hocevar's avatar
 
Sam Hocevar committed
50
MODULE_ACTIVATE_START
Sam Hocevar's avatar
 
Sam Hocevar committed
51
    _M( vout_getfunctions )( &p_module->p_functions->vout );
Sam Hocevar's avatar
 
Sam Hocevar committed
52
MODULE_ACTIVATE_STOP
53

Sam Hocevar's avatar
 
Sam Hocevar committed
54 55
MODULE_DEACTIVATE_START
MODULE_DEACTIVATE_STOP
56

Sam Hocevar's avatar
 
Sam Hocevar committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
#if 0
/*****************************************************************************
 * vout_SetPalette: sets an 8 bpp palette
 *****************************************************************************
 * This function sets the palette given as an argument. It does not return
 * anything, but could later send information on which colors it was unable
 * to set.
 *****************************************************************************/
static void vout_SetPalette( p_vout_thread_t p_vout,
                             u16 *red, u16 *green, u16 *blue, u16 *transp )
{
    int i, j;
    XColor p_colors[255];

    /* allocate palette */
    for( i = 0, j = 255; i < 255; i++, j-- )
    {
        /* kludge: colors are indexed reversely because color 255 seems
         * to be reserved for black even if we try to set it to white */
        p_colors[ i ].pixel = j;
        p_colors[ i ].pad   = 0;
        p_colors[ i ].flags = DoRed | DoGreen | DoBlue;
        p_colors[ i ].red   = red[ j ];
        p_colors[ i ].blue  = blue[ j ];
        p_colors[ i ].green = green[ j ];
    }

    XStoreColors( p_vout->p_sys->p_display,
                  p_vout->p_sys->colormap, p_colors, 256 );
}
#endif