Changeset 6c11c08a800fa57846e69fb86a42164f2570dfe4
- Timestamp:
- 04/08/07 19:28:18
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1186248498 +0000
- git-parent:
[4c4c4ce26e381d5e03b016d384e84d8a94721685]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1186248498 +0000
- Message:
Partially abstract module_t: add module_IsCapable()
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rcba87f6 |
r6c11c08 |
|
| 47 | 47 | * Module descriptor |
|---|
| 48 | 48 | */ |
|---|
| | 49 | /* FIXME: scheduled for privatization */ |
|---|
| 49 | 50 | struct module_t |
|---|
| 50 | 51 | { |
|---|
| … | … | |
| 66 | 67 | const char *pp_shortcuts[ MODULE_SHORTCUT_MAX ]; |
|---|
| 67 | 68 | |
|---|
| 68 | | const char *psz_capability; /**< Capability */ |
|---|
| | 69 | char *psz_capability; /**< Capability */ |
|---|
| 69 | 70 | int i_score; /**< Score for the capability */ |
|---|
| 70 | 71 | uint32_t i_cpu; /**< Required CPU capabilities */ |
|---|
| … | … | |
| 111 | 112 | VLC_EXPORT( int, vlc_module_set, (module_t *module, int propid, void *value) ); |
|---|
| 112 | 113 | |
|---|
| 113 | | enum |
|---|
| | 114 | enum vlc_module_properties |
|---|
| 114 | 115 | { |
|---|
| 115 | 116 | /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI! |
|---|
| … | … | |
| 129 | 130 | }; |
|---|
| 130 | 131 | |
|---|
| | 132 | VLC_EXPORT( vlc_bool_t, module_IsCapable, ( const module_t *, const char *cap ) ); |
|---|
| r51681a2 |
r6c11c08 |
|
| 178 | 178 | __module_Need |
|---|
| 179 | 179 | __module_Unneed |
|---|
| | 180 | module_IsCapable |
|---|
| 180 | 181 | __msg_Dbg |
|---|
| 181 | 182 | __msg_Err |
|---|
| r8952d64 |
r6c11c08 |
|
| 385 | 385 | |
|---|
| 386 | 386 | /***************************************************************************** |
|---|
| | 387 | * module_IsCapable: checks whether a module implements a capability. |
|---|
| | 388 | *****************************************************************************/ |
|---|
| | 389 | vlc_bool_t module_IsCapable( const module_t *m, const char *cap ) |
|---|
| | 390 | { |
|---|
| | 391 | return !strcmp( m->psz_capability, cap ); |
|---|
| | 392 | } |
|---|
| | 393 | |
|---|
| | 394 | /***************************************************************************** |
|---|
| 387 | 395 | * module_Need: return the best module function, given a capability list. |
|---|
| 388 | 396 | ***************************************************************************** |
|---|
| … | … | |
| 480 | 488 | |
|---|
| 481 | 489 | /* Test that this module can do what we need */ |
|---|
| 482 | | if( strcmp( p_module->psz_capability, psz_capability ) ) |
|---|
| | 490 | if( !module_IsCapable( p_module, psz_capability ) ) |
|---|
| 483 | 491 | { |
|---|
| 484 | 492 | /* Don't recurse through the sub-modules because vlc_list_find() |
|---|
| … | … | |
| 1200 | 1208 | |
|---|
| 1201 | 1209 | free( (void*)p_module->psz_object_name ); |
|---|
| 1202 | | free( (void*)p_module->psz_capability ); |
|---|
| | 1210 | free( p_module->psz_capability ); |
|---|
| 1203 | 1211 | free( (void*)p_module->psz_shortname ); |
|---|
| 1204 | 1212 | free( (void*)p_module->psz_longname ); |
|---|