00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #if !defined( __PLUGIN__ ) && !defined( __BUILTIN__ )
00028 # define MODULE_NAME main
00029 #endif
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define STRINGIFY( z ) UGLY_KLUDGE( z )
00048 #define UGLY_KLUDGE( z ) #z
00049
00050 #define CONCATENATE( y, z ) CRUDE_HACK( y, z )
00051 #define CRUDE_HACK( y, z ) y##__##z
00052
00053
00054
00055 #if defined( __BUILTIN__ )
00056 # define E_( function ) CONCATENATE( function, MODULE_NAME )
00057 # define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_NAME )
00058 # define DECLARE_SYMBOLS struct _u_n_u_s_e_d_
00059 # define STORE_SYMBOLS struct _u_n_u_s_e_d_
00060 #elif defined( __PLUGIN__ )
00061 # define E_( function ) CONCATENATE( function, MODULE_SYMBOL )
00062 # define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_SYMBOL )
00063 # define DECLARE_SYMBOLS module_symbols_t* p_symbols
00064 # define STORE_SYMBOLS p_symbols = p_module->p_symbols
00065 #endif
00066
00067 #if defined( __PLUGIN__ ) && ( defined( WIN32 ) || defined( UNDER_CE ) )
00068 # define DLL_SYMBOL __declspec(dllexport)
00069 # define CDECL_SYMBOL __cdecl
00070 #else
00071 # define DLL_SYMBOL
00072 # define CDECL_SYMBOL
00073 #endif
00074
00075 #if defined( __cplusplus )
00076 # define EXTERN_SYMBOL extern "C"
00077 #else
00078 # define EXTERN_SYMBOL
00079 #endif
00080
00081 #if defined( USE_DLL )
00082 # define IMPORT_SYMBOL __declspec(dllimport)
00083 #else
00084 # define IMPORT_SYMBOL
00085 #endif
00086
00087 #define MODULE_STRING STRINGIFY( MODULE_NAME )
00088
00089
00090
00091
00092
00093
00094
00095 #define vlc_module_begin( ) \
00096 DECLARE_SYMBOLS; \
00097 EXTERN_SYMBOL DLL_SYMBOL int CDECL_SYMBOL \
00098 __VLC_SYMBOL(vlc_entry) ( module_t *p_module ) \
00099 { \
00100 int i_shortcut = 1, i_config = -1; \
00101 module_config_t *p_config = NULL; \
00102 static module_config_t config_end = {CONFIG_HINT_END}; \
00103 STORE_SYMBOLS; \
00104 p_module->b_submodule = VLC_FALSE; \
00105 p_module->b_unloadable = VLC_TRUE; \
00106 p_module->b_reentrant = VLC_TRUE; \
00107 p_module->psz_object_name = MODULE_STRING; \
00108 p_module->psz_shortname = NULL; \
00109 p_module->psz_longname = MODULE_STRING; \
00110 p_module->pp_shortcuts[ 0 ] = MODULE_STRING; \
00111 p_module->i_cpu = 0; \
00112 p_module->psz_program = NULL; \
00113 p_module->psz_capability = ""; \
00114 p_module->i_score = 1; \
00115 p_module->pf_activate = NULL; \
00116 p_module->pf_deactivate = NULL; \
00117 { \
00118 module_t *p_submodule = p_module
00119
00120 #define vlc_module_end( ) \
00121 p_submodule->pp_shortcuts[ i_shortcut ] = NULL; \
00122 } \
00123 if( p_config ) \
00124 { \
00125 p_config[ ++i_config ] = config_end; \
00126 config_Duplicate( p_module, p_config ); \
00127 free( p_config ); \
00128 } \
00129 else config_Duplicate( p_module, &config_end ); \
00130 if( p_module->p_config == NULL ) \
00131 { \
00132 return VLC_EGENERIC; \
00133 } \
00134 return VLC_SUCCESS && i_shortcut; \
00135 } \
00136 struct _u_n_u_s_e_d_
00137
00138
00139 #define add_submodule( ) \
00140 p_submodule->pp_shortcuts[ i_shortcut ] = NULL; \
00141 p_submodule = \
00142 (module_t *)vlc_object_create( p_module, VLC_OBJECT_MODULE ); \
00143 vlc_object_attach( p_submodule, p_module ); \
00144 p_submodule->b_submodule = VLC_TRUE; \
00145 \
00146 for( i_shortcut = 0; p_module->pp_shortcuts[ i_shortcut ]; i_shortcut++ ) \
00147 { \
00148 p_submodule->pp_shortcuts[ i_shortcut ] = \
00149 p_module->pp_shortcuts[ i_shortcut ]; \
00150 } \
00151 p_submodule->psz_object_name = p_module->psz_object_name; \
00152 p_submodule->psz_shortname = p_module->psz_shortname; \
00153 p_submodule->psz_longname = p_module->psz_longname; \
00154 p_submodule->psz_program = p_module->psz_program; \
00155 p_submodule->psz_capability = p_module->psz_capability; \
00156 p_submodule->i_score = p_module->i_score; \
00157 p_submodule->i_cpu = p_module->i_cpu; \
00158 p_submodule->pf_activate = NULL; \
00159 p_submodule->pf_deactivate = NULL
00160
00161 #define add_requirement( cap ) \
00162 p_module->i_cpu |= CPU_CAPABILITY_##cap
00163
00164 #define add_shortcut( shortcut ) \
00165 p_submodule->pp_shortcuts[ i_shortcut ] = shortcut; \
00166 i_shortcut++
00167
00168 #define set_shortname( desc ) \
00169 p_submodule->psz_shortname = desc
00170
00171 #define set_description( desc ) \
00172 p_submodule->psz_longname = desc
00173
00174 #define set_capability( cap, score ) \
00175 p_submodule->psz_capability = cap; \
00176 p_submodule->i_score = score
00177
00178 #define set_program( program ) \
00179 p_submodule->psz_program = program
00180
00181 #define set_callbacks( activate, deactivate ) \
00182 p_submodule->pf_activate = activate; \
00183 p_submodule->pf_deactivate = deactivate
00184
00185 #define linked_with_a_crap_library_which_uses_atexit( ) \
00186 p_module->b_unloadable = VLC_FALSE
00187