*/
void vlc_release (gc_object_t *p_gc)
{
- unsigned refs;
+ uintptr_t refs;
assert( p_gc );
refs = vlc_atomic_dec (&p_gc->refs);
/* Allocate a libvlc instance object */
p_libvlc = vlc_custom_create( (vlc_object_t *)NULL, sizeof (*priv),
- VLC_OBJECT_GENERIC, "libvlc" );
+ "libvlc" );
if( p_libvlc != NULL )
i_instances++;
vlc_mutex_unlock( &global_lock );
* - configuration and commandline parsing
*/
int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
- const char *ppsz_argv[], const void **builtins_module )
+ const char *ppsz_argv[] )
{
libvlc_priv_t *priv = libvlc_priv (p_libvlc);
char * p_tmp = NULL;
#endif
/* System specific initialization code */
- system_Init( p_libvlc, &i_argc, ppsz_argv );
+ system_Init();
/*
* Support for gettext
* list of configuration options exported by each module and loads their
* default values.
*/
- module_LoadPlugins( p_libvlc, builtins_module );
+ module_LoadPlugins( p_libvlc );
if( p_libvlc->b_die )
{
b_exit = true;
i_ret = VLC_EEXITSUCCESS;
}
- /* Check for config file options */
- if( !var_InheritBool( p_libvlc, "ignore-config" ) )
- {
- if( var_InheritBool( p_libvlc, "reset-config" ) )
- {
- config_ResetAll( p_libvlc );
- config_SaveConfigFile( p_libvlc, NULL );
- }
- }
-
if( module_count <= 1 )
{
msg_Err( p_libvlc, "No plugins found! Check your VLC installation.");
* Override default configuration with config file settings
*/
if( !var_InheritBool( p_libvlc, "ignore-config" ) )
- config_LoadConfigFile( p_libvlc );
+ {
+ if( var_InheritBool( p_libvlc, "reset-config" ) )
+ {
+ config_ResetAll( p_libvlc );
+ config_SaveConfigFile( p_libvlc );
+ }
+ else
+ config_LoadConfigFile( p_libvlc );
+ }
/*
* Override configuration with command line settings
/* check if VLC is available on the bus
* if not: D-Bus control is not enabled on the other
* instance and we can't pass MRLs to it */
- DBusMessage *p_test_msg = NULL;
+ DBusMessage *p_test_msg = NULL;
DBusMessage *p_test_reply = NULL;
+
p_test_msg = dbus_message_new_method_call(
- "org.mpris.vlc", "/",
- "org.freedesktop.MediaPlayer", "Identity" );
+ "org.mpris.MediaPlayer2.vlc", "/org/mpris/MediaPlayer2",
+ "org.freedesktop.DBus.Introspectable", "Introspect" );
+
/* block until a reply arrives */
p_test_reply = dbus_connection_send_with_reply_and_block(
p_conn, p_test_msg, -1, &dbus_error );
/* We need to resolve relative paths in this instance */
char *psz_mrl = make_URI( ppsz_argv[i_input], NULL );
+ const char *psz_after_track = "/";
+
if( psz_mrl == NULL )
continue;
msg_Dbg( p_libvlc, "Adds %s to the running Media Player",
psz_mrl );
p_dbus_msg = dbus_message_new_method_call(
- "org.mpris.vlc", "/TrackList",
- "org.freedesktop.MediaPlayer", "AddTrack" );
+ "org.mpris.MediaPlayer2.vlc", "/org/mpris/MediaPlayer2",
+ "org.mpris.MediaPlayer2.TrackList", "AddTrack" );
if ( NULL == p_dbus_msg )
{
exit( 1 );
}
free( psz_mrl );
+
+ if( !dbus_message_iter_append_basic( &dbus_args,
+ DBUS_TYPE_OBJECT_PATH, &psz_after_track ) )
+ {
+ dbus_message_unref( p_dbus_msg );
+ system_End( p_libvlc );
+ exit( 1 );
+ }
+
b_play = TRUE;
if( var_InheritBool( p_libvlc, "playlist-enqueue" ) )
b_play = FALSE;
+
if ( !dbus_message_iter_append_basic( &dbus_args,
DBUS_TYPE_BOOLEAN, &b_play ) )
{
priv->i_timers = 0;
priv->pp_timers = NULL;
- priv->i_last_input_id = 0; /* Not very safe, should be removed */
-
/*
* Initialize hotkey handling
*/
- vlc_InitActions( p_libvlc );
+ priv->actions = vlc_InitActions( p_libvlc );
/* Create a variable for showing the fullscreen interface */
var_Create( p_libvlc, "intf-show", VLC_VAR_BOOL );
#if defined(MEDIA_LIBRARY)
/* Get the ML */
- if( var_GetBool( p_libvlc, "load-media-library-on-startup" ) == true )
+ if( var_GetBool( p_libvlc, "load-media-library-on-startup" ) )
{
priv->p_ml = ml_Create( VLC_OBJECT( p_libvlc ), NULL );
if( !priv->p_ml )
intf_Create( p_libvlc, "netsync,none" );
}
-#ifdef WIN32
- if( var_InheritBool( p_libvlc, "prefer-system-codecs") )
- {
- char *psz_codecs = var_CreateGetNonEmptyString( p_libvlc, "codec" );
- if( psz_codecs )
- {
- char *psz_morecodecs;
- if( asprintf(&psz_morecodecs, "%s,dmo", psz_codecs) != -1 )
- {
- var_SetString( p_libvlc, "codec", psz_morecodecs);
- free( psz_morecodecs );
- }
- free( psz_codecs );
- }
- else
- var_SetString( p_libvlc, "codec", "dmo");
- }
-#endif
-
#ifdef __APPLE__
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-nsobject", VLC_VAR_ADDRESS );
#endif
#ifdef WIN32
- var_Create( p_libvlc, "drawable-hwnd", VLC_VAR_ADDRESS );
+ var_Create( p_libvlc, "drawable-hwnd", VLC_VAR_INTEGER );
#endif
/*
priv->p_memcpy_module = NULL;
}
+ /* Save the configuration */
+ if( !var_InheritBool( p_libvlc, "ignore-config" ) )
+ config_AutoSaveConfigFile( VLC_OBJECT(p_libvlc) );
+
/* Free module bank. It is refcounted, so we call this each time */
module_EndBank( p_libvlc, true );
- vlc_DeinitActions( p_libvlc );
+ vlc_DeinitActions( p_libvlc, priv->actions );
}
/**
p_item < p_end;
p_item++ )
{
- if( (p_item->i_type & CONFIG_ITEM) &&
+ if( CONFIG_ITEM(p_item->i_type) &&
!p_item->b_advanced && !p_item->b_removed ) break;
}
continue;
}
- switch( p_item->i_type )
+ switch( CONFIG_CLASS(p_item->i_type) )
{
- case CONFIG_HINT_CATEGORY:
- case CONFIG_HINT_USAGE:
- if( !strcmp( "main", p_parser->psz_object_name ) )
+ case 0: // hint class
+ switch( p_item->i_type )
{
- if( b_color )
- utf8_fprintf( stdout, GREEN "\n %s\n" GRAY,
- module_gettext( p_parser, p_item->psz_text ) );
- else
- utf8_fprintf( stdout, "\n %s\n",
- module_gettext( p_parser, p_item->psz_text ) );
- }
- if( b_description && p_item->psz_longtext )
- {
- if( b_color )
- utf8_fprintf( stdout, CYAN " %s\n" GRAY,
- module_gettext( p_parser, p_item->psz_longtext ) );
- else
- utf8_fprintf( stdout, " %s\n",
- module_gettext( p_parser, p_item->psz_longtext ) );
+ case CONFIG_HINT_CATEGORY:
+ case CONFIG_HINT_USAGE:
+ if( !strcmp( "main", p_parser->psz_object_name ) )
+ {
+ if( b_color )
+ utf8_fprintf( stdout, GREEN "\n %s\n" GRAY,
+ module_gettext( p_parser, p_item->psz_text ) );
+ else
+ utf8_fprintf( stdout, "\n %s\n",
+ module_gettext( p_parser, p_item->psz_text ) );
+ }
+ if( b_description && p_item->psz_longtext )
+ {
+ if( b_color )
+ utf8_fprintf( stdout, CYAN " %s\n" GRAY,
+ module_gettext( p_parser, p_item->psz_longtext ) );
+ else
+ utf8_fprintf( stdout, " %s\n",
+ module_gettext( p_parser, p_item->psz_longtext ) );
}
break;
- case CONFIG_HINT_SUBCATEGORY:
- if( strcmp( "main", p_parser->psz_object_name ) )
+ case CONFIG_HINT_SUBCATEGORY:
+ if( strcmp( "main", p_parser->psz_object_name ) )
+ break;
+ case CONFIG_SECTION:
+ p_section = p_item;
break;
- case CONFIG_SECTION:
- p_section = p_item;
+ }
break;
case CONFIG_ITEM_STRING:
- case CONFIG_ITEM_LOADFILE:
- case CONFIG_ITEM_SAVEFILE:
- case CONFIG_ITEM_DIRECTORY:
- case CONFIG_ITEM_KEY:
- case CONFIG_ITEM_MODULE: /* We could also have "=<" here */
- case CONFIG_ITEM_MODULE_CAT:
- case CONFIG_ITEM_MODULE_LIST:
- case CONFIG_ITEM_MODULE_LIST_CAT:
- case CONFIG_ITEM_FONT:
- case CONFIG_ITEM_PASSWORD:
print_help_section( p_parser, p_section, b_color,
b_description );
p_section = NULL;
- strlen( psz_bra ) - strlen( psz_type )
- strlen( psz_ket ) - 1;
- if( p_item->i_type == CONFIG_ITEM_BOOL && !b_help_module )
+ if( CONFIG_CLASS(p_item->i_type) == CONFIG_ITEM_BOOL
+ && !b_help_module )
{
psz_prefix = ", --no-";
i -= strlen( p_item->psz_name ) + strlen( psz_prefix );
psz_spaces[i] = '\0';
}
- if( p_item->i_type == CONFIG_ITEM_BOOL && !b_help_module )
+ if( CONFIG_CLASS(p_item->i_type) == CONFIG_ITEM_BOOL
+ && !b_help_module )
{
utf8_fprintf( stdout, psz_format_bool, psz_short,
p_item->psz_name, psz_prefix, p_item->psz_name,
i_cur_width = b_description && !b_description_hack
? i_width_description
: i_width;
+ if( !*psz_text ) strcpy(psz_text, " ");
while( *psz_text )
{
char *psz_parser, *psz_word;