#include "vlc_vlm.h"
+#include "vlc_image.h"
+
#ifdef HAVE_DYNAMIC_PLUGINS
# include "modules_plugin.h"
#endif
-#if defined( UNDER_CE )
+#if defined( _MSC_VER ) && defined( UNDER_CE )
# include "modules_builtin_evc.h"
#elif defined( _MSC_VER )
# include "modules_builtin_msvc.h"
}
vlc_object_destroy( p_this->p_libvlc->p_module_bank );
+ p_this->p_libvlc->p_module_bank = NULL;
return;
}
*****************************************************************************/
void __module_LoadMain( vlc_object_t *p_this )
{
+ vlc_value_t lockval;
+
+ var_Create( p_this->p_libvlc, "libvlc", VLC_VAR_MUTEX );
+ var_Get( p_this->p_libvlc, "libvlc", &lockval );
+ vlc_mutex_lock( lockval.p_address );
+ if( p_this->p_libvlc->p_module_bank->b_main )
+ {
+ vlc_mutex_unlock( lockval.p_address );
+ var_Destroy( p_this->p_libvlc, "libvlc" );
+ return;
+ }
+ p_this->p_libvlc->p_module_bank->b_main = VLC_TRUE;
+ vlc_mutex_unlock( lockval.p_address );
+ var_Destroy( p_this->p_libvlc, "libvlc" );
+
AllocateBuiltinModule( p_this, vlc_entry__main );
}
*****************************************************************************/
void __module_LoadBuiltins( vlc_object_t * p_this )
{
+ vlc_value_t lockval;
+
+ var_Create( p_this->p_libvlc, "libvlc", VLC_VAR_MUTEX );
+ var_Get( p_this->p_libvlc, "libvlc", &lockval );
+ vlc_mutex_lock( lockval.p_address );
+ if( p_this->p_libvlc->p_module_bank->b_builtins )
+ {
+ vlc_mutex_unlock( lockval.p_address );
+ var_Destroy( p_this->p_libvlc, "libvlc" );
+ return;
+ }
+ p_this->p_libvlc->p_module_bank->b_builtins = VLC_TRUE;
+ vlc_mutex_unlock( lockval.p_address );
+ var_Destroy( p_this->p_libvlc, "libvlc" );
+
msg_Dbg( p_this, "checking builtin modules" );
ALLOCATE_ALL_BUILTINS();
}
void __module_LoadPlugins( vlc_object_t * p_this )
{
#ifdef HAVE_DYNAMIC_PLUGINS
+ vlc_value_t lockval;
+
+ var_Create( p_this->p_libvlc, "libvlc", VLC_VAR_MUTEX );
+ var_Get( p_this->p_libvlc, "libvlc", &lockval );
+ vlc_mutex_lock( lockval.p_address );
+ if( p_this->p_libvlc->p_module_bank->b_plugins )
+ {
+ vlc_mutex_unlock( lockval.p_address );
+ var_Destroy( p_this->p_libvlc, "libvlc" );
+ return;
+ }
+ p_this->p_libvlc->p_module_bank->b_plugins = VLC_TRUE;
+ vlc_mutex_unlock( lockval.p_address );
+ var_Destroy( p_this->p_libvlc, "libvlc" );
+
msg_Dbg( p_this, "checking plugin modules" );
if( config_GetInt( p_this, "plugins-cache" ) )
* module is unloaded. */
p_module->psz_object_name = strdup( p_module->psz_object_name );
p_module->psz_capability = strdup( p_module->psz_capability );
- p_module->psz_shortname = strdup( p_module->psz_shortname );
+ p_module->psz_shortname = p_module->psz_shortname ?
+ strdup( p_module->psz_shortname ) : NULL;
p_module->psz_longname = strdup( p_module->psz_longname );
if( p_module->psz_program != NULL )
free( p_module->psz_object_name );
free( p_module->psz_capability );
- free( p_module->psz_shortname );
+ if( p_module->psz_shortname ) free( p_module->psz_shortname );
free( p_module->psz_longname );
if( p_module->psz_program != NULL )
static char * GetWindowsError( void )
{
#if defined(UNDER_CE)
- wchar_t psz_tmp[256];
- char * psz_buffer = malloc( 256 );
+ wchar_t psz_tmp[MAX_PATH];
+ char * psz_buffer = malloc( MAX_PATH );
#else
- char * psz_tmp = malloc( 256 );
+ char * psz_tmp = malloc( MAX_PATH );
#endif
int i = 0, i_error = GetLastError();
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, i_error, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) psz_tmp, 256, NULL );
+ (LPTSTR)psz_tmp, MAX_PATH, NULL );
/* Go to the end of the string */
-#if defined(UNDER_CE)
- while( psz_tmp[i] && psz_tmp[i] != L'\r' && psz_tmp[i] != L'\n' )
-#else
- while( psz_tmp[i] && psz_tmp[i] != '\r' && psz_tmp[i] != '\n' )
-#endif
+ while( psz_tmp[i] && psz_tmp[i] != _T('\r') && psz_tmp[i] != _T('\n') )
{
i++;
}
}
#if defined(UNDER_CE)
- WideCharToMultiByte( CP_ACP, WC_DEFAULTCHAR, psz_tmp, -1,
- psz_buffer, 256, NULL, NULL );
+ wcstombs( psz_buffer, psz_tmp, MAX_PATH );
return psz_buffer;
#else
return psz_tmp;