}
/**
- * Stops and destroys all interfaces
- * @param p_libvlc the LibVLC instance
+ * Starts an interface plugin.
+ */
+int libvlc_InternalAddIntf(libvlc_int_t *libvlc, const char *name)
+{
+ playlist_t *playlist = intf_GetPlaylist(libvlc);
+ int ret;
+
+ if (unlikely(playlist == NULL))
+ ret = VLC_ENOMEM;
+ else
+ if (name != NULL)
+ ret = intf_Create(playlist, name);
+ else
+ { /* Default interface */
+ char *intf = var_InheritString(libvlc, "intf");
+ if (intf == NULL) /* "intf" has not been set */
+ {
+ char *pidfile = var_InheritString(libvlc, "pidfile");
+ if (pidfile != NULL)
+ free(pidfile);
+ else
+ msg_Info(libvlc, _("Running vlc with the default interface. "
+ "Use 'cvlc' to use vlc without interface."));
+ }
+ ret = intf_Create(playlist, intf);
+ name = "default";
+ }
+ if (ret != VLC_SUCCESS)
+ msg_Err(libvlc, "interface \"%s\" initialization failed", name);
+ return ret;
+}
+
+/**
+ * Stops and destroys all interfaces, then the playlist.
+ * @warning FIXME
+ * @param libvlc the LibVLC instance
*/
void intf_DestroyAll(libvlc_int_t *libvlc)
{
vlc_mutex_lock(&lock);
}
+
+ libvlc_priv(libvlc)->playlist = NULL;
}
vlc_mutex_unlock(&lock);
+
+ if (playlist != NULL)
+ playlist_Destroy(playlist);
}
/* Following functions are local */
}
#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 )
vlc_object_release( p_libvlc );
}
-/**
- * Add an interface plugin and run it
- */
-int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, const char *name )
-{
- if( !p_libvlc )
- return VLC_EGENERIC;
-
- playlist_t *playlist = pl_Get(p_libvlc);
- int ret;
-
- if( name != NULL )
- ret = intf_Create( playlist, 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( playlist, 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
*****************************************************************************