Changeset 1468c26bba992693155aa7ea88cca07a4c9b8d5f
- Timestamp:
- 05/07/08 17:33:46
(5 months ago)
- Author:
- Pierre d'Herbemont <pdherbemont@videolan.org>
- git-committer:
- Pierre d'Herbemont <pdherbemont@videolan.org> 1215272026 +0200
- git-parent:
[1ce5ed60205d0ea92ea6f0602576c8a5a900c812]
- git-author:
- Pierre d'Herbemont <pdherbemont@videolan.org> 1215269671 +0200
- Message:
module: Define module_GetMainModule and module_IsMainModule.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rfbb8255 |
r1468c26 |
|
| 25 | 25 | * Exported functions. |
|---|
| 26 | 26 | *****************************************************************************/ |
|---|
| | 27 | |
|---|
| 27 | 28 | #define module_Need(a,b,c,d) __module_Need(VLC_OBJECT(a),b,c,d) |
|---|
| 28 | 29 | VLC_EXPORT( module_t *, __module_Need, ( vlc_object_t *, const char *, const char *, bool ) ); |
|---|
| … | … | |
| 38 | 39 | VLC_EXPORT( module_config_t *, module_GetConfig, ( const module_t *, unsigned * ) ); |
|---|
| 39 | 40 | VLC_EXPORT( void, module_PutConfig, ( module_config_t * ) ); |
|---|
| 40 | | |
|---|
| 41 | 41 | |
|---|
| 42 | 42 | /* Return a NULL terminated array with the names of the modules that have a |
|---|
| … | … | |
| 54 | 54 | #define module_GetLongName( m ) module_GetName( m, true ) |
|---|
| 55 | 55 | VLC_EXPORT( const char *, module_GetHelp, ( const module_t *m ) ); |
|---|
| | 56 | |
|---|
| | 57 | |
|---|
| | 58 | #define module_GetMainModule(a) __module_GetMainModule(VLC_OBJECT(a)) |
|---|
| | 59 | static inline module_t * __module_GetMainModule( vlc_object_t * p_this ) |
|---|
| | 60 | { |
|---|
| | 61 | module_t * p_module; |
|---|
| | 62 | module_t * p_main_module = NULL; |
|---|
| | 63 | vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, |
|---|
| | 64 | FIND_ANYWHERE ); |
|---|
| | 65 | if( !p_list ) return NULL; |
|---|
| | 66 | |
|---|
| | 67 | /* Find the main module */ |
|---|
| | 68 | for( int i = 0; i < p_list->i_count; i++ ) |
|---|
| | 69 | { |
|---|
| | 70 | p_module = (module_t *)p_list->p_values[i].p_object; |
|---|
| | 71 | if( strcmp( module_GetObjName( p_module ), "main" ) == 0 ) |
|---|
| | 72 | { |
|---|
| | 73 | p_main_module = p_module; |
|---|
| | 74 | vlc_object_yield( (vlc_object_t*)p_main_module ); |
|---|
| | 75 | break; |
|---|
| | 76 | } |
|---|
| | 77 | } |
|---|
| | 78 | vlc_list_release( p_list ); |
|---|
| | 79 | return p_main_module; |
|---|
| | 80 | } |
|---|
| | 81 | |
|---|
| | 82 | static inline bool module_IsMainModule( module_t * p_module ) |
|---|
| | 83 | { |
|---|
| | 84 | return !strcmp( module_GetObjName( p_module ), "main" ); |
|---|
| | 85 | } |
|---|