changeset 1315:e3c991e485ed

madplug: Support probe for tuple instruction.
author William Pitcock <nenolod@atheme-project.org>
date Fri, 20 Jul 2007 20:33:38 -0500
parents c0b5b291bc64
children 25f5cd05a52f
files src/madplug/plugin.c
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug/plugin.c	Fri Jul 20 14:43:09 2007 -0500
+++ b/src/madplug/plugin.c	Fri Jul 20 20:33:38 2007 -0500
@@ -597,7 +597,7 @@
 
 
 // tuple stuff
-static TitleInput *audmad_get_song_tuple(char *filename)
+static TitleInput *__audmad_get_song_tuple(char *filename, VFSFile *fd)
 {
     TitleInput *tuple = NULL;
     gchar *string = NULL;
@@ -657,7 +657,11 @@
 
     tuple = bmp_title_input_new();
 
-    id3file = id3_file_open(filename, ID3_FILE_MODE_READONLY);
+    if (!fd)
+        id3file = id3_file_open(filename, ID3_FILE_MODE_READONLY);
+    else
+        id3file = id3_file_vfsopen(fd, ID3_FILE_MODE_READONLY);
+
     if (id3file) {
 
         tag = id3_file_tag(id3file);
@@ -747,6 +751,18 @@
     return tuple;
 }
 
+static TitleInput *audmad_get_song_tuple(char *filename)
+{
+    return __audmad_get_song_tuple(filename, NULL);
+}
+
+static TitleInput *audmad_probe_for_tuple(char *filename, VFSFile *fd)
+{
+    if (!audmad_is_our_fd(filename, fd))
+        return NULL;
+
+    return __audmad_get_song_tuple(filename, fd);
+}
 
 static gchar *fmts[] = { "mp3", "mp2", "mpg", NULL };
 
@@ -766,7 +782,8 @@
     .get_song_tuple = audmad_get_song_tuple,
     .is_our_file_from_vfs = audmad_is_our_fd,
     .vfs_extensions = fmts,
-    .mseek = audmad_mseek
+    .mseek = audmad_mseek,
+    .probe_for_tuple = audmad_probe_for_tuple
 };
 
 InputPlugin *madplug_iplist[] = { &mad_ip, NULL };