#include "vlc_stream.h"
#include "vlc_access.h"
#include "vlc_demux.h"
+#include "vlc_codec.h"
#include "vlc_vout.h"
#include "vlc_vout_synchro.h"
{
module_bank_t *p_bank = NULL;
vlc_value_t lockval;
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
p_bank->b_cache = p_bank->b_cache_dirty =
p_bank->b_cache_delete = VLC_FALSE;
- /*
- * Store the symbols to be exported
- */
-#if defined (HAVE_DYNAMIC_PLUGINS) && !defined (HAVE_SHARED_LIBVLC)
- STORE_SYMBOLS( &p_bank->symbols );
-#endif
-
/* Everything worked, attach the object */
p_libvlc_global->p_module_bank = p_bank;
vlc_object_attach( p_bank, p_libvlc_global );
{
module_t * p_next = NULL;
vlc_value_t lockval;
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
static void module_LoadMain( vlc_object_t *p_this )
{
vlc_value_t lockval;
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
void __module_LoadBuiltins( vlc_object_t * p_this )
{
vlc_value_t lockval;
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
{
#ifdef HAVE_DYNAMIC_PLUGINS
vlc_value_t lockval;
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
var_Create( p_libvlc_global, "libvlc", VLC_VAR_MUTEX );
var_Get( p_libvlc_global, "libvlc", &lockval );
#endif
}
+/*****************************************************************************
+ * module_IsCapable: checks whether a module implements a capability.
+ *****************************************************************************/
+vlc_bool_t module_IsCapable( const module_t *m, const char *cap )
+{
+ return !strcmp( m->psz_capability, cap );
+}
+
+/*****************************************************************************
+ * module_GetObjName: internal name of a module.
+ *****************************************************************************/
+const char *module_GetObjName( const module_t *m )
+{
+ return m->psz_object_name;
+}
+
+/*****************************************************************************
+ * module_GetName: human-friendly name of a module.
+ *****************************************************************************/
+const char *module_GetName( const module_t *m, vlc_bool_t long_name )
+{
+ if( long_name && ( m->psz_longname != NULL) )
+ return m->psz_longname;
+
+ return m->psz_shortname ?: m->psz_object_name;
+}
+
+const char *module_GetHelp( const module_t *m )
+{
+ return m->psz_help;
+}
+
/*****************************************************************************
* module_Need: return the best module function, given a capability list.
*****************************************************************************
p_module = (module_t *)p_all->p_values[i_which_module].p_object;
/* Test that this module can do what we need */
- if( strcmp( p_module->psz_capability, psz_capability ) )
+ if( !module_IsCapable( p_module, psz_capability ) )
{
/* Don't recurse through the sub-modules because vlc_list_find()
* will list them anyway. */
}
/*****************************************************************************
- * module_Exists: tell if a module exists.
- *****************************************************************************
- * This function is a boolean function that tells if a module exist or not.
+ * module_FindName: get a pointer to a module_t given it's name.
*****************************************************************************/
-
-vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name )
+module_t *__module_FindName( vlc_object_t *p_this, const char * psz_name )
{
vlc_list_t *p_list;
int i;
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i = 0 ; i < p_list->i_count; i++)
{
- const char *psz_module_name =
- ((module_t *) p_list->p_values[i].p_object)->psz_shortname;
+ module_t *p_module = ((module_t *) p_list->p_values[i].p_object);
+ const char *psz_module_name = p_module->psz_object_name;
if( psz_module_name && !strcmp( psz_module_name, psz_name ) )
{
/* We can release the list, and return yes */
- vlc_list_release( p_list ); return VLC_TRUE;
+ vlc_list_release( p_list );
+ vlc_object_yield( p_module );
+ return p_module;
}
}
- vlc_list_release( p_list ); return VLC_FALSE;
+ vlc_list_release( p_list );
+ return NULL;
+}
+
+/*****************************************************************************
+ * module_Exists: tell if a module exists.
+ *****************************************************************************
+ * This function is a boolean function that tells if a module exist or not.
+ *****************************************************************************/
+vlc_bool_t __module_Exists( vlc_object_t *p_this, const char * psz_name )
+{
+ module_t *p_module = __module_FindName( p_this, psz_name );
+ if( p_module )
+ {
+ vlc_object_release( p_module );
+ return VLC_TRUE;
+ }
+ else
+ {
+ return VLC_FALSE;
+ }
}
#endif
{
if( 0>= asprintf( &psz_fullpath, "%s"DIR_SEP"%s",
- vlc_global( p_this )->psz_vlcpath, *ppsz_path) )
+ vlc_global()->psz_vlcpath, *ppsz_path) )
psz_fullpath = NULL;
}
else
if( p_module )
{
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
/* Everything worked fine !
* The module is ready to be added to the list. */
}
free( (void*)p_module->psz_object_name );
- free( (void*)p_module->psz_capability );
+ free( p_module->psz_capability );
free( (void*)p_module->psz_shortname );
free( (void*)p_module->psz_longname );
free( (void*)p_module->psz_help );
/* msg_Dbg( p_this, "builtin \"%s\", %s",
p_module->psz_object_name, p_module->psz_longname ); */
- vlc_object_attach( p_module, vlc_global( p_this )->p_module_bank );
+ vlc_object_attach( p_module, vlc_global()->p_module_bank );
return 0;
}
int i_cache;
module_cache_t **pp_cache = 0;
int32_t i_file_size, i_marker;
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
psz_homedir = p_this->p_libvlc->psz_homedir;
if( !psz_homedir )
return;
}
- i_size = asprintf( &psz_filename, "%s/%s/%s/%s", psz_homedir, CONFIG_DIR,
- PLUGINSCACHE_DIR, CacheName() );
+ i_size = asprintf( &psz_filename, "%s"DIR_SEP"%s"DIR_SEP"%s"DIR_SEP"%s",
+ psz_homedir, CONFIG_DIR, PLUGINSCACHE_DIR, CacheName() );
if( i_size <= 0 )
{
msg_Err( p_this, "out of memory" );
int i, j, i_cache;
module_cache_t **pp_cache;
int32_t i_file_size = 0;
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
psz_homedir = p_this->p_libvlc->psz_homedir;
if( !psz_homedir )
return;
}
psz_filename =
- (char *)malloc( sizeof("/" CONFIG_DIR "/" PLUGINSCACHE_DIR "/" ) +
+ (char *)malloc( sizeof(DIR_SEP CONFIG_DIR DIR_SEP PLUGINSCACHE_DIR DIR_SEP ) +
strlen(psz_homedir) + strlen(CacheName()) );
if( !psz_filename )
return;
}
- sprintf( psz_filename, "%s/%s", psz_homedir, CONFIG_DIR );
+ sprintf( psz_filename, "%s"DIR_SEP"%s", psz_homedir, CONFIG_DIR );
config_CreateDir( p_this, psz_filename );
- strcat( psz_filename, "/" PLUGINSCACHE_DIR );
+ strcat( psz_filename, DIR_SEP PLUGINSCACHE_DIR );
config_CreateDir( p_this, psz_filename );
- strcat( psz_filename, "/CACHEDIR.TAG" );
+ strcat( psz_filename, DIR_SEP"CACHEDIR.TAG" );
file = utf8_fopen( psz_filename, "wb" );
if( file )
fclose( file );
}
- sprintf( psz_filename, "%s/%s/%s/%s", psz_homedir, CONFIG_DIR,
+ sprintf( psz_filename, "%s"DIR_SEP"%s"DIR_SEP"%s"DIR_SEP"%s", psz_homedir, CONFIG_DIR,
PLUGINSCACHE_DIR, CacheName() );
msg_Dbg( p_this, "saving plugins cache file %s", psz_filename );
p_cache->pf_activate = p_module->pf_activate;
p_cache->pf_deactivate = p_module->pf_deactivate;
-#ifndef HAVE_SHARED_LIBVLC
- p_cache->p_symbols = p_module->p_symbols;
-#endif
p_cache->handle = p_module->handle;
for( i_submodule = 0; i_submodule < p_module->i_children; i_submodule++ )
module_t *p_cchild = (module_t*)p_cache->pp_children[i_submodule];
p_cchild->pf_activate = p_child->pf_activate;
p_cchild->pf_deactivate = p_child->pf_deactivate;
-#ifndef HAVE_SHARED_LIBVLC
- p_cchild->p_symbols = p_child->p_symbols;
-#endif
}
p_cache->b_loaded = VLC_TRUE;
{
module_cache_t **pp_cache;
int i_cache, i;
- libvlc_global_data_t *p_libvlc_global = vlc_global( p_this );
+ libvlc_global_data_t *p_libvlc_global = vlc_global();
pp_cache = p_libvlc_global->p_module_bank->pp_loaded_cache;
i_cache = p_libvlc_global->p_module_bank->i_loaded_cache;