Mercurial > audlegacy
changeset 2548:68d1e9761cc5 trunk
[svn] - highly experimental code to speed up loading huge playlist. let me know if it breaks something.
author | yaz |
---|---|
date | Sun, 18 Feb 2007 20:42:53 -0800 |
parents | 8ac0dcad22e3 |
children | ef59b072a5d2 |
files | ChangeLog src/audacious/build_stamp.c src/audacious/playlist.c src/audacious/playlist.h |
diffstat | 4 files changed, 35 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Feb 18 20:40:14 2007 -0800 +++ b/ChangeLog Sun Feb 18 20:42:53 2007 -0800 @@ -1,3 +1,11 @@ +2007-02-19 04:40:14 +0000 Yoshiki Yazawa <yaz@cc.rim.or.jp> + revision [4104] + - changes in r4102 break jtf. disabled for now. + + trunk/src/audacious/ui_jumptotrack.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + + 2007-02-18 15:24:13 +0000 William Pitcock <nenolod@sacredspiral.co.uk> revision [4102] - run gtk events while iterating through the playlist
--- a/src/audacious/build_stamp.c Sun Feb 18 20:40:14 2007 -0800 +++ b/src/audacious/build_stamp.c Sun Feb 18 20:42:53 2007 -0800 @@ -1,2 +1,2 @@ #include <glib.h> -const gchar *svn_stamp = "20070218-4102"; +const gchar *svn_stamp = "20070219-4104";
--- a/src/audacious/playlist.c Sun Feb 18 20:40:14 2007 -0800 +++ b/src/audacious/playlist.c Sun Feb 18 20:42:53 2007 -0800 @@ -615,22 +615,37 @@ TitleInput *tuple, InputPlugin * dec) { - GList *node; PlaylistEntry *entry; g_return_if_fail(playlist != NULL); g_return_if_fail(filename != NULL); + entry = playlist_entry_new(filename, tuple->track_name, tuple->length, dec); + if(!playlist->tail) + playlist->tail = g_list_last(playlist->entries); + PLAYLIST_LOCK(playlist->mutex); - playlist->entries = g_list_insert(playlist->entries, - playlist_entry_new(filename, tuple->track_name, tuple->length, dec), - pos); - - if (pos < 0) - pos = g_list_length(playlist->entries) - 1; /* last element. */ - - node = g_list_nth(playlist->entries, pos); - entry = PLAYLIST_ENTRY(node->data); + + if(pos == -1) { // the common case + GList *element; + element = g_list_alloc(); + element->data = entry; + element->prev = playlist->tail; // NULL is allowed here. + element->next = NULL; + + if(!playlist->entries) { // this is the first element + playlist->entries = element; + playlist->tail = element; + } + else { // the rests + g_return_if_fail(playlist->tail != NULL); + playlist->tail->next = element; + playlist->tail = element; + } + } + else { + playlist->entries = g_list_insert(playlist->entries, entry, pos); + } if (tuple != NULL) { entry->title = xmms_get_titlestring(tuple->formatter != NULL ? tuple->formatter : xmms_get_gentitle_format(), tuple);
--- a/src/audacious/playlist.h Sun Feb 18 20:40:14 2007 -0800 +++ b/src/audacious/playlist.h Sun Feb 18 20:42:53 2007 -0800 @@ -77,6 +77,7 @@ gboolean pl_selection_more; gboolean loading_playlist; GMutex *mutex; /* this is required for multiple playlist */ + GList *tail; /* marker for the last element in playlist->entries */ } Playlist; typedef enum {