+ /* vlc_threads_init *must* be the first internal call! No other call is
+ * allowed before the thread system has been initialized. */
+ i_ret = vlc_threads_init( &libvlc );
+ if( i_ret )
+ {
+ return NULL;
+ }
+
+ /* Now that the thread system is initialized, we don't have much, but
+ * at least we have libvlc.global_lock */
+ vlc_mutex_lock( &libvlc.global_lock );
+ if( !libvlc.b_ready )
+ {
+ vlc_mutex_init( &libvlc, &libvlc.structure_lock );
+ libvlc.p_global_data = NULL;
+ libvlc.b_ready = VLC_TRUE;
+
+ /* Guess what CPU we have */
+ libvlc.i_cpu = CPUCapabilities();
+
+ /* Initialize message queue */
+ msg_Create( &libvlc );
+
+ /* Announce who we are */
+ msg_Dbg( &libvlc, COPYRIGHT_MESSAGE );
+ msg_Dbg( &libvlc, "libvlc was configured with %s", CONFIGURE_LINE );
+
+ /* Initialize the module bank and and load the configuration of the
+ * main module. We need to do this at this stage to be able to display
+ * a short help if required by the user. (short help == main module
+ * options) */
+ module_InitBank( &libvlc );
+ module_LoadMain( &libvlc );
+ }
+ vlc_mutex_unlock( &libvlc.global_lock );
+
+ /* Allocate a vlc object */
+ p_vlc = vlc_object_create( &libvlc, VLC_OBJECT_VLC );