changeset 1231:502b369314c1 trunk

[svn] - InputPlugin class: + get_song_tuple(gchar *filename); + set_song_tuple(TitleInput *tuple); - input_get_song_tuple() utility function to retrieve a songtuple/generic tuple
author nenolod
date Wed, 14 Jun 2006 20:49:47 -0700
parents a5d5f404b933
children 56b57ed0a136
files ChangeLog audacious/input.c audacious/input.h audacious/plugin.h
diffstat 4 files changed, 51 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 14 19:03:23 2006 -0700
+++ b/ChangeLog	Wed Jun 14 20:49:47 2006 -0700
@@ -1,3 +1,12 @@
+2006-06-15 02:03:23 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1374]
+  - attach a TitleInput tuple to the PlaylistEntry class.
+  
+
+  Changes:        Modified:
+  +7 -1           trunk/audacious/playlist.h  
+
+
 2006-06-15 01:46:43 +0000  William Pitcock <nenolod@nenolod.net>
   revision [1372]
   - Add TitleInput.length member.
--- a/audacious/input.c	Wed Jun 14 19:03:23 2006 -0700
+++ b/audacious/input.c	Wed Jun 14 20:49:47 2006 -0700
@@ -491,6 +491,43 @@
     g_free(filename_proxy);
 }
 
+TitleInput *
+input_get_song_tuple(const gchar * filename)
+{
+    InputPlugin *ip = NULL;
+    TitleInput *input;
+    GList *node;
+    gchar *tmp = NULL, *ext;
+    gchar *filename_proxy;
+
+    if (filename == NULL)
+	return NULL;
+
+    filename_proxy = g_strdup(filename);
+
+    for (node = get_input_list(); node != NULL; node = g_list_next(node)) {
+        ip = INPUT_PLUGIN(node->data);
+        if (input_is_enabled(ip->filename) && ip->is_our_file(filename_proxy))
+            break;
+    }
+
+    if (ip && node && ip->get_song_tuple)
+        input = ip->get_song_tuple(filename_proxy);
+    else {
+        input = bmp_title_input_new();
+
+        tmp = g_strdup(filename);
+        if ((ext = strrchr(tmp, '.')))
+            *ext = '\0';
+
+        input->file_name = g_path_get_basename(tmp);
+        input->file_ext = ext ? ext + 1 : NULL;
+        input->file_path = tmp;
+    }
+
+    return input;
+}
+
 static void
 input_general_file_info_box(const gchar * filename, InputPlugin * ip)
 {
--- a/audacious/input.h	Wed Jun 14 19:03:23 2006 -0700
+++ b/audacious/input.h	Wed Jun 14 20:49:47 2006 -0700
@@ -41,6 +41,7 @@
 InputVisType input_get_vis_type();
 void free_vis_data(void);
 InputPlugin *input_check_file(const gchar * filename, gboolean show_warning);
+TitleInput *input_get_song_tuple(const gchar * filename);
 void input_play(gchar * filename);
 void input_stop(void);
 void input_pause(void);
--- a/audacious/plugin.h	Wed Jun 14 19:03:23 2006 -0700
+++ b/audacious/plugin.h	Wed Jun 14 20:49:47 2006 -0700
@@ -32,7 +32,7 @@
 
 
 #include <glib.h>
-
+#include "libaudacious/titlestring.h"
 
 #define INPUT_PLUGIN(x)   ((InputPlugin *)(x))
 #define OUTPUT_PLUGIN(x)  ((OutputPlugin *)(x))
@@ -152,6 +152,9 @@
     void (*file_info_box) (gchar * filename);
 
     OutputPlugin *output;
+
+    TitleInput *(*get_song_tuple) (gchar * filename);
+    void (*set_song_tuple) (TitleInput * tuple);
 };
 
 struct _GeneralPlugin {