playlist: add no inherit flag for editable playlists (refs #16923)
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 8 May 2016 13:48:30 +0000 (15:48 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Tue, 10 May 2016 17:27:30 +0000 (19:27 +0200)
Avoids copying some sd specific playlist flags on
playlist item duplication. (ex RO flag from SD which
makes current playlist item as non deletable)

Not setting the inheritable flag by default avoids
changing the item creation api to clear flags.

include/vlc_playlist.h
src/playlist/engine.c
src/playlist/tree.c

index 5f716bc..4363405 100644 (file)
@@ -152,6 +152,7 @@ typedef enum {
     PLAYLIST_REMOVE_FLAG       = 0x0010,  /**< Remove this item at the end */
     PLAYLIST_EXPANDED_FLAG     = 0x0020,  /**< Expanded node */
     PLAYLIST_SUBITEM_STOP_FLAG = 0x0040,  /**< Must playlist stop if the item gets subitems ?*/
+    PLAYLIST_NO_INHERIT_FLAG   = 0x0080,  /**< Childs must not inherit flags from parent node */
 } playlist_item_flags_e;
 
 /** Playlist status */
index 6000a37..97f9e11 100644 (file)
@@ -237,10 +237,10 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
     root = playlist_NodeCreate( p_playlist, NULL, NULL,
                                 PLAYLIST_END, 0, NULL );
     playing = playlist_NodeCreate( p_playlist, _( "Playlist" ), root,
-                                   PLAYLIST_END, PLAYLIST_RO_FLAG, NULL );
+                                   PLAYLIST_END, PLAYLIST_RO_FLAG | PLAYLIST_NO_INHERIT_FLAG, NULL );
     if( var_InheritBool( p_parent, "media-library") )
         ml = playlist_NodeCreate( p_playlist, _( "Media Library" ), root,
-                                  PLAYLIST_END, PLAYLIST_RO_FLAG, NULL );
+                                  PLAYLIST_END, PLAYLIST_RO_FLAG | PLAYLIST_NO_INHERIT_FLAG, NULL );
     else
         ml = NULL;
     PL_UNLOCK;
index d991162..e44e7a8 100644 (file)
@@ -222,6 +222,11 @@ int playlist_NodeInsert( playlist_t *p_playlist,
                  i_position,
                  p_item );
     p_item->p_parent = p_parent;
+
+    /* Inherit special flags from parent (sd cases) */
+    if( ( p_parent->i_flags & PLAYLIST_NO_INHERIT_FLAG ) == 0 )
+        p_item->i_flags |= (p_parent->i_flags & (PLAYLIST_RO_FLAG | PLAYLIST_SKIP_FLAG));
+
     return VLC_SUCCESS;
 }