Changeset 7f1f444ca32b4670e34a2a52b5e99e5381c9333a

Show
Ignore:
Timestamp:
02/26/08 00:26:45 (6 months ago)
Author:
Rémi Duraffort <ivoire@videolan.org>
git-committer:
Rémi Duraffort <ivoire@videolan.org> 1203982005 +0000
git-parent:

[3fd7eb0f358128381965ebd5614270b357d4ab15]

git-author:
Rémi Duraffort <ivoire@videolan.org> 1203982005 +0000
Message:

Doxygen comments and coding conventions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/modules.c

    r1af701c r7f1f444  
    107107static void module_LoadMain( vlc_object_t *p_this ); 
    108108 
    109 /***************************************************************************** 
    110  * module_InitBank: create the module bank. 
    111  ***************************************************************************** 
    112  * This function creates a module bank structure which will be filled later 
     109/** 
     110 * Init bank 
     111 * 
     112 * Creates a module bank structure which will be filled later 
    113113 * on with all the modules found. 
    114  *****************************************************************************/ 
     114 * \param p_this vlc object structure 
     115 * \return nothing 
     116 */ 
    115117void __module_InitBank( vlc_object_t *p_this ) 
    116118{ 
     
    150152 
    151153 
    152 /***************************************************************************** 
    153  * module_EndBank: empty the module bank. 
    154  ***************************************************************************** 
    155  * This function unloads all unused plugin modules and empties the module 
     154/** 
     155 * End bank 
     156 * 
     157 * Unloads all unused plugin modules and empties the module 
    156158 * bank in case of success. 
    157  *****************************************************************************/ 
     159 * \param p_this vlc object structure 
     160 * \return nothing 
     161 */ 
    158162void __module_EndBank( vlc_object_t *p_this ) 
    159163{ 
     
    180184    var_Destroy( p_libvlc_global, "libvlc" ); 
    181185 
     186    /* Save the configuration */ 
    182187    config_AutoSaveConfigFile( p_this ); 
    183188 
     
    189194        if( p_bank->pp_loaded_cache[p_bank->i_loaded_cache] ) 
    190195        { 
    191             DeleteModule( p_bank->pp_loaded_cache[p_bank->i_loaded_cache]->p_module, 
    192                           p_bank->pp_loaded_cache[p_bank->i_loaded_cache]->b_used ); 
     196            DeleteModule( 
     197                    p_bank->pp_loaded_cache[p_bank->i_loaded_cache]->p_module, 
     198                    p_bank->pp_loaded_cache[p_bank->i_loaded_cache]->b_used ); 
    193199            free( p_bank->pp_loaded_cache[p_bank->i_loaded_cache]->psz_file ); 
    194200            free( p_bank->pp_loaded_cache[p_bank->i_loaded_cache] ); 
     
    237243} 
    238244 
    239 /***************************************************************************** 
    240  * module_LoadMain: load the main program info into the module bank. 
    241  ***************************************************************************** 
    242  * This function fills the module bank structure with the main module infos. 
     245/** 
     246 * Load the main program info into the module bank. 
     247 * 
     248 * Fills the module bank structure with the main module infos. 
    243249 * This is very useful as it will allow us to consider the main program just 
    244250 * as another module, and for instance the configuration options of main will 
    245251 * be available in the module bank structure just as for every other module. 
    246  *****************************************************************************/ 
     252 * \param p_this vlc object structure 
     253 * \return nothing 
     254 */ 
    247255static void module_LoadMain( vlc_object_t *p_this ) 
    248256{ 
     
    266274} 
    267275 
    268 /***************************************************************************** 
    269  * module_LoadBuiltins: load all modules which we built with. 
    270  ***************************************************************************** 
    271  * This function fills the module bank structure with the builtin modules. 
    272  *****************************************************************************/ 
     276/** 
     277 * Load all modules which we built with. 
     278 * 
     279 * Fills the module bank structure with the builtin modules. 
     280 * \param p_this vlc object structure 
     281 * \return nothing 
     282 */ 
    273283void __module_LoadBuiltins( vlc_object_t * p_this ) 
    274284{ 
     
    293303} 
    294304 
    295 /***************************************************************************** 
    296  * module_LoadPlugins: load all plugin modules we can find. 
    297  ***************************************************************************** 
    298  * This function fills the module bank structure with the plugin modules. 
    299  *****************************************************************************/ 
     305/** 
     306 * Load all plugins 
     307 * 
     308 * Load all plugin modules we can find. 
     309 * Fills the module bank structure with the plugin modules. 
     310 * \param p_this vlc object structure 
     311 * \return nothing 
     312 */ 
    300313void __module_LoadPlugins( vlc_object_t * p_this ) 
    301314{ 
     
    329342} 
    330343 
    331 /***************************************************************************** 
    332  * module_IsCapable: checks whether a module implements a capability. 
    333  *****************************************************************************/ 
     344/** 
     345 * Checks whether a module implements a capability. 
     346 * 
     347 * \param m the module 
     348 * \param cap the capability to check 
     349 * \return TRUE if the module have the capability 
     350 */ 
    334351vlc_bool_t module_IsCapable( const module_t *m, const char *cap ) 
    335352{ 
     
    337354} 
    338355 
    339 /***************************************************************************** 
    340  * module_GetObjName: internal name of a module. 
    341  *****************************************************************************/ 
     356/** 
     357 * Get the internal name of a module 
     358 * 
     359 * \param m the module 
     360 * \return the module name 
     361 */ 
    342362const char *module_GetObjName( const module_t *m ) 
    343363{ 
     
    345365} 
    346366 
    347 /***************************************************************************** 
    348  * module_GetName: human-friendly name of a module. 
    349  *****************************************************************************/ 
     367/** 
     368 * Get the human-friendly name of a module. 
     369 * 
     370 * \param m the module 
     371 * \param long_name TRUE to have the long name of the module 
     372 * \return the short or long name of the module 
     373 */ 
    350374const char *module_GetName( const module_t *m, vlc_bool_t long_name ) 
    351375{ 
    352376    if( long_name && ( m->psz_longname != NULL) ) 
    353377        return m->psz_longname; 
    354   
     378 
    355379    return m->psz_shortname ?: m->psz_object_name; 
    356380} 
    357381 
     382/** 
     383 * Get the help for a module 
     384 * 
     385 * \param m the module 
     386 * \return the help 
     387 */ 
    358388const char *module_GetHelp( const module_t *m ) 
    359389{ 
     
    361391} 
    362392 
    363 /***************************************************************************** 
    364  * module_Need: return the best module function, given a capability list. 
    365  ***************************************************************************** 
    366  * This function returns the module that best fits the asked capabilities. 
    367  *****************************************************************************/ 
     393/** 
     394 * module Need 
     395 * 
     396 * Return the best module function, given a capability list. 
     397 * \param p_this the vlc object 
     398 * \param psz_capability list of capabilities needed 
     399 * \param psz_name name of the module asked 
     400 * \param b_strict TRUE yto use the strict mode 
     401 * \return the module or NULL in case of a failure 
     402 */ 
    368403module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability, 
    369404                          const char *psz_name, vlc_bool_t b_strict ) 
     
    670705} 
    671706 
    672 /***************************************************************************** 
    673  * module_Unneed: decrease the usage count of a module. 
    674  ***************************************************************************** 
     707/** 
     708 * Module unneed 
     709 * 
    675710 * This function must be called by the thread that called module_Need, to 
    676711 * decrease the reference count and allow for hiding of modules. 
    677  *****************************************************************************/ 
     712 * \param p_this vlc object structure 
     713 * \param p_module the module structure 
     714 * \return nothing 
     715 */ 
    678716void __module_Unneed( vlc_object_t * p_this, module_t * p_module ) 
    679717{ 
     
    691729} 
    692730 
    693 /***************************************************************************** 
    694  * module_Find: get a pointer to a module_t given it's name. 
    695  *****************************************************************************/ 
     731/** 
     732 * Get a pointer to a module_t given it's name. 
     733 * 
     734 * \param p_this vlc object structure 
     735 * \param psz_name the name of the module 
     736 * \return a pointer to the module or NULL in case of a failure 
     737 */ 
    696738module_t *__module_Find( vlc_object_t *p_this, const char * psz_name ) 
    697739{ 
     
    716758 
    717759 
    718 /***************************************************************************** 
    719  * module_Put: release a module_t pointer from module_Find(). 
    720  *****************************************************************************/ 
    721 void module_Put ( module_t *module ) 
    722 
    723     vlc_object_release ( module ); 
    724 
    725  
    726  
    727 /***************************************************************************** 
    728  * module_Exists: tell if a module exists. 
    729  ***************************************************************************** 
    730  * This function is a boolean function that tells if a module exist or not. 
    731  *****************************************************************************/ 
    732 vlc_bool_t __module_Exists(  vlc_object_t *p_this, const char * psz_name ) 
     760/** 
     761 * Release a module_t pointer from module_Find(). 
     762 * 
     763 * \param module the module to release 
     764 * \return nothing 
     765 */ 
     766void module_Put( module_t *module ) 
     767
     768    vlc_object_release( module ); 
     769
     770 
     771 
     772/** 
     773 * Tell if a module exists and release it in thic case 
     774 * 
     775 * \param p_this vlc object structure 
     776 * \param psz_name th name of the module 
     777 * \return TRUE if the module exists 
     778 */ 
     779vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name ) 
    733780{ 
    734781    module_t *p_module = __module_Find( p_this, psz_name ); 
     
    744791} 
    745792 
    746 /***************************************************************************** 
    747  * module_GetModuleNamesForCapability: Return a NULL terminated array with the 
    748  * names of the modules that have a certain capability. 
     793/** 
     794 * GetModuleNamesForCapability 
     795 * 
     796 * Return a NULL terminated array with the names of the modules 
     797 * that have a certain capability. 
    749798 * Free after uses both the string and the table. 
    750  *****************************************************************************/ 
     799 * \param p_this vlc object structure 
     800 * \param psz_capability the capability asked 
     801 * \param pppsz_longname an pointer to an array of string to contain 
     802    the long names of the modules. If set to NULL the function don't use it. 
     803 * \return the NULL terminated array 
     804 */ 
    751805char ** __module_GetModulesNamesForCapability( vlc_object_t *p_this, 
    752                                                const char * psz_capability, 
     806                                               const char *psz_capability, 
    753807                                               char ***pppsz_longname ) 
    754808{ 
    755809    vlc_list_t *p_list; 
    756810    int i, j, count = 0; 
    757     char ** psz_ret; 
    758  
    759     /* Do it in two passes */ 
     811    char **psz_ret; 
     812 
     813    /* Do it in two passes : count the number of modules before */ 
    760814    p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE ); 
    761815    for( i = 0 ; i < p_list->i_count; i++) 
     
    766820            count++; 
    767821    } 
     822    /* FIXME: must check the return value and modify the calling functions 
     823              to test for a NULL : potential segfault */ 
    768824    psz_ret = malloc( sizeof(char*) * (count+1) ); 
    769825    if( pppsz_longname ) 
     
    796852} 
    797853 
    798  
    799 module_config_t *module_GetConfig (const module_t *module, unsigned *restrict psize) 
     854/** 
     855 * Get the configuration of a module 
     856 * 
     857 * \param module the module 
     858 * \param psize the size of the configuration returned 
     859 * \return the configuration as an array 
     860 */ 
     861module_config_t *module_GetConfig( const module_t *module, unsigned *restrict psize ) 
    800862{ 
    801863    unsigned i,j; 
    802864    unsigned size = module->confsize; 
    803     module_config_t *config = malloc (size * sizeof (*config)); 
    804  
    805     assert (psize != NULL); 
     865    module_config_t *config = malloc( size * sizeof( *config ) ); 
     866 
     867    assert( psize != NULL ); 
    806868    *psize = 0; 
    807869 
    808     for (i = 0, j = 0; i < size; i++
     870    for( i = 0, j = 0; i < size; i++
    809871    { 
    810872        const module_config_t *item = module->p_config + i; 
    811         if (item->b_internal /* internal option */ 
     873        if( item->b_internal /* internal option */ 
    812874         || item->b_unsaveable /* non-modifiable option */ 
    813          || item->b_removed /* removed option */
     875         || item->b_removed /* removed option */
    814876            continue; 
    815877 
    816         if (config != NULL
    817             memcpy (config + j, item, sizeof (*config)); 
     878        if( config != NULL
     879            memcpy( config + j, item, sizeof( *config ) ); 
    818880        j++; 
    819881    } 
     
    823885} 
    824886 
    825 void module_PutConfig (module_config_t *config) 
    826 
    827     free (config); 
     887/** 
     888 * Release the configuration 
     889 * 
     890 * \param the configuration 
     891 * \return nothing 
     892 */ 
     893void module_PutConfig( module_config_t *config ) 
     894
     895    free( config ); 
    828896} 
    829897 
     
    851919    path[sizeof(path)/sizeof(path[0]) - 2] = userpath; 
    852920 
    853     for (ppsz_path = path; *ppsz_path != NULL; ppsz_path++
     921    for( ppsz_path = path; *ppsz_path != NULL; ppsz_path++
    854922    { 
    855923        char *psz_fullpath; 
    856924 
    857         if (!**ppsz_path) continue; 
     925        if( !**ppsz_path ) continue; 
    858926 
    859927#if defined( SYS_BEOS ) || defined( __APPLE__ ) || defined( WIN32 ) 
     
    10231091 
    10241092    /* Parse the directory and try to load all files it contains. */ 
    1025     while( !p_this->p_libvlc->b_die && (file = readdir( dir )) ) 
     1093    while( !p_this->p_libvlc->b_die && ( file = readdir( dir ) ) ) 
    10261094    { 
    10271095        struct stat statbuf;