changeset 1232:56b57ed0a136 trunk

[svn] - use tuples internally
author nenolod
date Wed, 14 Jun 2006 20:58:37 -0700
parents 502b369314c1
children 47a8833c2b01
files ChangeLog audacious/playlist.c
diffstat 2 files changed, 33 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 14 20:49:47 2006 -0700
+++ b/ChangeLog	Wed Jun 14 20:58:37 2006 -0700
@@ -1,3 +1,17 @@
+2006-06-15 03:49:47 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1376]
+  - InputPlugin class:
+  + get_song_tuple(gchar *filename);
+  + set_song_tuple(TitleInput *tuple);
+  - input_get_song_tuple() utility function to retrieve a songtuple/generic tuple
+  
+
+  Changes:        Modified:
+  +37 -0          trunk/audacious/input.c  
+  +1 -0           trunk/audacious/input.h  
+  +4 -1           trunk/audacious/plugin.h  
+
+
 2006-06-15 02:03:23 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1374]
   - attach a TitleInput tuple to the PlaylistEntry class.
--- a/audacious/playlist.c	Wed Jun 14 20:49:47 2006 -0700
+++ b/audacious/playlist.c	Wed Jun 14 20:58:37 2006 -0700
@@ -163,35 +163,41 @@
     if (!entry)
         return;
 
-    g_free(entry->filename);
-    g_free(entry->title);
+    if (entry->tuple != NULL)
+        bmp_title_input_free(entry->tuple);
+
+    if (entry->filename != NULL)
+        g_free(entry->filename);
+
+    if (entry->title != NULL)
+        g_free(entry->title);
+
     g_free(entry);
 }
 
 static gboolean
 playlist_entry_get_info(PlaylistEntry * entry)
 {
-    gchar *title = NULL;
-    gint length = -1;
+    TitleInput *tuple;
 
     g_return_val_if_fail(entry != NULL, FALSE);
 
-    if (entry->decoder == NULL)
-        input_get_song_info(entry->filename, &title, &length);
-    else if (entry->decoder->get_song_info != NULL)
-        entry->decoder->get_song_info(entry->filename, &title, &length);
-
-    if (!title && length == -1)
+    if (entry->decoder == NULL || entry->decoder->get_song_tuple == NULL)
+        tuple = input_get_song_tuple(entry->filename);
+    else
+        tuple = entry->decoder->get_song_tuple(entry->filename);
+
+    if (tuple == NULL)
         return FALSE;
 
     /* entry is still around */
-    entry->title = title;
-    entry->length = length;
+    entry->title = xmms_get_titlestring(xmms_get_gentitle_format(), tuple);
+    entry->length = tuple->length;
+    entry->tuple = tuple;
 
     return TRUE;
 }
 
-
 const gchar *
 playlist_get_current_name(void)
 {