* modules_macros.h : Macros used from within a module.
*****************************************************************************
* Copyright (C) 2001-2006 the VideoLAN team
- * $Id$
+ * Copyright © 2007-2008 Rémi Denis-Courmont
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#if !defined( __LIBVLC__ )
- #error You are not libvlc or one of its plugins. You cannot include this file
-#endif
+#ifndef LIBVLC_MODULES_MACROS_H
+# define LIBVLC_MODULES_MACROS_H 1
/*****************************************************************************
* If we are not within a module, assume we're in the vlc core.
/* If the module is built-in, then we need to define foo_InitModule instead
* of InitModule. Same for Activate- and DeactivateModule. */
-#if defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
+#ifdef __PLUGIN__
# define E_( function ) CONCATENATE( function, MODULE_SYMBOL )
# define __VLC_SYMBOL( symbol ) CONCATENATE( symbol, MODULE_SYMBOL )
#else
{ \
module_config_t *p_config = NULL; \
if (vlc_module_set (p_module, VLC_MODULE_NAME, \
- (void *)(MODULE_STRING))) \
+ (const char *)(MODULE_STRING))) \
goto error; \
{ \
module_t *p_submodule = p_module /* the ; gets added */
return VLC_SUCCESS; \
\
error: \
- /* FIXME: config_Free( p_module ); */ \
- /* FIXME: cleanup submodules objects ??? */ \
return VLC_EGENERIC; \
} \
struct _u_n_u_s_e_d_ /* the ; gets added */
#define add_requirement( cap ) \
if (vlc_module_set (p_module, VLC_MODULE_CPU_REQUIREMENT, \
- (void *)(intptr_t)(CPU_CAPABILITY_##cap))) goto error
+ (int)(CPU_CAPABILITY_##cap))) \
+ goto error
#define add_shortcut( shortcut ) \
- if (vlc_module_set (p_submodule, VLC_MODULE_SHORTCUT, (void*)(shortcut))) \
+ if (vlc_module_set (p_submodule, VLC_MODULE_SHORTCUT, (int)(shortcut))) \
goto error
#define set_shortname( shortname ) \
if (vlc_module_set (p_submodule, VLC_MODULE_SHORTNAME, \
- (void*)(shortname))) goto error;
+ (const char *)(shortname))) \
+ goto error
#define set_description( desc ) \
- if (vlc_module_set (p_submodule, VLC_MODULE_DESCRIPTION, (void*)(desc))) \
+ if (vlc_module_set (p_submodule, VLC_MODULE_DESCRIPTION, \
+ (const char *)(desc))) \
goto error
#define set_help( help ) \
- if (vlc_module_set (p_submodule, VLC_MODULE_HELP, (void*)(help))) \
+ if (vlc_module_set (p_submodule, VLC_MODULE_HELP, (const char *)(help))) \
goto error
#define set_capability( cap, score ) \
- if (vlc_module_set (p_submodule, VLC_MODULE_CAPABILITY, (void *)(cap)) \
- || vlc_module_set (p_submodule, VLC_MODULE_SCORE, \
- (void *)(intptr_t)(score))) \
+ if (vlc_module_set (p_submodule, VLC_MODULE_CAPABILITY, (int)(cap)) \
+ || vlc_module_set (p_submodule, VLC_MODULE_SCORE, (int)(score))) \
goto error
#define set_callbacks( activate, deactivate ) \
- if (vlc_module_set (p_submodule, VLC_MODULE_CB_OPEN, (void *)(activate)) \
- || vlc_module_set (p_submodule, VLC_MODULE_CB_CLOSE, \
- (void *)(deactivate))) \
+ if (vlc_module_set (p_submodule, VLC_MODULE_CB_OPEN, activate) \
+ || vlc_module_set (p_submodule, VLC_MODULE_CB_CLOSE, deactivate)) \
goto error
#define linked_with_a_crap_library_which_uses_atexit( ) \
- if (vlc_module_set (p_submodule, VLC_MODULE_UNLOADABLE, NULL)) goto error
+ if (vlc_module_set (p_submodule, VLC_MODULE_NO_UNLOAD)) \
+ goto error
+VLC_EXPORT( module_t *, vlc_module_create, ( vlc_object_t * ) );
+VLC_EXPORT( module_t *, vlc_submodule_create, ( module_t * ) );
+VLC_EXPORT( int, vlc_module_set, (module_t *module, int propid, ...) );
+
+enum vlc_module_properties
+{
+ /* DO NOT EVER REMOVE, INSERT OR REPLACE ANY ITEM! It would break the ABI!
+ * Append new items at the end ONLY. */
+ VLC_MODULE_CPU_REQUIREMENT,
+ VLC_MODULE_SHORTCUT,
+ VLC_MODULE_SHORTNAME,
+ VLC_MODULE_DESCRIPTION,
+ VLC_MODULE_HELP,
+ VLC_MODULE_CAPABILITY,
+ VLC_MODULE_SCORE,
+ VLC_MODULE_PROGRAM,
+ VLC_MODULE_CB_OPEN,
+ VLC_MODULE_CB_CLOSE,
+ VLC_MODULE_NO_UNLOAD,
+ VLC_MODULE_NAME,
+};
+#endif