1 /*****************************************************************************
2 * entry.c : Callbacks for module entry point
3 *****************************************************************************
4 * Copyright (C) 2001-2007 the VideoLAN team
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
25 module_t *vlc_submodule_create (module_t *module)
27 assert (module != NULL);
28 assert (!module->b_submodule); // subsubmodules are not supported
31 (module_t *)vlc_object_create (module, VLC_OBJECT_MODULE);
32 if (submodule == NULL)
35 vlc_object_attach (submodule, module);
36 submodule->b_submodule = VLC_TRUE;
38 /* Muahahaha! Heritage! Polymorphism! Ugliness!! */
39 memcpy (submodule->pp_shortcuts, module->pp_shortcuts,
40 sizeof (submodule->pp_shortcuts));
42 submodule->psz_object_name = module->psz_object_name;
43 submodule->psz_shortname = module->psz_shortname;
44 submodule->psz_longname = module->psz_longname;
45 submodule->psz_program = module->psz_program;
46 submodule->psz_capability = module->psz_capability;
47 submodule->i_score = module->i_score;
48 submodule->i_cpu = module->i_cpu;
49 submodule->pf_activate = NULL;
50 submodule->pf_deactivate = NULL;
54 int vlc_module_set (module_t *module, int propid, void *value)
58 case VLC_MODULE_CPU_REQUIREMENT:
59 assert (!module->b_submodule);
60 module->i_cpu |= (int)value;
63 case VLC_MODULE_SHORTCUT:
66 for (i = 0; module->pp_shortcuts[i] != NULL; i++);
67 if (i >= MODULE_SHORTCUT_MAX)
70 module->pp_shortcuts[i] = (char *)value;
74 case VLC_MODULE_SHORTNAME:
75 module->psz_shortname = (char *)value;
78 case VLC_MODULE_DESCRIPTION:
79 module->psz_longname = (char *)value;
83 module->psz_help = (char *)value;
86 case VLC_MODULE_CAPABILITY:
87 module->psz_capability = (char *)value;
90 case VLC_MODULE_SCORE:
91 module->i_score = (int)value;
94 case VLC_MODULE_PROGRAM:
95 module->psz_program = (char *)value;
98 case VLC_MODULE_CB_OPEN:
99 module->pf_activate = (int (*) (vlc_object_t *))value;
102 case VLC_MODULE_CB_CLOSE:
103 module->pf_deactivate = (void (*) (vlc_object_t *))value;
106 case VLC_MODULE_UNLOADABLE:
107 module->b_unloadable = (value != NULL);
111 msg_Err (module, "unknown module property %d", propid);
112 msg_Err (module, "LibVLC might be too old to use this module.");