]> git.sesse.net Git - vlc/blob - plugins/sdl/sdl.c
.SDL:
[vlc] / plugins / sdl / sdl.c
1 /*****************************************************************************
2  * sdl.c : SDL plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000 VideoLAN
5  *
6  * Authors:
7  *      . Initial plugin code by Samuel Hocevar <sam@via.ecp.fr>
8  *      . Modified to use the SDL by Pierre Baillet <octplane@via.ecp.fr>
9  *      
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  * 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Preamble
27  *****************************************************************************/
28 #include "defs.h"
29
30 #include <stdlib.h>                                      /* malloc(), free() */
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 /*****************************************************************************
45  * Exported prototypes
46  *****************************************************************************/
47 static void vout_GetPlugin( p_vout_thread_t p_vout );
48 static void intf_GetPlugin( p_intf_thread_t p_intf );
49
50 #if 0
51 static void yuv_GetPlugin( p_vout_thread_t p_vout );
52 #endif
53
54 /* Video output */
55 int     vout_SDLCreate       ( vout_thread_t *p_vout, char *psz_display,
56                                int i_root_window, void *p_data );
57 int     vout_SDLInit         ( p_vout_thread_t p_vout );
58 void    vout_SDLEnd          ( p_vout_thread_t p_vout );
59 void    vout_SDLDestroy      ( p_vout_thread_t p_vout );
60 int     vout_SDLManage       ( p_vout_thread_t p_vout );
61 void    vout_SDLDisplay      ( p_vout_thread_t p_vout );
62 void    vout_SDLSetPalette   ( p_vout_thread_t p_vout,
63                                u16 *red, u16 *green, u16 *blue, u16 *transp );
64
65 #if 0
66 /* YUV transformations */
67 int     yuv_CInit          ( p_vout_thread_t p_vout );
68 int     yuv_CReset         ( p_vout_thread_t p_vout );
69 void    yuv_CEnd           ( p_vout_thread_t p_vout );
70 #endif
71
72 /* Interface */
73 int     intf_SDLCreate       ( p_intf_thread_t p_intf );
74 void    intf_SDLDestroy      ( p_intf_thread_t p_intf );
75 void    intf_SDLManage       ( p_intf_thread_t p_intf );
76
77 /*****************************************************************************
78  * GetConfig: get the plugin structure and configuration
79  *****************************************************************************/
80 plugin_info_t * GetConfig( void )
81 {
82     plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
83
84     p_info->psz_name    = "SDL (video)";
85     p_info->psz_version = VERSION;
86     p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
87
88     p_info->aout_GetPlugin = NULL;
89     p_info->vout_GetPlugin = vout_GetPlugin;
90     p_info->intf_GetPlugin = intf_GetPlugin;
91     
92     
93     /* TODO: before doing this, we have to know if the videoCard is capable of 
94      * hardware YUV -> display acceleration....
95      */
96
97 #if 0
98     p_info->yuv_GetPlugin  = (void *) yuv_GetPlugin;
99 #else
100     p_info->yuv_GetPlugin = NULL;
101 #endif
102             
103     
104     /* if the SDL libraries are there, assume we can enter the
105      * initialization part at least, even if we fail afterwards */
106     
107     p_info->i_score = 0x100;
108     
109     
110     
111     /* If this plugin was requested, score it higher */
112     if( TestMethod( VOUT_METHOD_VAR, "sdl" ) )
113     {
114         p_info->i_score += 0x200;
115     }
116
117     return( p_info );
118 }
119
120 /*****************************************************************************
121  * Following functions are only called through the p_info structure
122  *****************************************************************************/
123
124 static void vout_GetPlugin( p_vout_thread_t p_vout )
125 {
126     p_vout->p_sys_create  = vout_SDLCreate;
127     p_vout->p_sys_init    = vout_SDLInit;
128     p_vout->p_sys_end     = vout_SDLEnd;
129     p_vout->p_sys_destroy = vout_SDLDestroy;
130     p_vout->p_sys_manage  = vout_SDLManage;
131     p_vout->p_sys_display = vout_SDLDisplay;
132 }
133
134 static void intf_GetPlugin( p_intf_thread_t p_intf )
135 {
136     p_intf->p_sys_create  = intf_SDLCreate;
137     p_intf->p_sys_destroy = intf_SDLDestroy;
138     p_intf->p_sys_manage  = intf_SDLManage;
139 }
140
141 #if 0
142 static void yuv_GetPlugin( p_vout_thread_t p_vout )
143 {
144     p_vout->p_yuv_init   = yuv_CInit;
145     p_vout->p_yuv_reset  = yuv_CReset;
146     p_vout->p_yuv_end    = yuv_CEnd;
147 }
148 #endif
149