Commit f0573e67 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: remove phony playlist item pointers

parent a1e55cc4
......@@ -174,14 +174,6 @@ struct playlist_t
playlist_item_t * p_root;
playlist_item_t * p_playing;
playlist_item_t * p_media_library;
//Phony ones, point to those above;
playlist_item_t * p_root_category; /**< Root of category tree */
playlist_item_t * p_root_onelevel; /**< Root of onelevel tree */
playlist_item_t * p_local_category; /** < "Playlist" in CATEGORY view */
playlist_item_t * p_ml_category; /** < "Library" in CATEGORY view */
playlist_item_t * p_local_onelevel; /** < "Playlist" in ONELEVEL view */
playlist_item_t * p_ml_onelevel; /** < "Library" in ONELEVEL view */
};
/** Helper to add an item */
......
......@@ -1325,14 +1325,14 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
else if( !strcmp( psz_cmd, "playlist" ) )
{
msg_rc( "+----[ Playlist ]" );
print_playlist( p_intf, p_playlist->p_root_category, 0 );
print_playlist( p_intf, p_playlist->p_root, 0 );
msg_rc( "+----[ End of playlist ]" );
}
else if( !strcmp( psz_cmd, "sort" ))
{
PL_LOCK;
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_onelevel,
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root,
SORT_ARTIST, ORDER_NORMAL );
PL_UNLOCK;
}
......
......@@ -279,7 +279,7 @@ static VLCMain *sharedInstance = nil;
playlist_t * p_playlist = pl_Get(getIntf());
PL_LOCK;
items_at_launch = p_playlist->p_local_category->i_children;
items_at_launch = p_playlist->p_playing->i_children;
PL_UNLOCK;
#ifdef HAVE_SPARKLE
......@@ -322,7 +322,7 @@ static VLCMain *sharedInstance = nil;
// note that PLAYLIST_PLAY will not stop any playback if already started
playlist_t * p_playlist = pl_Get(getIntf());
PL_LOCK;
BOOL kidsAround = p_playlist->p_local_category->i_children != 0;
BOOL kidsAround = p_playlist->p_playing->i_children != 0;
if (kidsAround && var_GetBool(p_playlist, "playlist-autostart"))
playlist_Control(p_playlist, PLAYLIST_PLAY, true);
PL_UNLOCK;
......
......@@ -1133,7 +1133,7 @@
playlist_Export(p_playlist,
[actualFilename fileSystemRepresentation],
p_playlist->p_local_category, "export-m3u");
p_playlist->p_playing, "export-m3u");
} else if ([_playlistSaveAccessoryPopup indexOfSelectedItem] == 1) {
NSString *actualFilename;
NSRange range;
......@@ -1147,7 +1147,7 @@
playlist_Export(p_playlist,
[actualFilename fileSystemRepresentation],
p_playlist->p_local_category, "export-xspf");
p_playlist->p_playing, "export-xspf");
} else {
NSString *actualFilename;
NSRange range;
......@@ -1161,7 +1161,7 @@
playlist_Export(p_playlist,
[actualFilename fileSystemRepresentation],
p_playlist->p_local_category, "export-html");
p_playlist->p_playing, "export-html");
}
}
}
......
......@@ -952,9 +952,9 @@ static const float f_min_window_height = 307.;
PL_LOCK;
if (root == ROOT_TYPE_PLAYLIST)
[_categoryLabel setStringValue: [_NS("Playlist") stringByAppendingString:[self _playbackDurationOfNode:p_playlist->p_local_category]]];
[_categoryLabel setStringValue: [_NS("Playlist") stringByAppendingString:[self _playbackDurationOfNode:p_playlist->p_playing]]];
else if (root == ROOT_TYPE_MEDIALIBRARY)
[_categoryLabel setStringValue: [_NS("Media Library") stringByAppendingString:[self _playbackDurationOfNode:p_playlist->p_ml_category]]];
[_categoryLabel setStringValue: [_NS("Media Library") stringByAppendingString:[self _playbackDurationOfNode:p_playlist->p_playing]]];
PL_UNLOCK;
}
......@@ -1051,15 +1051,15 @@ static const float f_min_window_height = 307.;
if ([[item identifier] isEqualToString: @"playlist"]) {
PL_LOCK;
i_playlist_size = p_playlist->p_local_category->i_children;
i_playlist_size = p_playlist->p_playing->i_children;
PL_UNLOCK;
return i_playlist_size;
}
if ([[item identifier] isEqualToString: @"medialibrary"]) {
PL_LOCK;
if (p_playlist->p_ml_category)
i_playlist_size = p_playlist->p_ml_category->i_children;
if (p_playlist->p_media_library)
i_playlist_size = p_playlist->p_media_library->i_children;
PL_UNLOCK;
return i_playlist_size;
......@@ -1151,7 +1151,7 @@ static const float f_min_window_height = 307.;
[self _updatePlaylistTitle];
} else if ([[item identifier] isEqualToString:@"medialibrary"]) {
if (p_playlist->p_ml_category) {
if (p_playlist->p_media_library) {
PL_LOCK;
[[[[VLCMain sharedInstance] playlist] model] changeRootItem:p_playlist->p_media_library];
......
......@@ -420,7 +420,7 @@ static void PlaylistRebuild(intf_thread_t *intf)
playlist_t *p_playlist = pl_Get(intf);
PlaylistDestroy(sys);
PlaylistAddNode(sys, p_playlist->p_root_onelevel, "");
PlaylistAddNode(sys, p_playlist->p_root, "");
}
static int ItemChanged(vlc_object_t *p_this, const char *variable,
......@@ -1316,7 +1316,7 @@ static bool HandlePlaylistKey(intf_thread_t *intf, int key)
/* Playlist sort */
case 'o':
case 'O':
playlist_RecursiveNodeSort(p_playlist, p_playlist->p_root_onelevel,
playlist_RecursiveNodeSort(p_playlist, p_playlist->p_root,
SORT_TITLE_NODES_FIRST,
(key == 'o')? ORDER_NORMAL : ORDER_REVERSE);
vlc_mutex_lock(&sys->pl_lock);
......@@ -1439,13 +1439,13 @@ static bool HandleBrowseKey(intf_thread_t *intf, int key)
p_parent = item ? item->p_parent : NULL;
PL_UNLOCK;
if (!p_parent)
p_parent = p_playlist->p_local_onelevel;
p_parent = p_playlist->p_playing;
}
while (p_parent->p_parent && p_parent->p_parent->p_parent)
p_parent = p_parent->p_parent;
input_item_t *p_input = p_playlist->p_local_onelevel->p_input;
input_item_t *p_input = p_playlist->p_playing->p_input;
playlist_Add(p_playlist, uri, NULL, PLAYLIST_APPEND,
PLAYLIST_END, p_parent->p_input == p_input, false);
......@@ -1475,7 +1475,7 @@ static void OpenSelection(intf_thread_t *intf)
current= playlist_CurrentPlayingItem(p_playlist);
p_parent = current ? current->p_parent : NULL;
if (!p_parent)
p_parent = p_playlist->p_local_onelevel;
p_parent = p_playlist->p_playing;
}
while (p_parent->p_parent && p_parent->p_parent->p_parent)
......@@ -1484,7 +1484,7 @@ static void OpenSelection(intf_thread_t *intf)
playlist_Add(p_playlist, uri, NULL,
PLAYLIST_APPEND|PLAYLIST_GO, PLAYLIST_END,
p_parent->p_input == p_playlist->p_local_onelevel->p_input,
p_parent->p_input == p_playlist->p_playing->p_input,
false);
sys->plidx_follow = true;
......
......@@ -378,7 +378,7 @@ void MessagesDialog::updatePLTree()
{
vlc_playlist_locker pl_lock ( THEPL );
pldebugTree->addTopLevelItem( PLWalk( p_playlist->p_root_category ) );
pldebugTree->addTopLevelItem( PLWalk( p_playlist->p_root ) );
}
pldebugTree->expandAll();
......
......@@ -99,7 +99,7 @@ void CmdPlaylistSave::execute()
}
playlist_Export( pPlaylist, m_file.c_str(),
pPlaylist->p_local_category, psz_module );
pPlaylist->p_playing, psz_module );
}
}
......
......@@ -38,7 +38,7 @@ void CmdPlaytreeSort::execute()
/// \todo Choose the correct view
playlist_t *p_playlist = getIntf()->p_sys->p_playlist;
PL_LOCK;
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root_onelevel,
playlist_RecursiveNodeSort( p_playlist, p_playlist->p_root,
SORT_TITLE, ORDER_NORMAL );
PL_UNLOCK;
......
......@@ -288,7 +288,7 @@ void Playtree::insertItems( VarTree& elem, const std::list<std::string>& files,
{
for( Iterator it = m_children.begin(); it != m_children.end(); ++it )
{
if( it->getId() == m_pPlaylist->p_local_category->i_id )
if( it->getId() == m_pPlaylist->p_playing->i_id )
{
p_elem = &*it;
break;
......@@ -296,15 +296,15 @@ void Playtree::insertItems( VarTree& elem, const std::list<std::string>& files,
}
}
if( p_elem->getId() == m_pPlaylist->p_local_category->i_id )
if( p_elem->getId() == m_pPlaylist->p_playing->i_id )
{
p_node = m_pPlaylist->p_local_category;
p_node = m_pPlaylist->p_playing;
i_pos = 0;
p_elem->setExpanded( true );
}
else if( p_elem->getId() == m_pPlaylist->p_ml_category->i_id )
else if( p_elem->getId() == m_pPlaylist->p_media_library->i_id )
{
p_node = m_pPlaylist->p_ml_category;
p_node = m_pPlaylist->p_media_library;
i_pos = 0;
p_elem->setExpanded( true );
}
......
......@@ -252,12 +252,6 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
p_playlist->p_root = root;
p_playlist->p_playing = playing;
p_playlist->p_media_library = ml;
p_playlist->p_root_category = p_playlist->p_root;
p_playlist->p_root_onelevel = p_playlist->p_root;
p_playlist->p_local_category = p_playlist->p_playing;
p_playlist->p_local_onelevel = p_playlist->p_playing;
p_playlist->p_ml_category = p_playlist->p_media_library;
p_playlist->p_ml_onelevel = p_playlist->p_media_library;;
/* Initial status */
pl_priv(p_playlist)->status.p_item = NULL;
......
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