]> git.sesse.net Git - vlc/blob - plugins/sdl/sdl.c
My first contribution.
[vlc] / plugins / sdl / sdl.c
1 /*****************************************************************************
2  * sdl.c : SDL 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 "config.h"
31 #include "common.h"                                     /* boolean_t, byte_t */
32 #include "threads.h"
33 #include "mtime.h"
34 #include "tests.h"
35 #include "plugins.h"
36
37 #include "interface.h"
38 #include "audio_output.h"
39 #include "video.h"
40 #include "video_output.h"
41
42 /*****************************************************************************
43  * Exported prototypes
44  *****************************************************************************/
45 static void vout_GetPlugin( p_vout_thread_t p_vout );
46 static void intf_GetPlugin( p_intf_thread_t p_intf );
47
48 /* Video output */
49 int     vout_SDLCreate       ( vout_thread_t *p_vout, char *psz_display,
50                                int i_root_window, void *p_data );
51 int     vout_SDLInit         ( p_vout_thread_t p_vout );
52 void    vout_SDLEnd          ( p_vout_thread_t p_vout );
53 void    vout_SDLDestroy      ( p_vout_thread_t p_vout );
54 int     vout_SDLManage       ( p_vout_thread_t p_vout );
55 void    vout_SDLDisplay      ( p_vout_thread_t p_vout );
56 void    vout_SDLSetPalette   ( p_vout_thread_t p_vout,
57                                u16 *red, u16 *green, u16 *blue, u16 *transp );
58
59 /* Interface */
60 int     intf_SDLCreate       ( p_intf_thread_t p_intf );
61 void    intf_SDLDestroy      ( p_intf_thread_t p_intf );
62 void    intf_SDLManage       ( p_intf_thread_t p_intf );
63
64 /*****************************************************************************
65  * GetConfig: get the plugin structure and configuration
66  *****************************************************************************/
67 plugin_info_t * GetConfig( void )
68 {
69     plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
70
71     p_info->psz_name    = "SDL";
72     p_info->psz_version = VERSION;
73     p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
74
75     p_info->aout_GetPlugin = NULL;
76     p_info->vout_GetPlugin = vout_GetPlugin;
77     p_info->intf_GetPlugin = intf_GetPlugin;
78     p_info->yuv_GetPlugin  = NULL;
79
80     /* if the SDL libraries are there, assume we can enter the
81      * initialization part at least, even if we fail afterwards */
82     p_info->i_score = 0x100;
83
84     if( TestProgram( "sdlvlc" ) )
85     {
86         p_info->i_score += 0x180;
87     }
88
89     /* If this plugin was requested, score it higher */
90     if( TestMethod( VOUT_METHOD_VAR, "sdl" ) )
91     {
92         p_info->i_score += 0x200;
93     }
94
95     return( p_info );
96 }
97
98 /*****************************************************************************
99  * Following functions are only called through the p_info structure
100  *****************************************************************************/
101
102 static void vout_GetPlugin( p_vout_thread_t p_vout )
103 {
104     p_vout->p_sys_create  = vout_SDLCreate;
105     p_vout->p_sys_init    = vout_SDLInit;
106     p_vout->p_sys_end     = vout_SDLEnd;
107     p_vout->p_sys_destroy = vout_SDLDestroy;
108     p_vout->p_sys_manage  = vout_SDLManage;
109     p_vout->p_sys_display = vout_SDLDisplay;
110 }
111
112 static void intf_GetPlugin( p_intf_thread_t p_intf )
113 {
114     p_intf->p_sys_create  = intf_SDLCreate;
115     p_intf->p_sys_destroy = intf_SDLDestroy;
116     p_intf->p_sys_manage  = intf_SDLManage;
117 }
118