X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Flibvlc.c;h=946ce2e3f199ffa89bd0a746e07dcf249dbb2b71;hb=9501e5253932c9a7f40d31c0f4fea2c6d26cfdd2;hp=d6c63ade9e8ea31bb213a80a313647307cc512f9;hpb=a5056a2d8fb05af732914c37e6bd15f56a97aa9d;p=vlc diff --git a/src/libvlc.c b/src/libvlc.c index d6c63ade9e..946ce2e3f1 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -84,16 +84,14 @@ static void GetFilenames ( libvlc_int_t *, unsigned, const char *const [] ); /** - * Allocate a libvlc instance, initialize global data if needed - * It also initializes the threading system + * Allocate a blank libvlc instance, also setting the exit handler. + * Vlc's threading system must have been initialized first */ libvlc_int_t * libvlc_InternalCreate( void ) { libvlc_int_t *p_libvlc; libvlc_priv_t *priv; - /* Now that the thread system is initialized, we don't have much, but - * at least we have variables */ /* Allocate a libvlc instance object */ p_libvlc = vlc_custom_create( (vlc_object_t *)NULL, sizeof (*priv), "libvlc" ); @@ -447,7 +445,7 @@ dbus_out: } if( asprintf( &psz_temp, "%s,none", psz_module ) != -1) { - intf_Create( p_libvlc, psz_temp ); + libvlc_InternalAddIntf( p_libvlc, psz_temp ); free( psz_temp ); } } @@ -459,7 +457,7 @@ dbus_out: { char *logmode = var_CreateGetNonEmptyString( p_libvlc, "logmode" ); var_SetString( p_libvlc, "logmode", "syslog" ); - intf_Create( p_libvlc, "logger,none" ); + libvlc_InternalAddIntf( p_libvlc, "logger,none" ); if( logmode ) { @@ -471,12 +469,10 @@ dbus_out: else #endif if( var_InheritBool( p_libvlc, "file-logging" ) ) - intf_Create( p_libvlc, "logger,none" ); + libvlc_InternalAddIntf( p_libvlc, "logger,none" ); if( var_InheritBool( p_libvlc, "network-synchronisation") ) - { - intf_Create( p_libvlc, "netsync,none" ); - } + libvlc_InternalAddIntf( p_libvlc, "netsync,none" ); #ifdef __APPLE__ var_Create( p_libvlc, "drawable-view-top", VLC_VAR_INTEGER ); @@ -506,8 +502,7 @@ dbus_out: psz_val = var_InheritString( p_libvlc, "open" ); if ( psz_val != NULL ) { - playlist_AddExt( pl_Get(p_libvlc), psz_val, NULL, PLAYLIST_INSERT, 0, - -1, 0, NULL, 0, true, pl_Unlocked ); + intf_InsertItem( p_libvlc, psz_val, 0, NULL, 0 ); free( psz_val ); } @@ -535,11 +530,6 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc ) } #endif - /* Free playlist now, all threads are gone */ - playlist_t *p_playlist = libvlc_priv (p_libvlc)->playlist; - if( p_playlist != NULL ) - playlist_Destroy( p_playlist ); - #if !defined( _WIN32 ) && !defined( __OS2__ ) char *pidfile = var_InheritString( p_libvlc, "pidfile" ); if( pidfile != NULL ) @@ -586,39 +576,6 @@ void libvlc_InternalDestroy( libvlc_int_t *p_libvlc ) vlc_object_release( p_libvlc ); } -/** - * Add an interface plugin and run it - */ -int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, const char *name ) -{ - int ret; - - if( !p_libvlc ) - return VLC_EGENERIC; - - if( name != NULL ) - ret = intf_Create( p_libvlc, name ); - else - { /* Default interface */ - char *intf = var_InheritString( p_libvlc, "intf" ); - if( intf == NULL ) /* "intf" has not been set */ - { - char *pidfile = var_InheritString( p_libvlc, "pidfile" ); - if( pidfile != NULL ) - free( pidfile ); - else - msg_Info( p_libvlc, "%s", - _("Running vlc with the default interface. " - "Use 'cvlc' to use vlc without interface.") ); - } - ret = intf_Create( p_libvlc, intf ); - name = "default"; - } - if( ret ) - msg_Err( p_libvlc, "interface \"%s\" initialization failed", name ); - return ret; -} - /***************************************************************************** * GetFilenames: parse command line options which are not flags ***************************************************************************** @@ -651,10 +608,9 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n, continue; } - playlist_AddExt( pl_Get( p_vlc ), (mrl != NULL) ? mrl : args[n], NULL, - PLAYLIST_INSERT, 0, -1, i_options, + intf_InsertItem( p_vlc, (mrl != NULL) ? mrl : args[n], i_options, ( i_options ? &args[n + 1] : NULL ), - VLC_INPUT_OPTION_TRUSTED, true, pl_Unlocked ); + VLC_INPUT_OPTION_TRUSTED ); free( mrl ); } } @@ -663,14 +619,15 @@ static void GetFilenames( libvlc_int_t *p_vlc, unsigned n, * Requests extraction of the meta data for an input item (a.k.a. preparsing). * The actual extraction is asynchronous. */ -int libvlc_MetaRequest(libvlc_int_t *libvlc, input_item_t *item) +int libvlc_MetaRequest(libvlc_int_t *libvlc, input_item_t *item, + input_item_meta_request_option_t i_options) { libvlc_priv_t *priv = libvlc_priv(libvlc); if (unlikely(priv->parser == NULL)) return VLC_ENOMEM; - playlist_preparser_Push(priv->parser, item); + playlist_preparser_Push(priv->parser, item, i_options); return VLC_SUCCESS; } @@ -678,13 +635,14 @@ int libvlc_MetaRequest(libvlc_int_t *libvlc, input_item_t *item) * Requests retrieving/downloading art for an input item. * The retrieval is performed asynchronously. */ -int libvlc_ArtRequest(libvlc_int_t *libvlc, input_item_t *item) +int libvlc_ArtRequest(libvlc_int_t *libvlc, input_item_t *item, + input_item_meta_request_option_t i_options) { libvlc_priv_t *priv = libvlc_priv(libvlc); if (unlikely(priv->parser == NULL)) return VLC_ENOMEM; - playlist_preparser_fetcher_Push(priv->parser, item); + playlist_preparser_fetcher_Push(priv->parser, item, i_options); return VLC_SUCCESS; }