BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) { (void) hinstDll; (void) lpvReserved; switch (fdwReason) { case DLL_PROCESS_ATTACH: #if (_WIN32_WINNT < 0x0601) if (!QueryPerformanceFrequency (&freq)) return FALSE; #endif vlc_mutex_init (&super_mutex); vlc_cond_init (&super_variable); vlc_threadvar_create (&thread_key, NULL); vlc_rwlock_init (&config_lock); vlc_rwlock_init (&msg_lock); vlc_CPU_init (); break; case DLL_PROCESS_DETACH: vlc_rwlock_destroy (&msg_lock); vlc_rwlock_destroy (&config_lock); vlc_threadvar_delete (&thread_key); vlc_cond_destroy (&super_variable); vlc_mutex_destroy (&super_mutex); break; } return TRUE; }
unsigned long _System _DLL_InitTerm(unsigned long hmod, unsigned long flag) { VLC_UNUSED (hmod); switch (flag) { case 0 : /* Initialization */ if(_CRT_init() == -1) return 0; vlc_mutex_init (&super_mutex); vlc_cond_init (&super_variable); vlc_threadvar_create (&thread_key, NULL); vlc_rwlock_init (&config_lock); vlc_rwlock_init (&msg_lock); vlc_CPU_init (); return 1; case 1 : /* Termination */ vlc_rwlock_destroy (&msg_lock); vlc_rwlock_destroy (&config_lock); vlc_threadvar_delete (&thread_key); vlc_cond_destroy (&super_variable); vlc_mutex_destroy (&super_mutex); _CRT_term(); return 1; } return 0; /* Failed */ }
//BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI _CRT_INIT (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) // sunqueen modify { (void) hinstDll; (void) lpvReserved; switch (fdwReason) { case DLL_PROCESS_ATTACH: InitializeCriticalSection (&clock_lock); vlc_mutex_init (&super_mutex); vlc_cond_init (&super_variable); vlc_threadvar_create (&thread_key, NULL); vlc_rwlock_init (&config_lock); vlc_CPU_init (); break; case DLL_PROCESS_DETACH: vlc_rwlock_destroy (&config_lock); vlc_threadvar_delete (&thread_key); vlc_cond_destroy (&super_variable); vlc_mutex_destroy (&super_mutex); DeleteCriticalSection (&clock_lock); break; } return TRUE; }
/** * Initialize messages queues * This function initializes all message queues */ msg_bank_t *msg_Create (void) { msg_bank_t *bank = malloc (sizeof (*bank)); vlc_rwlock_init (&bank->lock); vlc_dictionary_init (&bank->enabled_objects, 0); bank->all_objects_enabled = true; bank->i_sub = 0; bank->pp_sub = NULL; /* C locale to get error messages in English in the logs */ bank->locale = newlocale (LC_MESSAGES_MASK, "C", (locale_t)0); return bank; }
void vlc_LogInit (libvlc_int_t *vlc) { libvlc_priv_t *priv = libvlc_priv (vlc); const char *str; if (var_InheritBool (vlc, "quiet")) priv->log.verbose = -1; else if ((str = getenv ("VLC_VERBOSE")) != NULL) priv->log.verbose = atoi (str); else priv->log.verbose = var_InheritInteger (vlc, "verbose"); vlc_rwlock_init (&priv->log.lock); vlc_LogSet (vlc, NULL, NULL); }
/** * Initialize messages queues * This function initializes all message queues */ msg_bank_t *msg_Create (void) { msg_bank_t *bank = malloc (sizeof (*bank)); vlc_rwlock_init (&bank->lock); vlc_dictionary_init (&bank->enabled_objects, 0); bank->all_objects_enabled = true; bank->i_sub = 0; bank->pp_sub = NULL; /* C locale to get error messages in English in the logs */ bank->locale = newlocale (LC_MESSAGES_MASK, "C", (locale_t)0); vlc_mutex_lock( &msg_stack_lock ); if( banks++ == 0 ) vlc_threadvar_create( &msg_context, cleanup_msg_context ); vlc_mutex_unlock( &msg_stack_lock ); return bank; }
/** * Performs preinitialization of the messages logging subsystem. * * Early log messages will be stored in memory until the subsystem is fully * initialized with vlc_LogInit(). This enables logging before the * configuration and modules bank are ready. * * \return 0 on success, -1 on error. */ int vlc_LogPreinit(libvlc_int_t *vlc) { vlc_logger_t *logger = vlc_custom_create(vlc, sizeof (*logger), "logger"); libvlc_priv(vlc)->logger = logger; if (unlikely(logger == NULL)) return -1; vlc_rwlock_init(&logger->lock); if (vlc_LogEarlyOpen(logger)) { logger->log = vlc_vaLogDiscard; return -1; } /* Announce who we are */ msg_Dbg(vlc, "VLC media player - %s", VERSION_MESSAGE); msg_Dbg(vlc, "%s", COPYRIGHT_MESSAGE); msg_Dbg(vlc, "revision %s", psz_vlc_changeset); msg_Dbg(vlc, "configured with %s", CONFIGURE_LINE); return 0; }