[vlc-devel] commit: playlist: fix command line options ( Rafaël Carré )

git version control git at videolan.org
Mon Jan 18 09:52:33 CET 2010


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Mon Jan 18 09:51:26 2010 +0100| [89e0f5225631ceb9051b0ec9879f4b1ff324af94] | committer: Rafaël Carré 

playlist: fix command line options

Use var_Inherit* on parent object in playlist_Create()
Check "media-library" before calling playlist_ML*()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89e0f5225631ceb9051b0ec9879f4b1ff324af94
---

 src/playlist/engine.c   |   19 ++++++++++++-------
 src/playlist/loadsave.c |    6 ------
 src/playlist/thread.c   |    4 ++--
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 0d68bb4..6dab8e7 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -97,12 +97,12 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
     pl_priv(p_playlist)->b_reset_currently_playing = true;
     pl_priv(p_playlist)->last_rebuild_date = 0;
 
-    pl_priv(p_playlist)->b_tree = var_CreateGetBool( p_playlist, "playlist-tree" );
+    pl_priv(p_playlist)->b_tree = var_InheritBool( p_parent, "playlist-tree" );
 
     pl_priv(p_playlist)->b_doing_ml = false;
 
-    const bool b_auto_preparse = var_CreateGetBool( p_playlist, "auto-preparse" );
-    pl_priv(p_playlist)->b_auto_preparse = b_auto_preparse;
+    pl_priv(p_playlist)->b_auto_preparse =
+        var_InheritBool( p_parent, "auto-preparse" );
 
     PL_LOCK; /* playlist_NodeCreate will check for it */
     p_playlist->p_root_category = playlist_NodeCreate( p_playlist, NULL, NULL,
@@ -129,7 +129,8 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
         !p_playlist->p_local_onelevel->p_input )
         return NULL;
 
-    if( config_GetInt( p_playlist, "media-library") )
+    const bool b_ml = var_InheritBool( p_parent, "media-library");
+    if( b_ml )
     {
         PL_LOCK; /* playlist_NodesPairCreate will check for it */
         playlist_NodesPairCreate( p_playlist, _( "Media Library" ),
@@ -154,9 +155,13 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
     pl_priv(p_playlist)->request.b_request = false;
     pl_priv(p_playlist)->status.i_status = PLAYLIST_STOPPED;
 
-    pl_priv(p_playlist)->b_auto_preparse = false;
-    playlist_MLLoad( p_playlist );
-    pl_priv(p_playlist)->b_auto_preparse = b_auto_preparse;
+    if(b_ml)
+    {
+        const bool b_auto_preparse = pl_priv(p_playlist)->b_auto_preparse;
+        pl_priv(p_playlist)->b_auto_preparse = false;
+        playlist_MLLoad( p_playlist );
+        pl_priv(p_playlist)->b_auto_preparse = b_auto_preparse;
+    }
 
     vlc_object_set_destructor( p_playlist, playlist_Destructor );
 
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index cd51e82..357592b 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -121,9 +121,6 @@ int playlist_MLLoad( playlist_t *p_playlist )
     char *psz_uri = NULL;
     input_item_t *p_input;
 
-    if( !config_GetInt( p_playlist, "media-library") )
-        return VLC_SUCCESS;
-
     psz_datadir = config_GetUserDir( VLC_DATA_DIR );
 
     if( !psz_datadir ) /* XXX: This should never happen */
@@ -204,9 +201,6 @@ int playlist_MLDump( playlist_t *p_playlist )
 {
     char *psz_datadir;
 
-    if( !config_GetInt( p_playlist, "media-library") )
-        return VLC_SUCCESS;
-
     psz_datadir = config_GetUserDir( VLC_DATA_DIR );
 
     if( !psz_datadir ) /* XXX: This should never happen */
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index a571f69..8aaf782 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -109,8 +109,8 @@ void playlist_Deactivate( playlist_t *p_playlist )
         input_resource_Delete( p_sys->p_input_resource );
     p_sys->p_input_resource = NULL;
 
-    /* */
-    playlist_MLDump( p_playlist );
+    if( var_InheritBool( p_playlist, "media-library" ) )
+        playlist_MLDump( p_playlist );
 
     PL_LOCK;
 




More information about the vlc-devel mailing list