/*****************************************************************************
- * yuv.c : C YUV functions for vlc
+ * yuv.c : C YUV module for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+#define MODULE_NAME yuv
+
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
-#include "plugins.h"
-#include "interface.h"
-#include "audio_output.h"
#include "video.h"
#include "video_output.h"
-#include "plugins_export.h"
+#include "modules.h"
+#include "modules_inner.h"
/*****************************************************************************
- * Exported prototypes
+ * Local and extern prototypes.
*****************************************************************************/
-void yuv_GetPlugin( p_vout_thread_t p_vout );
+extern void yuv_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
- * GetConfig: get the plugin structure and configuration
+ * Build configuration tree.
*****************************************************************************/
-plugin_info_t * GetConfig( void )
-{
- plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+MODULE_CONFIG_START
+ADD_WINDOW( "Configuration for YUV module" )
+ ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
+MODULE_CONFIG_END
- p_info->psz_name = "C YUV to RGB transformations";
- p_info->psz_version = VERSION;
- p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
+/*****************************************************************************
+ * InitModule: get the module structure and configuration.
+ *****************************************************************************
+ * We have to fill psz_name, psz_longname and psz_version. These variables
+ * will be strdup()ed later by the main application because the module can
+ * be unloaded later to save memory, and we want to be able to access this
+ * data even after the module has been unloaded.
+ *****************************************************************************/
+int InitModule( module_t * p_module )
+{
+ p_module->psz_name = MODULE_STRING;
+ p_module->psz_longname = "YUV transformations module";
+ p_module->psz_version = VERSION;
- p_info->aout_GetPlugin = NULL;
- p_info->vout_GetPlugin = NULL;
- p_info->intf_GetPlugin = NULL;
- p_info->yuv_GetPlugin = yuv_GetPlugin;
+ p_module->i_capabilities = MODULE_CAPABILITY_NULL
+ | MODULE_CAPABILITY_YUV;
- return( p_info );
+ return( 0 );
}
/*****************************************************************************
- * Test: tests if the plugin can be launched
+ * ActivateModule: set the module to an usable state.
+ *****************************************************************************
+ * This function fills the capability functions and the configuration
+ * structure. Once ActivateModule() has been called, the i_usage can
+ * be set to 0 and calls to NeedModule() be made to increment it. To unload
+ * the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
-int Test( void )
+int ActivateModule( module_t * p_module )
{
- return( 1 );
+ p_module->p_functions = malloc( sizeof( module_functions_t ) );
+ if( p_module->p_functions == NULL )
+ {
+ return( -1 );
+ }
+
+ yuv_getfunctions( &p_module->p_functions->yuv );
+
+ p_module->p_config = p_config;
+
+ return( 0 );
}
/*****************************************************************************
- * Following functions are only called through the p_info structure
+ * DeactivateModule: make sure the module can be unloaded.
+ *****************************************************************************
+ * This function must only be called when i_usage == 0. If it successfully
+ * returns, i_usage can be set to -1 and the module unloaded. Be careful to
+ * lock usage_lock during the whole process.
*****************************************************************************/
-
-void yuv_GetPlugin( p_vout_thread_t p_vout )
+int DeactivateModule( module_t * p_module )
{
- p_vout->p_yuv_init = yuv_SysInit;
- p_vout->p_yuv_reset = yuv_SysReset;
- p_vout->p_yuv_end = yuv_SysEnd;
+ free( p_module->p_functions );
+
+ return( 0 );
}