assert (refs != (uintptr_t)(-1)); /* reference underflow?! */
if (refs == 0)
{
-#ifdef USE_SYNC
+#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
#elif defined (WIN32) && defined (__GNUC__)
#elif defined(__APPLE__)
#else
priv->p_playlist = NULL;
priv->p_dialog_provider = NULL;
priv->p_vlm = NULL;
- p_libvlc->psz_object_name = strdup( "libvlc" );
/* Initialize message queue */
msg_Create( p_libvlc );
/* Initialize mutexes */
vlc_mutex_init( &priv->timer_lock );
- vlc_mutex_init( &priv->config_lock );
vlc_cond_init( &priv->exiting );
return p_libvlc;
i_ret = VLC_EEXITSUCCESS;
}
- /* Set the config file stuff */
- priv->psz_configfile = config_GetCustomConfigFile( p_libvlc );
-
/* Check for plugins cache options */
bool b_cache_delete = config_GetInt( p_libvlc, "reset-plugins-cache" ) > 0;
if( b_exit )
{
- free( priv->psz_configfile );
module_EndBank( p_libvlc, false );
return i_ret;
}
if( b_exit )
{
- free( priv->psz_configfile );
module_EndBank( p_libvlc, true );
return i_ret;
}
"that they are valid.\n" );
PauseConsole();
#endif
- free( priv->psz_configfile );
module_EndBank( p_libvlc, true );
return VLC_EGENERIC;
}
{
msg_Err( p_libvlc, "D-Bus problem" );
system_End( p_libvlc );
- exit( VLC_ETIMEOUT );
+ exit( 1 );
}
/* append MRLs */
{
dbus_message_unref( p_dbus_msg );
system_End( p_libvlc );
- exit( VLC_ENOMEM );
+ exit( 1 );
}
b_play = TRUE;
if( config_GetInt( p_libvlc, "playlist-enqueue" ) > 0 )
{
dbus_message_unref( p_dbus_msg );
system_End( p_libvlc );
- exit( VLC_ENOMEM );
+ exit( 1 );
}
/* send message and get a handle for a reply */
msg_Err( p_libvlc, "D-Bus problem" );
dbus_message_unref( p_dbus_msg );
system_End( p_libvlc );
- exit( VLC_ETIMEOUT );
+ exit( 1 );
}
if ( NULL == p_dbus_pending )
msg_Err( p_libvlc, "D-Bus problem" );
dbus_message_unref( p_dbus_msg );
system_End( p_libvlc );
- exit( VLC_ETIMEOUT );
+ exit( 1 );
}
dbus_connection_flush( p_conn );
dbus_message_unref( p_dbus_msg );
/* bye bye */
system_End( p_libvlc );
- exit( VLC_SUCCESS );
+ exit( 0 );
}
}
/* we unreference the connection when we've finished with it */
var_SetInteger( p_libvlc, "verbose", -1 );
priv->i_verbose = -1;
}
+ vlc_threads_setup( p_libvlc );
if( priv->b_color )
priv->b_color = config_GetInt( p_libvlc, "color" ) > 0;
module_unneed( p_libvlc, priv->p_memcpy_module );
}
module_EndBank( p_libvlc, true );
- free( priv->psz_configfile );
return VLC_EGENERIC;
}
playlist_Activate( p_playlist );
}
if( asprintf( &psz_temp, "%s,none", psz_module ) != -1)
{
- libvlc_InternalAddIntf( p_libvlc, psz_temp );
+ intf_Create( p_libvlc, psz_temp );
free( psz_temp );
}
}
/*
* Always load the hotkeys interface if it exists
*/
- libvlc_InternalAddIntf( p_libvlc, "hotkeys,none" );
- if( module_exists( "globalhotkeys" ) )
- libvlc_InternalAddIntf( p_libvlc, "globalhotkeys,none" );
+ intf_Create( p_libvlc, "hotkeys,none" );
#ifdef HAVE_DBUS
/* loads dbus control interface if in one-instance mode
if( config_GetInt( p_libvlc, "one-instance" ) > 0
|| ( config_GetInt( p_libvlc, "one-instance-when-started-from-file" )
&& config_GetInt( p_libvlc, "started-from-file" ) ) )
- libvlc_InternalAddIntf( p_libvlc, "dbus,none" );
+ intf_Create( p_libvlc, "dbus,none" );
/* Prevents the power management daemon from suspending the system
* when VLC is active */
if( config_GetInt( p_libvlc, "inhibit" ) > 0 )
- libvlc_InternalAddIntf( p_libvlc, "inhibit,none" );
+ intf_Create( p_libvlc, "inhibit,none" );
#endif
/*
#ifdef HAVE_X11_XLIB_H
if( config_GetInt( p_libvlc, "disable-screensaver" ) )
{
- libvlc_InternalAddIntf( p_libvlc, "screensaver,none" );
+ intf_Create( p_libvlc, "screensaver,none" );
}
#endif
if( (config_GetInt( p_libvlc, "file-logging" ) > 0) &&
!config_GetInt( p_libvlc, "syslog" ) )
{
- libvlc_InternalAddIntf( p_libvlc, "logger,none" );
+ intf_Create( p_libvlc, "logger,none" );
}
#ifdef HAVE_SYSLOG_H
if( config_GetInt( p_libvlc, "syslog" ) > 0 )
{
char *logmode = var_CreateGetString( p_libvlc, "logmode" );
var_SetString( p_libvlc, "logmode", "syslog" );
- libvlc_InternalAddIntf( p_libvlc, "logger,none" );
+ intf_Create( p_libvlc, "logger,none" );
if( logmode )
{
}
#endif
- if( config_GetInt( p_libvlc, "show-intf" ) > 0 )
- {
- libvlc_InternalAddIntf( p_libvlc, "showintf,none" );
- }
-
if( config_GetInt( p_libvlc, "network-synchronisation") > 0 )
{
- libvlc_InternalAddIntf( p_libvlc, "netsync,none" );
+ intf_Create( p_libvlc, "netsync,none" );
}
#ifdef WIN32
}
#endif
- /*
- * FIXME: kludge to use a p_libvlc-local variable for the Mozilla plugin
- */
- var_Create( p_libvlc, "drawable-xid", VLC_VAR_DOINHERIT|VLC_VAR_INTEGER );
- var_Create( p_libvlc, "drawable-hwnd", VLC_VAR_ADDRESS );
- var_Create( p_libvlc, "drawable-agl", VLC_VAR_INTEGER );
- var_Create( p_libvlc, "drawable-gl", VLC_VAR_INTEGER );
-
var_Create( p_libvlc, "drawable-view-top", VLC_VAR_INTEGER );
var_Create( p_libvlc, "drawable-view-left", VLC_VAR_INTEGER );
var_Create( p_libvlc, "drawable-view-bottom", VLC_VAR_INTEGER );
/* Create volume callback system. */
var_Create( p_libvlc, "volume-change", VLC_VAR_BOOL );
- /* Create a variable for showing the interface (moved from playlist). */
+ /* Create a variable for showing the fullscreen interface from hotkeys */
var_Create( p_libvlc, "intf-show", VLC_VAR_BOOL );
var_SetBool( p_libvlc, "intf-show", true );
+ /* Create a variable for showing the right click menu */
var_Create( p_libvlc, "intf-popupmenu", VLC_VAR_BOOL );
/*
/* Ask the interfaces to stop and destroy them */
msg_Dbg( p_libvlc, "removing all interfaces" );
- intf_thread_t *p_intf;
- while( (p_intf = vlc_object_find( p_libvlc, VLC_OBJECT_INTF, FIND_CHILD )) )
- {
- intf_StopThread( p_intf );
- vlc_object_detach( p_intf );
- vlc_object_release( p_intf ); /* for intf_Create() */
- vlc_object_release( p_intf ); /* for vlc_object_find() */
- }
+ libvlc_Quit( p_libvlc );
+ intf_DestroyAll( p_libvlc );
#ifdef ENABLE_VLM
/* Destroy VLM if created in libvlc_InternalInit */
/* Free module bank. It is refcounted, so we call this each time */
module_EndBank( p_libvlc, true );
- FREENULL( priv->psz_configfile );
var_DelCallback( p_libvlc, "key-pressed", vlc_key_to_action,
(void *)p_libvlc->p_hotkeys );
free( (void *)p_libvlc->p_hotkeys );
/* Destroy mutexes */
vlc_cond_destroy( &priv->exiting );
- vlc_mutex_destroy( &priv->config_lock );
vlc_mutex_destroy( &priv->timer_lock );
#ifndef NDEBUG /* Hack to dump leaked objects tree */
*/
int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
{
- int i_err;
- intf_thread_t *p_intf = NULL;
-
if( !p_libvlc )
return VLC_EGENERIC;
}
/* Try to create the interface */
- p_intf = intf_Create( p_libvlc, psz_module ? psz_module : "$intf" );
- if( p_intf == NULL )
+ if( intf_Create( p_libvlc, psz_module ? psz_module : "$intf" ) )
{
msg_Err( p_libvlc, "interface \"%s\" initialization failed",
- psz_module );
+ psz_module ? psz_module : "default" );
return VLC_EGENERIC;
}
-
- /* Try to run the interface */
- i_err = intf_RunThread( p_intf );
- if( i_err )
- {
- vlc_object_detach( p_intf );
- vlc_object_release( p_intf );
- return i_err;
- }
-
return VLC_SUCCESS;
-};
+}
static vlc_mutex_t exit_lock = VLC_STATIC_MUTEX;
utf8_fprintf( stdout, "%s\n", _("To get exhaustive help, use '-H'.") );
}
+static const char vlc_usage[] = N_(
+ "Usage: %s [options] [stream] ..."
+ "\nYou can specify multiple streams on the commandline. They will be enqueued in the playlist."
+ "\nThe first item specified will be played first."
+ "\n"
+ "\nOptions-styles:"
+ "\n --option A global option that is set for the duration of the program."
+ "\n -option A single letter version of a global --option."
+ "\n :option An option that only applies to the stream directly before it"
+ "\n and that overrides previous settings."
+ "\n"
+ "\nStream MRL syntax:"
+ "\n [[access][/demux]://]URL[@[title][:chapter][-[title][:chapter]]] [:option=value ...]"
+ "\n"
+ "\n Many of the global --options can also be used as MRL specific :options."
+ "\n Multiple :option=value pairs can be specified."
+ "\n"
+ "\nURL syntax:"
+ "\n [file://]filename Plain media file"
+ "\n http://ip:port/file HTTP URL"
+ "\n ftp://ip:port/file FTP URL"
+ "\n mms://ip:port/file MMS URL"
+ "\n screen:// Screen capture"
+ "\n [dvd://][device][@raw_device] DVD device"
+ "\n [vcd://][device] VCD device"
+ "\n [cdda://][device] Audio CD device"
+ "\n udp://[[<source address>]@[<bind address>][:<bind port>]]"
+ "\n UDP stream sent by a streaming server"
+ "\n vlc://pause:<seconds> Special item to pause the playlist for a certain time"
+ "\n vlc://quit Special item to quit VLC"
+ "\n");
+
static void Help( libvlc_int_t *p_this, char const *psz_help_name )
{
#ifdef WIN32
{
if( b_color )
utf8_fprintf( stdout, "\n" WHITE "%s" GRAY "\n",
- _( "No matching module found. Use --list or" \
+ _( "No matching module found. Use --list or " \
"--list-verbose to list available modules." ) );
else
utf8_fprintf( stdout, "\n%s\n",
- _( "No matching module found. Use --list or" \
+ _( "No matching module found. Use --list or " \
"--list-verbose to list available modules." ) );
}
*****************************************************************************/
static void Version( void )
{
+ extern const char psz_vlc_changeset[];
#ifdef WIN32
ShowConsole( true );
#endif
- utf8_fprintf( stdout, _("VLC version %s\n"), VLC_Version() );
+ utf8_fprintf( stdout, _("VLC version %s (%s)\n"), VLC_Version(),
+ psz_vlc_changeset );
utf8_fprintf( stdout, _("Compiled by %s@%s.%s\n"),
VLC_CompileBy(), VLC_CompileHost(), VLC_CompileDomain() );
utf8_fprintf( stdout, _("Compiler: %s\n"), VLC_Compiler() );