]> git.sesse.net Git - vlc/blob - plugins/gnome/gnome.c
. autod�tection des plugins
[vlc] / plugins / gnome / gnome.c
1 /*****************************************************************************
2  * gnome.c : Gnome plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000 VideoLAN
5  *
6  * Authors:
7  *
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.
12  * 
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.
17  *
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  *****************************************************************************/
22
23 /*****************************************************************************
24  * Preamble
25  *****************************************************************************/
26 #include "defs.h"
27
28 #include <stdlib.h>                                      /* malloc(), free() */
29
30 #include <X11/Xlib.h>
31
32 #include "config.h"
33 #include "common.h"                                     /* boolean_t, byte_t */
34 #include "threads.h"
35 #include "mtime.h"
36 #include "tests.h"
37 #include "plugins.h"
38
39 #include "interface.h"
40 #include "audio_output.h"
41 #include "video.h"
42 #include "video_output.h"
43
44 #include "main.h"
45
46 /*****************************************************************************
47  * Exported prototypes
48  *****************************************************************************/
49 static void vout_GetPlugin( p_vout_thread_t p_vout );
50 static void intf_GetPlugin( p_intf_thread_t p_intf );
51
52 /* Video output */
53 int     vout_GnomeCreate       ( vout_thread_t *p_vout, char *psz_display,
54                                  int i_root_window, void *p_data );
55 int     vout_GnomeInit         ( p_vout_thread_t p_vout );
56 void    vout_GnomeEnd          ( p_vout_thread_t p_vout );
57 void    vout_GnomeDestroy      ( p_vout_thread_t p_vout );
58 int     vout_GnomeManage       ( p_vout_thread_t p_vout );
59 void    vout_GnomeDisplay      ( p_vout_thread_t p_vout );
60 void    vout_GnomeSetPalette   ( p_vout_thread_t p_vout, u16 *red,
61                                  u16 *green, u16 *blue, u16 *transp );
62
63 /* Interface */
64 int     intf_GnomeCreate       ( p_intf_thread_t p_intf );
65 void    intf_GnomeDestroy      ( p_intf_thread_t p_intf );
66 void    intf_GnomeManage       ( p_intf_thread_t p_intf );
67
68 /*****************************************************************************
69  * GetConfig: get the plugin structure and configuration
70  *****************************************************************************/
71 plugin_info_t * GetConfig( void )
72 {
73     Display *p_display;
74     plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
75
76     p_info->psz_name    = "Gnome";
77     p_info->psz_version = VERSION;
78     p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
79
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;
84
85     /* Check that we can open the X display */
86     if( (p_display = XOpenDisplay( XDisplayName(
87                          main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) ) ))
88         == NULL )
89     {
90         p_info->i_score = 0;
91     }
92     else
93     {
94         XCloseDisplay( p_display );
95         p_info->i_score = 0x200;
96     }
97
98     if( TestProgram( "gvlc" ) )
99     {
100         p_info->i_score += 0x180;
101     }
102
103     /* If this plugin was requested, score it higher */
104     if( TestMethod( VOUT_METHOD_VAR, "gnome" ) )
105     {
106         p_info->i_score += 0x200;
107     }
108
109     return( p_info );
110 }
111
112 /*****************************************************************************
113  * Following functions are only called through the p_info structure
114  *****************************************************************************/
115
116 static void vout_GetPlugin( p_vout_thread_t p_vout )
117 {
118     p_vout->p_sys_create  = vout_GnomeCreate;
119     p_vout->p_sys_init    = vout_GnomeInit;
120     p_vout->p_sys_end     = vout_GnomeEnd;
121     p_vout->p_sys_destroy = vout_GnomeDestroy;
122     p_vout->p_sys_manage  = vout_GnomeManage;
123     p_vout->p_sys_display = vout_GnomeDisplay;
124
125     /* optional functions */
126     p_vout->p_set_palette = vout_GnomeSetPalette;
127 }
128
129 static void intf_GetPlugin( p_intf_thread_t p_intf )
130 {
131     p_intf->p_sys_create  = intf_GnomeCreate;
132     p_intf->p_sys_destroy = intf_GnomeDestroy;
133     p_intf->p_sys_manage  = intf_GnomeManage;
134 }
135