1 /*****************************************************************************
2 * beos.cpp : BeOS plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000 VideoLAN
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.
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.
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 *****************************************************************************/
23 #define MODULE_NAME beos
25 /*****************************************************************************
27 *****************************************************************************/
30 #include <stdlib.h> /* malloc(), free() */
35 #include "common.h" /* boolean_t, byte_t */
40 #include "interface.h"
41 #include "audio_output.h"
43 #include "video_output.h"
46 #include "modules_inner.h"
48 /*****************************************************************************
49 * Build configuration tree.
50 *****************************************************************************/
52 ADD_WINDOW( "Configuration for BeOS module" )
53 ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
56 /*****************************************************************************
57 * Capabilities defined in the other files.
58 *****************************************************************************/
59 extern void aout_getfunctions( function_list_t * p_function_list );
61 /*****************************************************************************
62 * InitModule: get the module structure and configuration.
63 *****************************************************************************
64 * We have to fill psz_name, psz_longname and psz_version. These variables
65 * will be strdup()ed later by the main application because the module can
66 * be unloaded later to save memory, and we want to be able to access this
67 * data even after the module has been unloaded.
68 *****************************************************************************/
69 int InitModule( module_t * p_module )
71 p_module->psz_name = MODULE_STRING;
72 p_module->psz_longname = "BeOS standard API module";
73 p_module->psz_version = VERSION;
75 p_module->i_capabilities = MODULE_CAPABILITY_NULL
76 | MODULE_CAPABILITY_AOUT;
81 /*****************************************************************************
82 * ActivateModule: set the module to an usable state.
83 *****************************************************************************
84 * This function fills the capability functions and the configuration
85 * structure. Once ActivateModule() has been called, the i_usage can
86 * be set to 0 and calls to NeedModule() be made to increment it. To unload
87 * the module, one has to wait until i_usage == 0 and call DeactivateModule().
88 *****************************************************************************/
89 int ActivateModule( module_t * p_module )
91 p_module->p_functions = malloc( sizeof( module_functions_t ) );
92 if( p_module->p_functions == NULL )
97 aout_getfunctions( &p_module->p_functions->aout );
99 p_module->p_config = p_config;
104 /*****************************************************************************
105 * DeactivateModule: make sure the module can be unloaded.
106 *****************************************************************************
107 * This function must only be called when i_usage == 0. If it successfully
108 * returns, i_usage can be set to -1 and the module unloaded. Be careful to
109 * lock usage_lock during the whole process.
110 *****************************************************************************/
111 int DeactivateModule( module_t * p_module )
113 free( p_module->p_functions );
118 /* OLD MODULE STRUCTURE -- soon to be removed */
120 /*****************************************************************************
121 * Exported prototypes
122 *****************************************************************************/
123 static void vout_GetPlugin( p_vout_thread_t p_vout );
124 static void intf_GetPlugin( p_intf_thread_t p_intf );
127 int vout_BeCreate ( vout_thread_t *p_vout, char *psz_display,
128 int i_root_window, void *p_data );
129 int vout_BeInit ( p_vout_thread_t p_vout );
130 void vout_BeEnd ( p_vout_thread_t p_vout );
131 void vout_BeDestroy ( p_vout_thread_t p_vout );
132 int vout_BeManage ( p_vout_thread_t p_vout );
133 void vout_BeDisplay ( p_vout_thread_t p_vout );
134 void vout_BeSetPalette ( p_vout_thread_t p_vout,
135 u16 *red, u16 *green, u16 *blue, u16 *transp );
138 int intf_BeCreate ( p_intf_thread_t p_intf );
139 void intf_BeDestroy ( p_intf_thread_t p_intf );
140 void intf_BeManage ( p_intf_thread_t p_intf );
142 /*****************************************************************************
143 * GetConfig: get the plugin structure and configuration
144 *****************************************************************************/
145 plugin_info_t * GetConfig( void )
147 plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
149 p_info->psz_name = "BeOS";
150 p_info->psz_version = VERSION;
151 p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
153 p_info->aout_GetPlugin = NULL;
154 p_info->vout_GetPlugin = vout_GetPlugin;
155 p_info->intf_GetPlugin = intf_GetPlugin;
156 p_info->yuv_GetPlugin = NULL;
158 /* the beos plugin always works under BeOS :) */
159 p_info->i_score = 0x800;
164 /*****************************************************************************
165 * Following functions are only called through the p_info structure
166 *****************************************************************************/
168 static void vout_GetPlugin( p_vout_thread_t p_vout )
170 p_vout->p_sys_create = vout_BeCreate;
171 p_vout->p_sys_init = vout_BeInit;
172 p_vout->p_sys_end = vout_BeEnd;
173 p_vout->p_sys_destroy = vout_BeDestroy;
174 p_vout->p_sys_manage = vout_BeManage;
175 p_vout->p_sys_display = vout_BeDisplay;
178 static void intf_GetPlugin( p_intf_thread_t p_intf )
180 p_intf->p_sys_create = intf_BeCreate;
181 p_intf->p_sys_destroy = intf_BeDestroy;
182 p_intf->p_sys_manage = intf_BeManage;