1 /*****************************************************************************
2 * dummy.c : dummy 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 dummy
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"
45 #include "modules_inner.h"
47 /*****************************************************************************
48 * Build configuration tree.
49 *****************************************************************************/
51 ADD_WINDOW( "Configuration for dummy module" )
52 ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
55 /*****************************************************************************
56 * Capabilities defined in the other files.
57 *****************************************************************************/
58 extern void aout_getfunctions( function_list_t * p_function_list );
60 /*****************************************************************************
61 * InitModule: get the module structure and configuration.
62 *****************************************************************************
63 * We have to fill psz_name, psz_longname and psz_version. These variables
64 * will be strdup()ed later by the main application because the module can
65 * be unloaded later to save memory, and we want to be able to access this
66 * data even after the module has been unloaded.
67 *****************************************************************************/
68 int InitModule( module_t * p_module )
70 p_module->psz_name = MODULE_STRING;
71 p_module->psz_longname = "dummy functions module";
72 p_module->psz_version = VERSION;
74 p_module->i_capabilities = MODULE_CAPABILITY_NULL
75 | MODULE_CAPABILITY_AOUT;
80 /*****************************************************************************
81 * ActivateModule: set the module to an usable state.
82 *****************************************************************************
83 * This function fills the capability functions and the configuration
84 * structure. Once ActivateModule() has been called, the i_usage can
85 * be set to 0 and calls to NeedModule() be made to increment it. To unload
86 * the module, one has to wait until i_usage == 0 and call DeactivateModule().
87 *****************************************************************************/
88 int ActivateModule( module_t * p_module )
90 p_module->p_functions = malloc( sizeof( module_functions_t ) );
91 if( p_module->p_functions == NULL )
96 aout_getfunctions( &p_module->p_functions->aout );
98 p_module->p_config = p_config;
103 /*****************************************************************************
104 * DeactivateModule: make sure the module can be unloaded.
105 *****************************************************************************
106 * This function must only be called when i_usage == 0. If it successfully
107 * returns, i_usage can be set to -1 and the module unloaded. Be careful to
108 * lock usage_lock during the whole process.
109 *****************************************************************************/
110 int DeactivateModule( module_t * p_module )
112 free( p_module->p_functions );
117 /* OLD MODULE STRUCTURE -- soon to be removed */
119 /*****************************************************************************
120 * Exported prototypes
121 *****************************************************************************/
122 static void vout_GetPlugin( p_vout_thread_t p_vout );
123 static void intf_GetPlugin( p_intf_thread_t p_intf );
126 int vout_DummyCreate ( vout_thread_t *p_vout, char *psz_display,
127 int i_root_window, void *p_data );
128 int vout_DummyInit ( p_vout_thread_t p_vout );
129 void vout_DummyEnd ( p_vout_thread_t p_vout );
130 void vout_DummyDestroy ( p_vout_thread_t p_vout );
131 int vout_DummyManage ( p_vout_thread_t p_vout );
132 void vout_DummyDisplay ( p_vout_thread_t p_vout );
133 void vout_DummySetPalette ( p_vout_thread_t p_vout,
134 u16 *red, u16 *green, u16 *blue, u16 *transp );
137 int intf_DummyCreate ( p_intf_thread_t p_intf );
138 void intf_DummyDestroy ( p_intf_thread_t p_intf );
139 void intf_DummyManage ( p_intf_thread_t p_intf );
141 /*****************************************************************************
142 * GetConfig: get the plugin structure and configuration
143 *****************************************************************************/
144 plugin_info_t * GetConfig( void )
146 plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
148 p_info->psz_name = "Dummy";
149 p_info->psz_version = VERSION;
150 p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
152 p_info->aout_GetPlugin = NULL;
153 p_info->vout_GetPlugin = vout_GetPlugin;
154 p_info->intf_GetPlugin = intf_GetPlugin;
155 p_info->yuv_GetPlugin = NULL;
157 /* The dummy plugin always works, but should have low priority */
158 p_info->i_score = 0x1;
160 /* If this plugin was requested, score it higher */
161 if( TestMethod( VOUT_METHOD_VAR, "dummy" ) )
163 p_info->i_score += 0x200;
169 /*****************************************************************************
170 * Following functions are only called through the p_info structure
171 *****************************************************************************/
173 static void vout_GetPlugin( p_vout_thread_t p_vout )
175 p_vout->p_sys_create = vout_DummyCreate;
176 p_vout->p_sys_init = vout_DummyInit;
177 p_vout->p_sys_end = vout_DummyEnd;
178 p_vout->p_sys_destroy = vout_DummyDestroy;
179 p_vout->p_sys_manage = vout_DummyManage;
180 p_vout->p_sys_display = vout_DummyDisplay;
183 static void intf_GetPlugin( p_intf_thread_t p_intf )
185 p_intf->p_sys_create = intf_DummyCreate;
186 p_intf->p_sys_destroy = intf_DummyDestroy;
187 p_intf->p_sys_manage = intf_DummyManage;