*/
libvlc_int_t * libvlc_InternalCreate( void )
{
- libvlc_int_t * p_libvlc = NULL;
+ libvlc_int_t *p_libvlc;
+ libvlc_priv_t *priv;
char *psz_env = NULL;
/* vlc_threads_init *must* be the first internal call! No other call is
/* Now that the thread system is initialized, we don't have much, but
* at least we have variables */
vlc_mutex_t *lock = var_AcquireMutex( "libvlc" );
-
- i_instances++;
-
- if( !p_libvlc_global->b_ready )
+ if( i_instances == 0 )
{
/* Guess what CPU we have */
cpu_flags = CPUCapabilities();
/* The module bank will be initialized later */
p_libvlc_global->p_module_bank = NULL;
-
- p_libvlc_global->b_ready = true;
}
- vlc_mutex_unlock( lock );
/* Allocate a libvlc instance object */
- p_libvlc = vlc_object_create( p_libvlc_global, VLC_OBJECT_LIBVLC );
+ p_libvlc = vlc_custom_create( VLC_OBJECT(p_libvlc_global),
+ sizeof (*p_libvlc) + sizeof (libvlc_priv_t),
+ VLC_OBJECT_LIBVLC, "libvlc" );
+ if( p_libvlc != NULL )
+ i_instances++;
+ vlc_mutex_unlock( lock );
+
if( p_libvlc == NULL )
- {
- i_instances--;
return NULL;
- }
+
p_libvlc->p_playlist = NULL;
p_libvlc->p_interaction = NULL;
p_libvlc->p_vlm = NULL;
p_libvlc->psz_object_name = strdup( "libvlc" );
+ priv = libvlc_priv (p_libvlc);
/* Initialize message queue */
msg_Create( p_libvlc );
msg_Dbg( p_libvlc, "libvlc was configured with %s", CONFIGURE_LINE );
/* Initialize mutexes */
- vlc_mutex_init( &p_libvlc->timer_lock );
- vlc_mutex_init( &p_libvlc->config_lock );
+ vlc_mutex_init( &priv->timer_lock );
+ vlc_mutex_init( &priv->config_lock );
#ifdef __APPLE__
vlc_thread_set_priority( p_libvlc, VLC_THREAD_PRIORITY_LOW );
#endif
const char *ppsz_argv[] )
{
libvlc_global_data_t *p_libvlc_global = vlc_global();
+ libvlc_priv_t *priv = libvlc_priv (p_libvlc);
char p_capabilities[200];
char * p_tmp = NULL;
char * psz_modules = NULL;
*/
p_libvlc->p_memcpy_module = module_Need( p_libvlc, "memcpy", "$memcpy", 0 );
- p_libvlc->b_stats = config_GetInt( p_libvlc, "stats" ) > 0;
- p_libvlc->i_timers = 0;
- p_libvlc->pp_timers = NULL;
+ priv->b_stats = config_GetInt( p_libvlc, "stats" ) > 0;
+ priv->i_timers = 0;
+ priv->pp_timers = NULL;
/* Init stats */
p_libvlc->p_stats = (global_stats_t *)malloc( sizeof( global_stats_t ) );
if( !p_libvlc )
return VLC_EGENERIC;
+ libvlc_priv_t *priv = libvlc_priv (p_libvlc);
+
#ifndef WIN32
char* psz_pidfile = NULL;
msg_Destroy( p_libvlc );
/* Destroy mutexes */
- vlc_mutex_destroy( &p_libvlc->config_lock );
- vlc_mutex_destroy( &p_libvlc->timer_lock );
+ vlc_mutex_destroy( &priv->config_lock );
+ vlc_mutex_destroy( &priv->timer_lock );
if( b_release ) vlc_object_release( p_libvlc );
vlc_object_release( p_libvlc );