Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

modules.h

00001 /*****************************************************************************
00002  * modules.h : Module management functions.
00003  *****************************************************************************
00004  * Copyright (C) 2001 the VideoLAN team
00005  * $Id: modules.h 12319 2005-08-21 18:48:05Z courmisch $
00006  *
00007  * Authors: Samuel Hocevar <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 /*****************************************************************************
00025  * Module #defines.
00026  *****************************************************************************/
00027 
00028 /* Number of tries before we unload an unused module */
00029 #define MODULE_HIDE_DELAY 50
00030 #define MODULE_SHORTCUT_MAX 50
00031 
00032 /* The module handle type. */
00033 #if defined(HAVE_DL_DYLD)
00034 #   if defined (HAVE_MACH_O_DYLD_H)
00035 #       include <mach-o/dyld.h>
00036 #   endif
00037 typedef NSModule module_handle_t;
00038 #elif defined(HAVE_IMAGE_H)
00039 typedef int module_handle_t;
00040 #elif defined(WIN32) || defined(UNDER_CE)
00041 typedef void * module_handle_t;
00042 #elif defined(HAVE_DL_DLOPEN)
00043 typedef void * module_handle_t;
00044 #elif defined(HAVE_DL_SHL_LOAD)
00045 typedef shl_t module_handle_t;
00046 #endif
00047 
00048 /*****************************************************************************
00049  * module_bank_t: the module bank
00050  *****************************************************************************
00051  * This variable is accessed by any function using modules.
00052  *****************************************************************************/
00053 struct module_bank_t
00054 {
00055     VLC_COMMON_MEMBERS
00056 
00057     int              i_usage;
00058 #ifndef HAVE_SHARED_LIBVLC
00059     module_symbols_t symbols;
00060 #endif
00061 
00062     vlc_bool_t       b_main;
00063     vlc_bool_t       b_builtins;
00064     vlc_bool_t       b_plugins;
00065 
00066     /* Plugins cache */
00067     vlc_bool_t     b_cache;
00068     vlc_bool_t     b_cache_dirty;
00069     vlc_bool_t     b_cache_delete;
00070 
00071     int            i_cache;
00072     module_cache_t **pp_cache;
00073 
00074     int            i_loaded_cache;
00075     module_cache_t **pp_loaded_cache;
00076 };
00077 
00078 /*****************************************************************************
00079  * Module description structure
00080  *****************************************************************************/
00081 struct module_t
00082 {
00083     VLC_COMMON_MEMBERS
00084 
00085     /*
00086      * Variables set by the module to identify itself
00087      */
00088     char *psz_shortname;                                      /* Module name */
00089     char *psz_longname;                           /* Module descriptive name */
00090 
00091     /*
00092      * Variables set by the module to tell us what it can do
00093      */
00094     char *psz_program;        /* Program name which will activate the module */
00095 
00096     char *pp_shortcuts[ MODULE_SHORTCUT_MAX ];    /* Shortcuts to the module */
00097 
00098     char    *psz_capability;                                   /* Capability */
00099     int      i_score;                           /* Score for each capability */
00100     uint32_t i_cpu;                             /* Required CPU capabilities */
00101 
00102     vlc_bool_t b_unloadable;                          /* Can we be dlclosed? */
00103     vlc_bool_t b_reentrant;                             /* Are we reentrant? */
00104     vlc_bool_t b_submodule;                          /* Is this a submodule? */
00105 
00106     /* Callbacks */
00107     int  ( * pf_activate )   ( vlc_object_t * );
00108     void ( * pf_deactivate ) ( vlc_object_t * );
00109 
00110     /*
00111      * Variables set by the module to store its config options
00112      */
00113     module_config_t *p_config;             /* Module configuration structure */
00114     unsigned int     i_config_items;        /* number of configuration items */
00115     unsigned int     i_bool_items;            /* number of bool config items */
00116 
00117     /*
00118      * Variables used internally by the module manager
00119      */
00120     /* Plugin-specific stuff */
00121     module_handle_t     handle;                             /* Unique handle */
00122     char *              psz_filename;                     /* Module filename */
00123 
00124     vlc_bool_t          b_builtin;  /* Set to true if the module is built in */
00125     vlc_bool_t          b_loaded;        /* Set to true if the dll is loaded */
00126 
00127     /*
00128      * Symbol table we send to the module so that it can access vlc symbols
00129      */
00130     module_symbols_t *p_symbols;
00131 };
00132 
00133 /*****************************************************************************
00134  * Module cache description structure
00135  *****************************************************************************/
00136 struct module_cache_t
00137 {
00138     /* Mandatory cache entry header */
00139     char       *psz_file;
00140     int64_t    i_time;
00141     int64_t    i_size;
00142     vlc_bool_t b_junk;
00143 
00144     /* Optional extra data */
00145     module_t *p_module;
00146 };
00147 
00148 /*****************************************************************************
00149  * Exported functions.
00150  *****************************************************************************/
00151 #define module_InitBank(a)     __module_InitBank(VLC_OBJECT(a))
00152 void  __module_InitBank        ( vlc_object_t * );
00153 #define module_LoadMain(a)     __module_LoadMain(VLC_OBJECT(a))
00154 void  __module_LoadMain        ( vlc_object_t * );
00155 #define module_LoadBuiltins(a) __module_LoadBuiltins(VLC_OBJECT(a))
00156 void  __module_LoadBuiltins    ( vlc_object_t * );
00157 #define module_LoadPlugins(a)  __module_LoadPlugins(VLC_OBJECT(a))
00158 void  __module_LoadPlugins     ( vlc_object_t * );
00159 #define module_EndBank(a)      __module_EndBank(VLC_OBJECT(a))
00160 void  __module_EndBank         ( vlc_object_t * );
00161 #define module_ResetBank(a)    __module_ResetBank(VLC_OBJECT(a))
00162 void  __module_ResetBank       ( vlc_object_t * );
00163 
00164 #define module_Need(a,b,c,d) __module_Need(VLC_OBJECT(a),b,c,d)
00165 VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, const char *, const char *, vlc_bool_t ) );
00166 #define module_Unneed(a,b) __module_Unneed(VLC_OBJECT(a),b)
00167 VLC_EXPORT( void, __module_Unneed, ( vlc_object_t *, module_t * ) );
00168 

Generated on Tue Dec 20 10:14:19 2005 for vlc-0.8.4a by  doxygen 1.4.2