Changeset 7f1f444ca32b4670e34a2a52b5e99e5381c9333a
- 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
| r1af701c |
r7f1f444 |
|
| 107 | 107 | static void module_LoadMain( vlc_object_t *p_this ); |
|---|
| 108 | 108 | |
|---|
| 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 |
|---|
| 113 | 113 | * on with all the modules found. |
|---|
| 114 | | *****************************************************************************/ |
|---|
| | 114 | * \param p_this vlc object structure |
|---|
| | 115 | * \return nothing |
|---|
| | 116 | */ |
|---|
| 115 | 117 | void __module_InitBank( vlc_object_t *p_this ) |
|---|
| 116 | 118 | { |
|---|
| … | … | |
| 150 | 152 | |
|---|
| 151 | 153 | |
|---|
| 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 |
|---|
| 156 | 158 | * bank in case of success. |
|---|
| 157 | | *****************************************************************************/ |
|---|
| | 159 | * \param p_this vlc object structure |
|---|
| | 160 | * \return nothing |
|---|
| | 161 | */ |
|---|
| 158 | 162 | void __module_EndBank( vlc_object_t *p_this ) |
|---|
| 159 | 163 | { |
|---|
| … | … | |
| 180 | 184 | var_Destroy( p_libvlc_global, "libvlc" ); |
|---|
| 181 | 185 | |
|---|
| | 186 | /* Save the configuration */ |
|---|
| 182 | 187 | config_AutoSaveConfigFile( p_this ); |
|---|
| 183 | 188 | |
|---|
| … | … | |
| 189 | 194 | if( p_bank->pp_loaded_cache[p_bank->i_loaded_cache] ) |
|---|
| 190 | 195 | { |
|---|
| 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 ); |
|---|
| 193 | 199 | free( p_bank->pp_loaded_cache[p_bank->i_loaded_cache]->psz_file ); |
|---|
| 194 | 200 | free( p_bank->pp_loaded_cache[p_bank->i_loaded_cache] ); |
|---|
| … | … | |
| 237 | 243 | } |
|---|
| 238 | 244 | |
|---|
| 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. |
|---|
| 243 | 249 | * This is very useful as it will allow us to consider the main program just |
|---|
| 244 | 250 | * as another module, and for instance the configuration options of main will |
|---|
| 245 | 251 | * 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 | */ |
|---|
| 247 | 255 | static void module_LoadMain( vlc_object_t *p_this ) |
|---|
| 248 | 256 | { |
|---|
| … | … | |
| 266 | 274 | } |
|---|
| 267 | 275 | |
|---|
| 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 | */ |
|---|
| 273 | 283 | void __module_LoadBuiltins( vlc_object_t * p_this ) |
|---|
| 274 | 284 | { |
|---|
| … | … | |
| 293 | 303 | } |
|---|
| 294 | 304 | |
|---|
| 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 | */ |
|---|
| 300 | 313 | void __module_LoadPlugins( vlc_object_t * p_this ) |
|---|
| 301 | 314 | { |
|---|
| … | … | |
| 329 | 342 | } |
|---|
| 330 | 343 | |
|---|
| 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 | */ |
|---|
| 334 | 351 | vlc_bool_t module_IsCapable( const module_t *m, const char *cap ) |
|---|
| 335 | 352 | { |
|---|
| … | … | |
| 337 | 354 | } |
|---|
| 338 | 355 | |
|---|
| 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 | */ |
|---|
| 342 | 362 | const char *module_GetObjName( const module_t *m ) |
|---|
| 343 | 363 | { |
|---|
| … | … | |
| 345 | 365 | } |
|---|
| 346 | 366 | |
|---|
| 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 | */ |
|---|
| 350 | 374 | const char *module_GetName( const module_t *m, vlc_bool_t long_name ) |
|---|
| 351 | 375 | { |
|---|
| 352 | 376 | if( long_name && ( m->psz_longname != NULL) ) |
|---|
| 353 | 377 | return m->psz_longname; |
|---|
| 354 | | |
|---|
| | 378 | |
|---|
| 355 | 379 | return m->psz_shortname ?: m->psz_object_name; |
|---|
| 356 | 380 | } |
|---|
| 357 | 381 | |
|---|
| | 382 | /** |
|---|
| | 383 | * Get the help for a module |
|---|
| | 384 | * |
|---|
| | 385 | * \param m the module |
|---|
| | 386 | * \return the help |
|---|
| | 387 | */ |
|---|
| 358 | 388 | const char *module_GetHelp( const module_t *m ) |
|---|
| 359 | 389 | { |
|---|
| … | … | |
| 361 | 391 | } |
|---|
| 362 | 392 | |
|---|
| 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 | */ |
|---|
| 368 | 403 | module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability, |
|---|
| 369 | 404 | const char *psz_name, vlc_bool_t b_strict ) |
|---|
| … | … | |
| 670 | 705 | } |
|---|
| 671 | 706 | |
|---|
| 672 | | /***************************************************************************** |
|---|
| 673 | | * module_Unneed: decrease the usage count of a module. |
|---|
| 674 | | ***************************************************************************** |
|---|
| | 707 | /** |
|---|
| | 708 | * Module unneed |
|---|
| | 709 | * |
|---|
| 675 | 710 | * This function must be called by the thread that called module_Need, to |
|---|
| 676 | 711 | * 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 | */ |
|---|
| 678 | 716 | void __module_Unneed( vlc_object_t * p_this, module_t * p_module ) |
|---|
| 679 | 717 | { |
|---|
| … | … | |
| 691 | 729 | } |
|---|
| 692 | 730 | |
|---|
| 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 | */ |
|---|
| 696 | 738 | module_t *__module_Find( vlc_object_t *p_this, const char * psz_name ) |
|---|
| 697 | 739 | { |
|---|
| … | … | |
| 716 | 758 | |
|---|
| 717 | 759 | |
|---|
| 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 | */ |
|---|
| | 766 | void 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 | */ |
|---|
| | 779 | vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name ) |
|---|
| 733 | 780 | { |
|---|
| 734 | 781 | module_t *p_module = __module_Find( p_this, psz_name ); |
|---|
| … | … | |
| 744 | 791 | } |
|---|
| 745 | 792 | |
|---|
| 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. |
|---|
| 749 | 798 | * 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 | */ |
|---|
| 751 | 805 | char ** __module_GetModulesNamesForCapability( vlc_object_t *p_this, |
|---|
| 752 | | const char * psz_capability, |
|---|
| | 806 | const char *psz_capability, |
|---|
| 753 | 807 | char ***pppsz_longname ) |
|---|
| 754 | 808 | { |
|---|
| 755 | 809 | vlc_list_t *p_list; |
|---|
| 756 | 810 | 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 */ |
|---|
| 760 | 814 | p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE ); |
|---|
| 761 | 815 | for( i = 0 ; i < p_list->i_count; i++) |
|---|
| … | … | |
| 766 | 820 | count++; |
|---|
| 767 | 821 | } |
|---|
| | 822 | /* FIXME: must check the return value and modify the calling functions |
|---|
| | 823 | to test for a NULL : potential segfault */ |
|---|
| 768 | 824 | psz_ret = malloc( sizeof(char*) * (count+1) ); |
|---|
| 769 | 825 | if( pppsz_longname ) |
|---|
| … | … | |
| 796 | 852 | } |
|---|
| 797 | 853 | |
|---|
| 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 | */ |
|---|
| | 861 | module_config_t *module_GetConfig( const module_t *module, unsigned *restrict psize ) |
|---|
| 800 | 862 | { |
|---|
| 801 | 863 | unsigned i,j; |
|---|
| 802 | 864 | 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 ); |
|---|
| 806 | 868 | *psize = 0; |
|---|
| 807 | 869 | |
|---|
| 808 | | for (i = 0, j = 0; i < size; i++) |
|---|
| | 870 | for( i = 0, j = 0; i < size; i++ ) |
|---|
| 809 | 871 | { |
|---|
| 810 | 872 | const module_config_t *item = module->p_config + i; |
|---|
| 811 | | if (item->b_internal /* internal option */ |
|---|
| | 873 | if( item->b_internal /* internal option */ |
|---|
| 812 | 874 | || item->b_unsaveable /* non-modifiable option */ |
|---|
| 813 | | || item->b_removed /* removed option */) |
|---|
| | 875 | || item->b_removed /* removed option */ ) |
|---|
| 814 | 876 | continue; |
|---|
| 815 | 877 | |
|---|
| 816 | | if (config != NULL) |
|---|
| 817 | | memcpy (config + j, item, sizeof (*config)); |
|---|
| | 878 | if( config != NULL ) |
|---|
| | 879 | memcpy( config + j, item, sizeof( *config ) ); |
|---|
| 818 | 880 | j++; |
|---|
| 819 | 881 | } |
|---|
| … | … | |
| 823 | 885 | } |
|---|
| 824 | 886 | |
|---|
| 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 | */ |
|---|
| | 893 | void module_PutConfig( module_config_t *config ) |
|---|
| | 894 | { |
|---|
| | 895 | free( config ); |
|---|
| 828 | 896 | } |
|---|
| 829 | 897 | |
|---|
| … | … | |
| 851 | 919 | path[sizeof(path)/sizeof(path[0]) - 2] = userpath; |
|---|
| 852 | 920 | |
|---|
| 853 | | for (ppsz_path = path; *ppsz_path != NULL; ppsz_path++) |
|---|
| | 921 | for( ppsz_path = path; *ppsz_path != NULL; ppsz_path++ ) |
|---|
| 854 | 922 | { |
|---|
| 855 | 923 | char *psz_fullpath; |
|---|
| 856 | 924 | |
|---|
| 857 | | if (!**ppsz_path) continue; |
|---|
| | 925 | if( !**ppsz_path ) continue; |
|---|
| 858 | 926 | |
|---|
| 859 | 927 | #if defined( SYS_BEOS ) || defined( __APPLE__ ) || defined( WIN32 ) |
|---|
| … | … | |
| 1023 | 1091 | |
|---|
| 1024 | 1092 | /* 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 ) ) ) |
|---|
| 1026 | 1094 | { |
|---|
| 1027 | 1095 | struct stat statbuf; |
|---|