modules.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * modules.h : Module management functions.
00003  *****************************************************************************
00004  * Copyright (C) 2001 VLC authors and VideoLAN
00005  * $Id: a87056083e79e25ef62194f0698ca51623225a14 $
00006  *
00007  * Authors: Samuel Hocevar <sam@zoy.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify it
00010  * under the terms of the GNU Lesser General Public License as published by
00011  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License
00020  * along with this program; if not, write to the Free Software Foundation,
00021  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef LIBVLC_MODULES_H
00025 # define LIBVLC_MODULES_H 1
00026 
00027 typedef struct module_cache_t module_cache_t;
00028 
00029 /*****************************************************************************
00030  * Module cache description structure
00031  *****************************************************************************/
00032 struct module_cache_t
00033 {
00034     /* Mandatory cache entry header */
00035     char  *path;
00036     time_t mtime;
00037     off_t  size;
00038 
00039     /* Optional extra data */
00040     module_t *p_module;
00041 };
00042 
00043 
00044 #define MODULE_SHORTCUT_MAX 20
00045 
00046 /** The module handle type */
00047 typedef void *module_handle_t;
00048 
00049 /** Plugin entry point prototype */
00050 typedef int (*vlc_plugin_cb) (int (*)(void *, void *, int, ...), void *);
00051 
00052 /** Main module */
00053 int vlc_entry__main (int (*)(void *, void *, int, ...), void *);
00054 
00055 /**
00056  * Internal module descriptor
00057  */
00058 struct module_t
00059 {
00060     module_t   *next;
00061     module_t   *parent;
00062     module_t   *submodule;
00063     unsigned    submodule_count;
00064 
00065     /** Shortcuts to the module */
00066     unsigned    i_shortcuts;
00067     char        **pp_shortcuts;
00068 
00069     /*
00070      * Variables set by the module to identify itself
00071      */
00072     char *psz_shortname;                              /**< Module name */
00073     char *psz_longname;                   /**< Module descriptive name */
00074     char *psz_help;        /**< Long help string for "special" modules */
00075 
00076     char    *psz_capability;                                 /**< Capability */
00077     int      i_score;                          /**< Score for the capability */
00078 
00079     bool          b_loaded;        /* Set to true if the dll is loaded */
00080     bool b_unloadable;                        /**< Can we be dlclosed? */
00081 
00082     /* Callbacks */
00083     void *pf_activate;
00084     void *pf_deactivate;
00085 
00086     /*
00087      * Variables set by the module to store its config options
00088      */
00089     module_config_t *p_config;             /* Module configuration structure */
00090     size_t           confsize;            /* Number of module_config_t items */
00091     unsigned int     i_config_items;        /* number of configuration items */
00092     unsigned int     i_bool_items;            /* number of bool config items */
00093 
00094     /*
00095      * Variables used internally by the module manager
00096      */
00097     /* Plugin-specific stuff */
00098     module_handle_t     handle;                             /* Unique handle */
00099     char *              psz_filename;                     /* Module filename */
00100     char *              domain;                            /* gettext domain */
00101 };
00102 
00103 module_t *vlc_plugin_describe (vlc_plugin_cb);
00104 module_t *vlc_module_create (module_t *);
00105 void vlc_module_destroy (module_t *);
00106 
00107 void module_InitBank (void);
00108 size_t module_LoadPlugins( vlc_object_t * );
00109 #define module_LoadPlugins(a) module_LoadPlugins(VLC_OBJECT(a))
00110 void module_EndBank (bool);
00111 int module_Map (vlc_object_t *, module_t *);
00112 
00113 int vlc_bindtextdomain (const char *);
00114 
00115 /* Low-level OS-dependent handler */
00116 int module_Load (vlc_object_t *, const char *, module_handle_t *, bool);
00117 void *module_Lookup (module_handle_t, const char *);
00118 void module_Unload (module_handle_t);
00119 
00120 /* Plugins cache */
00121 void   CacheMerge (vlc_object_t *, module_t *, module_t *);
00122 void   CacheDelete(vlc_object_t *, const char *);
00123 size_t CacheLoad  (vlc_object_t *, const char *, module_cache_t **);
00124 
00125 struct stat;
00126 
00127 int CacheAdd (module_cache_t **, size_t *,
00128               const char *, const struct stat *, module_t *);
00129 void CacheSave  (vlc_object_t *, const char *, module_cache_t *, size_t);
00130 module_t *CacheFind (module_cache_t *, size_t,
00131                      const char *, const struct stat *);
00132 
00133 #endif /* !LIBVLC_MODULES_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines