_p_libvlc = NULL;
vlcDataObject->onClose();
- libvlc_destroy(p_libvlc);
+ libvlc_destroy(p_libvlc, NULL );
}
return S_OK;
};
instance = getClassInstance( env, _this );
- libvlc_destroy( (libvlc_instance_t *) instance);
+ libvlc_destroy( (libvlc_instance_t *) instance, NULL );
return;
}
vlc_bool_t b_ready; ///< Initialization boolean
uint32_t i_cpu; ///< CPU extensions
- int i_verbose; ///< info messages
- vlc_bool_t b_color; ///< color messages?
-
- /* Object structure data */
+ /* Object structure data */
int i_counter; ///< object counter
int i_objects; ///< Attached objects count
vlc_object_t ** pp_objects; ///< Array of all objects
- msg_bank_t msg_bank; ///< The message bank
-
module_bank_t * p_module_bank; ///< The module bank
intf_thread_t *p_probe; ///< Devices prober
playlist_t *p_playlist; ///< playlist object
+ /* Messages */
+ msg_bank_t msg_bank; ///< The message bank
+ int i_verbose; ///< info messages
+ vlc_bool_t b_color; ///< color messages?
+
module_t * p_memcpy_module; ///< Fast memcpy plugin used
void* ( *pf_memcpy ) ( void *, const void *, size_t ); ///< fast memcpy
void* ( *pf_memset ) ( void *, int, size_t ); ///< fast memset
delete psz_baseURL;
delete psz_target;
if( libvlc_instance )
- libvlc_destroy(libvlc_instance);
+ libvlc_destroy(libvlc_instance, NULL );
}
/*****************************************************************************
int i_ret;
libvlc_int_t * p_libvlc = NULL;
vlc_value_t lockval;
+ char *psz_env;
/* &libvlc_global never changes,
* so we can safely call this multiple times. */
if( !libvlc_global.b_ready )
{
- char *psz_env;
-
/* Guess what CPU we have */
libvlc_global.i_cpu = CPUCapabilities();
-
- /* Find verbosity from VLC_VERBOSE environment variable */
- psz_env = getenv( "VLC_VERBOSE" );
- libvlc_global.i_verbose = psz_env ? atoi( psz_env ) : -1;
-
-#if defined( HAVE_ISATTY ) && !defined( WIN32 )
- libvlc_global.b_color = isatty( 2 ); /* 2 is for stderr */
-#else
- libvlc_global.b_color = VLC_FALSE;
-#endif
-
- /* Initialize message queue */
- msg_Create( p_libvlc_global );
-
- /* Announce who we are */
- msg_Dbg( p_libvlc_global, COPYRIGHT_MESSAGE );
- msg_Dbg( p_libvlc_global, "libvlc was configured with %s",
- CONFIGURE_LINE );
-
- /* The module bank will be initialized later */
+ /* The module bank will be initialized later */
libvlc_global.p_module_bank = NULL;
libvlc_global.b_ready = VLC_TRUE;
p_libvlc->p_playlist = NULL;
p_libvlc->psz_object_name = "libvlc";
+ /* Initialize message queue */
+ msg_Create( p_libvlc );
+ /* Announce who we are - Do it only for first instance ? */
+ msg_Dbg( p_libvlc, COPYRIGHT_MESSAGE );
+ msg_Dbg( p_libvlc, "libvlc was configured with %s", CONFIGURE_LINE );
+
+ /* Find verbosity from VLC_VERBOSE environment variable */
+ psz_env = getenv( "VLC_VERBOSE" );
+ p_libvlc->i_verbose = psz_env ? atoi( psz_env ) : -1;
+
+#if defined( HAVE_ISATTY ) && !defined( WIN32 )
+ p_libvlc->b_color = isatty( 2 ); /* 2 is for stderr */
+#else
+ p_libvlc->b_color = VLC_FALSE;
+#endif
+
/* Initialize mutexes */
vlc_mutex_init( p_libvlc, &p_libvlc->config_lock );
#ifdef __APPLE__
/* End hack */
/* Will be re-done properly later on */
- p_libvlc->p_libvlc_global->i_verbose = config_GetInt( p_libvlc, "verbose" );
+ p_libvlc->i_verbose = config_GetInt( p_libvlc, "verbose" );
/* Check for daemon mode */
#ifndef WIN32
var_AddCallback( p_libvlc, "verbose", VerboseCallback, NULL );
var_Change( p_libvlc, "verbose", VLC_VAR_TRIGGER_CALLBACKS, NULL, NULL );
- libvlc_global.b_color = libvlc_global.b_color &&
- config_GetInt( p_libvlc, "color" );
+ p_libvlc->b_color = p_libvlc->b_color && config_GetInt( p_libvlc, "color" );
/*
* Output messages that may still be in the queue
/* System specific cleaning code */
system_End( p_libvlc );
- /* Free message queue. Nobody shall use msg_* afterward. */
- msg_Flush( p_libvlc );
- msg_Destroy( p_libvlc_global );
-
- /* Destroy global iconv */
+ /* Destroy global iconv */
LocaleDeinit();
}
vlc_mutex_unlock( lockval.p_address );
var_Destroy( p_libvlc_global, "libvlc" );
+ msg_Flush( p_libvlc );
+ msg_Destroy( p_libvlc );
+
/* Destroy mutexes */
vlc_mutex_destroy( &p_libvlc->config_lock );
static int VerboseCallback( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param)
{
- libvlc_int_t *p_vlc = (libvlc_int_t *)p_this;
+ libvlc_int_t *p_libvlc = (libvlc_int_t *)p_this;
if( new_val.i_int >= -1 )
{
- p_vlc->p_libvlc_global->i_verbose = __MIN( new_val.i_int, 2 );
+ p_libvlc->i_verbose = __MIN( new_val.i_int, 2 );
}
return VLC_SUCCESS;
}
# define vlc_va_copy(dest,src) (dest)=(src)
#endif
+#define QUEUE(i) p_this->p_libvlc->msg_bank.pp_queues[i]
+
/*****************************************************************************
* Local prototypes
*****************************************************************************/
*/
void __msg_Create( vlc_object_t *p_this )
{
- vlc_mutex_init( p_this, &(p_this->p_libvlc_global->msg_bank.lock) );
+ vlc_mutex_init( p_this, &(p_this->p_libvlc->msg_bank.lock) );
CreateMsgQueue( p_this, MSG_QUEUE_NORMAL );
CreateMsgQueue( p_this, MSG_QUEUE_HTTPD_ACCESS );
#ifdef UNDER_CE
- p_this->p_libvlc_global->msg_bank.pp_queues[MSG_QUEUE_NORMAL]->logfile =
+ QUEUE(MSG_QUEUE_NORMAL)->logfile =
CreateFile( L"vlc-log.txt", GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
CREATE_ALWAYS, 0, NULL );
- SetFilePointer( p_this->p_libvlc_global->msg_bank.pp_queues[MSG_QUEUE_NORMAL]->
- logfile, 0, NULL, FILE_END );
+ SetFilePointer( QUEUE(MSG_QUEUE_NORMAL)->logfile, 0, NULL, FILE_END );
#endif
}
p_queue->i_sub = 0;
p_queue->pp_sub = NULL;
- INSERT_ELEM( p_this->p_libvlc_global->msg_bank.pp_queues,
- p_this->p_libvlc_global->msg_bank.i_queues,
+ INSERT_ELEM( p_this->p_libvlc->msg_bank.pp_queues,
+ p_this->p_libvlc->msg_bank.i_queues,
i_queue,
p_queue );
}
{
int i;
- for( i = 0 ; i < p_this->p_libvlc_global->msg_bank.i_queues; i++ )
+ for( i = 0 ; i < p_this->p_libvlc->msg_bank.i_queues; i++ )
{
- vlc_mutex_lock( &p_this->p_libvlc_global->msg_bank.pp_queues[i]->lock );
- FlushMsg( p_this->p_libvlc_global->msg_bank.pp_queues[i] );
- vlc_mutex_unlock( &p_this->p_libvlc_global->msg_bank.pp_queues[i]->lock );
+ vlc_mutex_lock( &QUEUE(i)->lock );
+ FlushMsg( QUEUE(i) );
+ vlc_mutex_unlock( &QUEUE(i)->lock );
}
}
void __msg_Destroy( vlc_object_t *p_this )
{
int i;
- for( i = p_this->p_libvlc_global->msg_bank.i_queues -1 ; i >= 0; i-- )
+ for( i = p_this->p_libvlc->msg_bank.i_queues -1 ; i >= 0; i-- )
{
- msg_queue_t *p_queue = p_this->p_libvlc_global->msg_bank.pp_queues[i];
+ msg_queue_t *p_queue = QUEUE(i);
if( p_queue->i_sub )
{
msg_Err( p_this, "stale interface subscribers" );
#ifdef UNDER_CE
if( i == MSG_QUEUE_NORMAL )
- CloseHandle( p_this->p_libvlc_global->msg_bank.pp_queues[MSG_QUEUE_NORMAL]->logfile );
+ CloseHandle( QUEUE(MSG_QUEUE_NORMAL)->logfile );
#endif
/* Destroy lock */
vlc_mutex_destroy( &p_queue->lock );
- REMOVE_ELEM( p_this->p_libvlc_global->msg_bank.pp_queues,
- p_this->p_libvlc_global->msg_bank.i_queues, i );
+ REMOVE_ELEM( p_this->p_libvlc->msg_bank.pp_queues,
+ p_this->p_libvlc->msg_bank.i_queues, i );
free( p_queue );
}
- vlc_mutex_destroy( &(p_this->p_libvlc_global->msg_bank.lock) );
+ vlc_mutex_destroy( &(p_this->p_libvlc->msg_bank.lock) );
}
/**
*/
msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this, int i_queue )
{
- msg_bank_t *p_bank = &p_this->p_libvlc_global->msg_bank;
+ msg_bank_t *p_bank = &p_this->p_libvlc->msg_bank;
msg_subscription_t *p_sub = malloc( sizeof( msg_subscription_t ) );
msg_queue_t *p_queue = NULL;
int i;
for( i = 0 ; i <p_bank->i_queues ;i++ )
{
- if( p_bank->pp_queues[i]->i_id == i_queue )
+ if( QUEUE(i)->i_id == i_queue )
{
p_queue = p_bank->pp_queues[i];
}
*/
void __msg_Unsubscribe( vlc_object_t *p_this, msg_subscription_t *p_sub )
{
- msg_bank_t *p_bank = &p_this->p_libvlc_global->msg_bank;
+ msg_bank_t *p_bank = &p_this->p_libvlc->msg_bank;
int i,j;
vlc_mutex_lock( &p_bank->lock );
return;
}
- p_bank = &p_this->p_libvlc_global->msg_bank;
+ p_bank = &p_this->p_libvlc->msg_bank;
/*
* Convert message to string
switch( i_type )
{
case VLC_MSG_ERR:
- if( p_this->p_libvlc_global->i_verbose < 0 ) return;
+ if( p_this->p_libvlc->i_verbose < 0 ) return;
break;
case VLC_MSG_INFO:
- if( p_this->p_libvlc_global->i_verbose < 0 ) return;
+ if( p_this->p_libvlc->i_verbose < 0 ) return;
break;
case VLC_MSG_WARN:
- if( p_this->p_libvlc_global->i_verbose < 1 ) return;
+ if( p_this->p_libvlc->i_verbose < 1 ) return;
break;
case VLC_MSG_DBG:
- if( p_this->p_libvlc_global->i_verbose < 2 ) return;
+ if( p_this->p_libvlc->i_verbose < 2 ) return;
break;
}
}
#ifdef UNDER_CE
-# define CE_WRITE(str) WriteFile( p_this->p_libvlc_global->msg_bank.pp_queues[MSG_QUEUE_NORMAL]->logfile, \
+# define CE_WRITE(str) WriteFile( QUEUE(MSG_QUEUE_NORMAL)->logfile, \
str, strlen(str), &i_dummy, NULL );
CE_WRITE( p_item->psz_module );
CE_WRITE( " " );
CE_WRITE( ": " );
CE_WRITE( p_item->psz_msg );
CE_WRITE( "\r\n" );
- FlushFileBuffers( p_this->p_libvlc_global->msg_bank.pp_queues[MSG_QUEUE_NORMAL]->logfile );
+ FlushFileBuffers( QUEUE(MSG_QUEUE_NORMAL)->logfile );
#else
/* Send the message to stderr */
- if( p_this->p_libvlc_global->b_color )
+ if( p_this->p_libvlc->b_color )
{
if( p_item->psz_header )
{