modules.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * modules.h : Module management functions.
00003  *****************************************************************************
00004  * Copyright (C) 2001 the VideoLAN team
00005  * $Id: 60b00eee01a83149e705f696f38019085381b375 $
00006  *
00007  * Authors: Samuel Hocevar <sam@zoy.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
00025 # error This header file can only be included from LibVLC.
00026 #endif
00027 
00028 #ifndef LIBVLC_MODULES_H
00029 # define LIBVLC_MODULES_H 1
00030 
00031 /*****************************************************************************
00032  * module_bank_t: the module bank
00033  *****************************************************************************
00034  * This variable is accessed by any function using modules.
00035  *****************************************************************************/
00036 struct module_bank_t
00037 {
00038     unsigned         i_usage;
00039 
00040     /* Plugins cache */
00041     bool             b_cache;
00042     bool             b_cache_dirty;
00043 
00044     int            i_cache;
00045     module_cache_t **pp_cache;
00046 
00047     int            i_loaded_cache;
00048     module_cache_t **pp_loaded_cache;
00049 
00050     module_t       *head;
00051 };
00052 
00053 /*****************************************************************************
00054  * Module cache description structure
00055  *****************************************************************************/
00056 struct module_cache_t
00057 {
00058     /* Mandatory cache entry header */
00059     char       *psz_file;
00060     int64_t    i_time;
00061     int64_t    i_size;
00062 
00063     /* Optional extra data */
00064     module_t *p_module;
00065 };
00066 
00067 
00068 #define MODULE_SHORTCUT_MAX 20
00069 
00070 /* The module handle type. */
00071 #if defined(HAVE_DL_DYLD) && !defined(__x86_64__)
00072 #   if defined (HAVE_MACH_O_DYLD_H)
00073 #       include <mach-o/dyld.h>
00074 #   endif
00075 typedef NSModule module_handle_t;
00076 #elif defined(HAVE_IMAGE_H)
00077 typedef int module_handle_t;
00078 #elif defined(WIN32) || defined(UNDER_CE)
00079 typedef void * module_handle_t;
00080 #elif defined(HAVE_DL_DLOPEN)
00081 typedef void * module_handle_t;
00082 #elif defined(HAVE_DL_SHL_LOAD)
00083 typedef shl_t module_handle_t;
00084 #endif
00085 
00086 /**
00087  * Internal module descriptor
00088  */
00089 struct module_t
00090 {
00091     char       *psz_object_name;
00092     gc_object_t vlc_gc_data;
00093 
00094     module_t   *next;
00095     module_t   *parent;
00096     module_t   *submodule;
00097     unsigned    submodule_count;
00098 
00099     /** Shortcuts to the module */
00100     unsigned    i_shortcuts;
00101     char        **pp_shortcuts;
00102 
00103     /*
00104      * Variables set by the module to identify itself
00105      */
00106     char *psz_shortname;                              /**< Module name */
00107     char *psz_longname;                   /**< Module descriptive name */
00108     char *psz_help;        /**< Long help string for "special" modules */
00109 
00110     char    *psz_capability;                                 /**< Capability */
00111     int      i_score;                          /**< Score for the capability */
00112 
00113     bool          b_builtin;  /* Set to true if the module is built in */
00114     bool          b_loaded;        /* Set to true if the dll is loaded */
00115     bool b_unloadable;                        /**< Can we be dlclosed? */
00116     bool b_submodule;                        /**< Is this a submodule? */
00117 
00118     /* Callbacks */
00119     int  ( * pf_activate )   ( vlc_object_t * );
00120     void ( * pf_deactivate ) ( vlc_object_t * );
00121 
00122     /*
00123      * Variables set by the module to store its config options
00124      */
00125     module_config_t *p_config;             /* Module configuration structure */
00126     size_t           confsize;            /* Number of module_config_t items */
00127     unsigned int     i_config_items;        /* number of configuration items */
00128     unsigned int     i_bool_items;            /* number of bool config items */
00129 
00130     /*
00131      * Variables used internally by the module manager
00132      */
00133     /* Plugin-specific stuff */
00134     module_handle_t     handle;                             /* Unique handle */
00135     char *              psz_filename;                     /* Module filename */
00136     char *              domain;                            /* gettext domain */
00137 };
00138 
00139 module_t *vlc_module_create (vlc_object_t *);
00140 module_t *vlc_submodule_create (module_t *module);
00141 
00142 void  module_InitBank( vlc_object_t * );
00143 #define module_InitBank(a) module_InitBank(VLC_OBJECT(a))
00144 void module_LoadPlugins( vlc_object_t * );
00145 #define module_LoadPlugins(a) module_LoadPlugins(VLC_OBJECT(a))
00146 void module_EndBank( vlc_object_t *, bool );
00147 #define module_EndBank(a,b) module_EndBank(VLC_OBJECT(a), b)
00148 
00149 int vlc_bindtextdomain (const char *);
00150 
00151 /* Low-level OS-dependent handler */
00152 int  module_Load   (vlc_object_t *, const char *, module_handle_t *);
00153 int  module_Call   (vlc_object_t *obj, module_t *);
00154 void module_Unload (module_handle_t);
00155 
00156 /* Plugins cache */
00157 void   CacheMerge (vlc_object_t *, module_t *, module_t *);
00158 void   CacheDelete(vlc_object_t *, const char *);
00159 void   CacheLoad  (vlc_object_t *, module_bank_t *, const char *);
00160 void   CacheSave  (vlc_object_t *, const char *, module_cache_t *const *, size_t);
00161 module_cache_t * CacheFind (module_bank_t *, const char *, int64_t, int64_t);
00162 
00163 #endif /* !LIBVLC_MODULES_H */

Generated on Mon Nov 22 07:55:21 2010 for VLC by  doxygen 1.5.6