]> git.sesse.net Git - vlc/blob - plugins/kde/kde.cpp
37a32810591f8fe2d5519904017e52b0d3f029e5
[vlc] / plugins / kde / kde.cpp
1 /***************************************************************************
2                           kde.cpp  -  description
3                              -------------------
4     begin                : Sun Mar 25 2001
5     copyright            : (C) 2001 by andres
6     email                : dae@chez.com
7  ***************************************************************************/
8 #define MODULE_NAME kde
9 #include "intf_plugin.h"
10
11 extern "C"
12 {
13
14 /*****************************************************************************
15  * Build configuration tree.
16  *****************************************************************************/
17 MODULE_CONFIG_START
18 ADD_WINDOW( "Configuration for KDE module" )
19     ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
20 MODULE_CONFIG_END
21
22 /*****************************************************************************
23  * Capabilities defined in the other files.
24  *****************************************************************************/
25
26 void _M( intf_getfunctions )( function_list_t * p_function_list );
27
28 /*****************************************************************************
29  * InitModule: get the module structure and configuration.
30  *****************************************************************************
31  * We have to fill psz_name, psz_longname and psz_version. These variables
32  * will be strdup()ed later by the main application because the module can
33  * be unloaded later to save memory, and we want to be able to access this
34  * data even after the module has been unloaded.
35  *****************************************************************************/
36 MODULE_INIT
37 {
38     p_module->psz_name = MODULE_STRING;
39     p_module->psz_longname = "KDE interface module";
40     p_module->psz_version = VERSION;
41
42     p_module->i_capabilities = MODULE_CAPABILITY_NULL
43                                 | MODULE_CAPABILITY_INTF;
44
45     return( 0 );
46 }
47
48 /*****************************************************************************
49  * ActivateModule: set the module to an usable state.
50  *****************************************************************************
51  * This function fills the capability functions and the configuration
52  * structure. Once ActivateModule() has been called, the i_usage can
53  * be set to 0 and calls to NeedModule() be made to increment it. To unload
54  * the module, one has to wait until i_usage == 0 and call DeactivateModule().
55  *****************************************************************************/
56 MODULE_ACTIVATE
57 {
58     p_module->p_functions =
59                 ( module_functions_t * )malloc( sizeof( module_functions_t ) );
60     if( p_module->p_functions == NULL )
61     {
62         return( -1 );
63     }
64
65     _M( intf_getfunctions )( &p_module->p_functions->intf );
66
67     p_module->p_config = p_config;
68
69     return( 0 );
70 }
71
72 /*****************************************************************************
73  * DeactivateModule: make sure the module can be unloaded.
74  *****************************************************************************
75  * This function must only be called when i_usage == 0. If it successfully
76  * returns, i_usage can be set to -1 and the module unloaded. Be careful to
77  * lock usage_lock during the whole process.
78  *****************************************************************************/
79 MODULE_DEACTIVATE
80 {
81     free( p_module->p_functions );
82
83     return( 0 );
84 }
85
86 } /* extern "C" */