]> git.sesse.net Git - vlc/blob - plugins/glide/glide.c
. autod�tection des plugins
[vlc] / plugins / glide / glide.c
1 /*****************************************************************************
2  * glide.c : 3dfx Glide 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 #ifndef __linux__
31 #include <conio.h>                                            /* for glide ? */
32 #endif
33 #include <glide.h>
34
35 #include "config.h"
36 #include "common.h"                                     /* boolean_t, byte_t */
37 #include "threads.h"
38 #include "mtime.h"
39 #include "tests.h"
40 #include "plugins.h"
41
42 #include "interface.h"
43 #include "audio_output.h"
44 #include "video.h"
45 #include "video_output.h"
46
47 /*****************************************************************************
48  * Exported prototypes
49  *****************************************************************************/
50 static void vout_GetPlugin( p_vout_thread_t p_vout );
51 static void intf_GetPlugin( p_intf_thread_t p_intf );
52
53 /* Video output */
54 int     vout_GlideCreate       ( vout_thread_t *p_vout, char *psz_display,
55                                  int i_root_window, void *p_data );
56 int     vout_GlideInit         ( p_vout_thread_t p_vout );
57 void    vout_GlideEnd          ( p_vout_thread_t p_vout );
58 void    vout_GlideDestroy      ( p_vout_thread_t p_vout );
59 int     vout_GlideManage       ( p_vout_thread_t p_vout );
60 void    vout_GlideDisplay      ( p_vout_thread_t p_vout );
61 void    vout_GlideSetPalette   ( p_vout_thread_t p_vout,
62                                  u16 *red, u16 *green, u16 *blue, u16 *transp );
63
64 /* Interface */
65 int     intf_GlideCreate       ( p_intf_thread_t p_intf );
66 void    intf_GlideDestroy      ( p_intf_thread_t p_intf );
67 void    intf_GlideManage       ( p_intf_thread_t p_intf );
68
69 /*****************************************************************************
70  * GetConfig: get the plugin structure and configuration
71  *****************************************************************************/
72 plugin_info_t * GetConfig( void )
73 {
74     plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
75
76     p_info->psz_name    = "3dfx Glide";
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     /* We could do a grSstQueryBoards( GrHwConfiguration *hwConfig ) at
86      * this point, but if the user didn't configure his 3dfx card, we
87      * have great chances to segfault here. So we'd better assume
88      * everything is fine and worry only if we really need to use Glide */
89     p_info->i_score = 0x100;
90
91     if( TestProgram( "glidevlc" ) )
92     {
93         p_info->i_score += 0x180;
94     }
95
96     /* If this plugin was requested, score it higher */
97     if( TestMethod( VOUT_METHOD_VAR, "glide" ) )
98     {
99         p_info->i_score += 0x200;
100     }
101
102     return( p_info );
103 }
104
105 /*****************************************************************************
106  * Following functions are only called through the p_info structure
107  *****************************************************************************/
108
109 static void vout_GetPlugin( p_vout_thread_t p_vout )
110 {
111     p_vout->p_sys_create  = vout_GlideCreate;
112     p_vout->p_sys_init    = vout_GlideInit;
113     p_vout->p_sys_end     = vout_GlideEnd;
114     p_vout->p_sys_destroy = vout_GlideDestroy;
115     p_vout->p_sys_manage  = vout_GlideManage;
116     p_vout->p_sys_display = vout_GlideDisplay;
117 }
118
119 static void intf_GetPlugin( p_intf_thread_t p_intf )
120 {
121     p_intf->p_sys_create  = intf_GlideCreate;
122     p_intf->p_sys_destroy = intf_GlideDestroy;
123     p_intf->p_sys_manage  = intf_GlideManage;
124 }
125