1 /*****************************************************************************
2 * sdl.c : SDL plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000 VideoLAN
7 * . Initial plugin code by Samuel Hocevar <sam@via.ecp.fr>
8 * . Modified to use the SDL by Pierre Baillet <octplane@via.ecp.fr>
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.
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.
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 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
30 #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"
44 /*****************************************************************************
46 *****************************************************************************/
47 static void vout_GetPlugin( p_vout_thread_t p_vout );
48 static void intf_GetPlugin( p_intf_thread_t p_intf );
51 static void yuv_GetPlugin( p_vout_thread_t p_vout );
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 );
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 );
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 );
77 /*****************************************************************************
78 * GetConfig: get the plugin structure and configuration
79 *****************************************************************************/
80 plugin_info_t * GetConfig( void )
82 plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
84 p_info->psz_name = "SDL (video)";
85 p_info->psz_version = VERSION;
86 p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
88 p_info->aout_GetPlugin = NULL;
89 p_info->vout_GetPlugin = vout_GetPlugin;
90 p_info->intf_GetPlugin = intf_GetPlugin;
93 /* TODO: before doing this, we have to know if the videoCard is capable of
94 * hardware YUV -> display acceleration....
98 p_info->yuv_GetPlugin = (void *) yuv_GetPlugin;
100 p_info->yuv_GetPlugin = NULL;
104 /* if the SDL libraries are there, assume we can enter the
105 * initialization part at least, even if we fail afterwards */
107 p_info->i_score = 0x100;
109 /* If this plugin was requested, score it higher */
110 if( TestMethod( VOUT_METHOD_VAR, "sdl" ) )
112 p_info->i_score += 0x200;
118 /*****************************************************************************
119 * Following functions are only called through the p_info structure
120 *****************************************************************************/
122 static void vout_GetPlugin( p_vout_thread_t p_vout )
124 p_vout->p_sys_create = vout_SDLCreate;
125 p_vout->p_sys_init = vout_SDLInit;
126 p_vout->p_sys_end = vout_SDLEnd;
127 p_vout->p_sys_destroy = vout_SDLDestroy;
128 p_vout->p_sys_manage = vout_SDLManage;
129 p_vout->p_sys_display = vout_SDLDisplay;
132 static void intf_GetPlugin( p_intf_thread_t p_intf )
134 p_intf->p_sys_create = intf_SDLCreate;
135 p_intf->p_sys_destroy = intf_SDLDestroy;
136 p_intf->p_sys_manage = intf_SDLManage;
140 static void yuv_GetPlugin( p_vout_thread_t p_vout )
142 p_vout->p_yuv_init = yuv_CInit;
143 p_vout->p_yuv_reset = yuv_CReset;
144 p_vout->p_yuv_end = yuv_CEnd;