1 /*****************************************************************************
2 * x11.c : X11 plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000 VideoLAN
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 /*****************************************************************************
25 *****************************************************************************/
28 #include <stdlib.h> /* malloc(), free() */
33 #include "common.h" /* boolean_t, byte_t */
39 #include "interface.h"
40 #include "audio_output.h"
42 #include "video_output.h"
46 /*****************************************************************************
48 *****************************************************************************/
49 static void vout_GetPlugin( p_vout_thread_t p_vout );
50 static void intf_GetPlugin( p_intf_thread_t p_intf );
53 int vout_X11Create ( vout_thread_t *p_vout, char *psz_display,
54 int i_root_window, void *p_data );
55 int vout_X11Init ( p_vout_thread_t p_vout );
56 void vout_X11End ( p_vout_thread_t p_vout );
57 void vout_X11Destroy ( p_vout_thread_t p_vout );
58 int vout_X11Manage ( p_vout_thread_t p_vout );
59 void vout_X11Display ( p_vout_thread_t p_vout );
60 void vout_X11SetPalette ( p_vout_thread_t p_vout,
61 u16 *red, u16 *green, u16 *blue, u16 *transp );
64 int intf_X11Create ( p_intf_thread_t p_intf );
65 void intf_X11Destroy ( p_intf_thread_t p_intf );
66 void intf_X11Manage ( p_intf_thread_t p_intf );
68 /*****************************************************************************
69 * GetConfig: get the plugin structure and configuration
70 *****************************************************************************/
71 plugin_info_t * GetConfig( void )
74 plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
76 p_info->psz_name = "X Window System";
77 p_info->psz_version = VERSION;
78 p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
80 p_info->aout_GetPlugin = NULL;
81 p_info->vout_GetPlugin = vout_GetPlugin;
82 p_info->intf_GetPlugin = intf_GetPlugin;
83 p_info->yuv_GetPlugin = NULL;
85 /* check that we can open the X display */
86 if( (p_display = XOpenDisplay( XDisplayName(
87 main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) ) ))
90 p_info->i_score = 0x0;
94 XCloseDisplay( p_display );
95 p_info->i_score = 0x200;
98 if( TestProgram( "xvlc" ) )
100 p_info->i_score += 0x180;
103 /* If this plugin was requested, score it higher */
104 if( TestMethod( VOUT_METHOD_VAR, "x11" ) )
106 p_info->i_score += 0x200;
112 /*****************************************************************************
113 * Following functions are only called through the p_info structure
114 *****************************************************************************/
116 static void vout_GetPlugin( p_vout_thread_t p_vout )
118 p_vout->p_sys_create = vout_X11Create;
119 p_vout->p_sys_init = vout_X11Init;
120 p_vout->p_sys_end = vout_X11End;
121 p_vout->p_sys_destroy = vout_X11Destroy;
122 p_vout->p_sys_manage = vout_X11Manage;
123 p_vout->p_sys_display = vout_X11Display;
125 /* optional functions */
126 p_vout->p_set_palette = vout_X11SetPalette;
129 static void intf_GetPlugin( p_intf_thread_t p_intf )
131 p_intf->p_sys_create = intf_X11Create;
132 p_intf->p_sys_destroy = intf_X11Destroy;
133 p_intf->p_sys_manage = intf_X11Manage;