Commit 7fa640c0 authored by François Cartegnie's avatar François Cartegnie 🤞

playlist: add no inherit flag for editable playlists (refs #16923)

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.
parent 7e10b252
......@@ -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 */
......
......@@ -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;
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment