--- xmms-1.2.10.orig/xmms/playlist.c 2004-02-23 21:31:43.000000000 +0100 +++ xmms-1.2.10/xmms/playlist.c 2006-07-07 11:34:52.000000000 +0200 @@ -39,7 +39,7 @@ extern SVis *mainwin_svis; static gboolean playlist_get_info_entry(PlaylistEntry *entry); static int playlist_sort_str_by_path_cmpfunc(gconstpointer a, gconstpointer b); static guint playlist_load_ins(char * filename, long pos); -static void playlist_load_ins_file(char *filename, char *playlist_name, long pos, char *title, int len); +static void playlist_load_ins_file(char *filename, char *playlist_name, long pos, char *title, int len, char *fade); static int __get_playlist_length(void); static void playlist_generate_shuffle_list(void); static void __playlist_generate_shuffle_list(void); @@ -88,10 +88,9 @@ void playlist_clear(void) while (node) { entry = node->data; - if (entry->filename) - g_free(entry->filename); - if (entry->title) - g_free(entry->title); + g_free(entry->filename); + g_free(entry->title); + g_free(entry->fade); g_free(entry); node = node->next; } @@ -150,10 +149,9 @@ void playlist_delete_node(GList *node, g g_list_free_1(queued_song); } - if (entry->filename) - g_free(entry->filename); - if (entry->title) - g_free(entry->title); + g_free(entry->filename); + g_free(entry->title); + g_free(entry->fade); shuffle_list = g_list_remove(shuffle_list, entry); playlist = g_list_remove_link(playlist, node); g_free(entry); @@ -262,15 +260,15 @@ void playlist_delete(gboolean crop) } } -static void __playlist_ins_with_info(char *filename, long pos, char* title, int len) +static void __playlist_ins_with_info(char *filename, long pos, char* title, int len, char *fade) { PlaylistEntry *entry; entry = g_malloc0(sizeof (PlaylistEntry)); entry->filename = g_strdup(filename); - if (title) - entry->title = g_strdup(title); - entry->length = len; + entry->title = g_strdup(title); + entry->length = len; + entry->fade = g_strdup(fade); pthread_mutex_lock(&playlist_mutex); playlist = g_list_insert(playlist, entry, pos); @@ -279,9 +277,9 @@ static void __playlist_ins_with_info(cha playlist_get_info_scan_active = TRUE; } -static void __playlist_ins(char * filename, long pos) +static void __playlist_ins(char *filename, long pos) { - __playlist_ins_with_info(filename, pos, NULL, -1); + __playlist_ins_with_info(filename, pos, NULL, -1, NULL); } static gboolean is_playlist_name(char *pathname) @@ -1060,7 +1058,7 @@ gboolean playlist_load(char * filename) return playlist_load_ins(filename, -1); } -static void playlist_load_ins_file(char *filename, char *playlist_name, long pos, char *title, int len) +static void playlist_load_ins_file(char *filename, char *playlist_name, long pos, char *title, int len, char *fade) { char *temp, *path; @@ -1080,16 +1078,16 @@ static void playlist_load_ins_file(char *temp = '\0'; else { - __playlist_ins_with_info(filename, pos, title, len); + __playlist_ins_with_info(filename, pos, title, len, fade); return; } temp = g_strdup_printf("%s/%s", path, filename); - __playlist_ins_with_info(temp, pos, title, len); + __playlist_ins_with_info(temp, pos, title, len, fade); g_free(temp); g_free(path); } else - __playlist_ins_with_info(filename, pos, title, len); + __playlist_ins_with_info(filename, pos, title, len, fade); } static void parse_extm3u_info(char *info, char **title, int *length) @@ -1128,7 +1126,7 @@ static guint playlist_load_ins(char * fi guint entries = 0; int linelen = 1024; gboolean extm3u = FALSE; - char *ext_info = NULL, *ext_title = NULL; + char *ext_info = NULL, *ext_title = NULL, *ext_fade = NULL; int ext_len = -1; ext = strrchr(filename, '.'); @@ -1152,7 +1150,7 @@ static guint playlist_load_ins(char * fi if (line != NULL) { playlist_load_ins_file(line, filename, pos, - NULL, -1); + NULL, -1, NULL); entries++; if (pos >= 0) pos++; @@ -1200,6 +1198,13 @@ static guint playlist_load_ins(char * fi ext_info = g_strdup(line); continue; } + else if (extm3u && !strncmp(line, "#EXTFADE:", 9)) + { + if (ext_fade) + g_free(ext_fade); + ext_fade = g_strdup(line); + continue; + } if (line[0] == '#') { @@ -1219,11 +1224,14 @@ static guint playlist_load_ins(char * fi ext_info = NULL; } - playlist_load_ins_file(line, filename, pos, ext_title, ext_len); + playlist_load_ins_file(line, filename, pos, ext_title, ext_len, ext_fade); g_free(ext_title); ext_title = NULL; ext_len = -1; + + g_free(ext_fade); + ext_fade = NULL; entries++; if (pos >= 0) @@ -1367,6 +1375,32 @@ int playlist_get_songtime(int pos) return retval; } +char * playlist_get_fadeinfo(int pos) +{ + char *ret; + PlaylistEntry *entry; + GList *node; + + PL_LOCK(); + if (!playlist) + { + PL_UNLOCK(); + return NULL; + } + node = g_list_nth(playlist, pos); + if (!node) + { + PL_UNLOCK(); + return NULL; + } + entry = node->data; + + ret = g_strdup(entry->fade); + PL_UNLOCK(); + + return ret; +} + static int playlist_sort_by_title_cmpfunc(PlaylistEntry * a, PlaylistEntry * b) { char *a_title, *b_title; --- xmms-1.2.10.orig/xmms/playlist.h 2004-01-17 01:22:17.000000000 +0100 +++ xmms-1.2.10/xmms/playlist.h 2006-07-07 11:33:39.000000000 +0200 @@ -26,6 +26,7 @@ typedef struct gchar *title; gint length; gboolean selected; + gchar *fade; } PlaylistEntry;