changeset 463:1e5cb7a00cb0 trunk

[svn] - added is_our_file_from_vfs function to sid, for both libsidplay v1 and v2
author giacomo
date Fri, 19 Jan 2007 10:55:44 -0800
parents c488d191b528
children 65408c59b424
files ChangeLog src/sid/xmms-sid.c src/sid/xmms-sid.h src/sid/xs_init.c src/sid/xs_sidplay1.cc src/sid/xs_sidplay1.h src/sid/xs_sidplay2.cc src/sid/xs_sidplay2.h
diffstat 8 files changed, 55 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jan 19 09:56:06 2007 -0800
+++ b/ChangeLog	Fri Jan 19 10:55:44 2007 -0800
@@ -1,3 +1,14 @@
+2007-01-19 17:56:06 +0000  Giacomo Lozito <james@develia.org>
+  revision [1008]
+  - modified the sid plugin to use vfs, for both libsidplay v1 and v2; still requires testing and some work in the is_our_file part
+  trunk/src/sid/xmms-sid.c     |    1 
+  trunk/src/sid/xmms-sid.h     |    1 
+  trunk/src/sid/xs_sidplay.h   |   13 +++++-
+  trunk/src/sid/xs_sidplay1.cc |   88 ++++++++++++++++++++++++++++++++++++++-----
+  trunk/src/sid/xs_sidplay2.cc |   85 +++++++++++++++++++++++++++++++++++++----
+  5 files changed, 170 insertions(+), 18 deletions(-)
+
+
 2007-01-19 12:46:00 +0000  Giacomo Lozito <james@develia.org>
   revision [1006]
   - updated amidi-plug to the new plugin API
--- a/src/sid/xmms-sid.c	Fri Jan 19 09:56:06 2007 -0800
+++ b/src/sid/xmms-sid.c	Fri Jan 19 10:55:44 2007 -0800
@@ -33,6 +33,7 @@
 #include <audacious/plugin.h>
 #include <audacious/output.h>
 #include <audacious/util.h>
+#include <audacious/vfs.h>
 
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
@@ -62,7 +63,7 @@
 t_xs_player xs_playerlist[] = {
 #ifdef HAVE_SIDPLAY1
 	{XS_ENG_SIDPLAY1,
-	 xs_sidplay1_isourfile,
+	 xs_sidplay1_isourfile, xs_sidplay1_isourfile_vfs,
 	 xs_sidplay1_init, xs_sidplay1_close,
 	 xs_sidplay1_initsong, xs_sidplay1_fillbuffer,
 	 xs_sidplay1_loadsid, xs_sidplay1_deletesid,
@@ -71,7 +72,7 @@
 #endif
 #ifdef HAVE_SIDPLAY2
 	{XS_ENG_SIDPLAY2,
-	 xs_sidplay2_isourfile,
+	 xs_sidplay2_isourfile, xs_sidplay2_isourfile_vfs,
 	 xs_sidplay2_init, xs_sidplay2_close,
 	 xs_sidplay2_initsong, xs_sidplay2_fillbuffer,
 	 xs_sidplay2_loadsid, xs_sidplay2_deletesid,
@@ -273,6 +274,24 @@
 
 
 /*
+ * Check whether the given file is handled by this plugin (VFS)
+ */
+gint xs_is_our_file_vfs(gchar * pcFilename, VFSFile * fp)
+{
+	assert(xs_status.sidPlayer);
+
+	/* Check the filename */
+	if (pcFilename == NULL)
+		return FALSE;
+
+	if (xs_status.sidPlayer->plrIsOurFileVfs(pcFilename,fp))
+		return TRUE;
+
+	return FALSE;
+}
+
+
+/*
  * Main playing thread loop
  */
 void *xs_playthread(void *argPointer)
--- a/src/sid/xmms-sid.h	Fri Jan 19 09:56:06 2007 -0800
+++ b/src/sid/xmms-sid.h	Fri Jan 19 10:55:44 2007 -0800
@@ -34,6 +34,7 @@
 #endif
 
 #include <glib.h>
+#include <audacious/vfs.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -132,6 +133,7 @@
 typedef struct {
 	gint		plrIdent;
 	gboolean	(*plrIsOurFile)(gchar *);
+	gboolean	(*plrIsOurFileVfs)(gchar *,VFSFile *);
 	gboolean	(*plrInit)(struct t_xs_status *);
 	void		(*plrClose)(struct t_xs_status *);
 	gboolean	(*plrInitSong)(struct t_xs_status *);
@@ -173,6 +175,7 @@
 void	xs_reinit(void);
 void	xs_close(void);
 gint	xs_is_our_file(gchar *);
+gint	xs_is_our_file_vfs(gchar *,VFSFile *);
 void	xs_play_file(gchar *);
 void	xs_stop(void);
 void	xs_pause(short);
--- a/src/sid/xs_init.c	Fri Jan 19 09:56:06 2007 -0800
+++ b/src/sid/xs_init.c	Fri Jan 19 10:55:44 2007 -0800
@@ -54,8 +54,8 @@
 	NULL,			/* Tuple */
 	NULL,			/* Tuple */
 	NULL,			/* Buffer */
-	NULL,			/* VFS */
-	sid_fmts,		/* ext assist */
+	xs_is_our_file_vfs,	/* VFS */
+	sid_fmts		/* ext assist */
 };
 
 
--- a/src/sid/xs_sidplay1.cc	Fri Jan 19 09:56:06 2007 -0800
+++ b/src/sid/xs_sidplay1.cc	Fri Jan 19 10:55:44 2007 -0800
@@ -64,7 +64,6 @@
 		return TRUE;
 	else
 		return FALSE;
-  return FALSE;
 }
 
 
@@ -124,6 +123,14 @@
 }
 
 
+/* Check if we can play the given file (VFS)
+ */
+gboolean xs_sidplay1_isourfile_vfs(gchar * pcFilename, VFSFile * fp)
+{
+	return xs_sidplay1_detect_by_content( fp );
+}
+
+
 /* Initialize SIDPlay1
  */
 gboolean xs_sidplay1_init(t_xs_status * myStatus)
--- a/src/sid/xs_sidplay1.h	Fri Jan 19 09:56:06 2007 -0800
+++ b/src/sid/xs_sidplay1.h	Fri Jan 19 10:55:44 2007 -0800
@@ -11,6 +11,7 @@
 #endif
 
 gboolean	xs_sidplay1_isourfile(gchar *);
+gboolean	xs_sidplay1_isourfile_vfs(gchar *,VFSFile *);
 void		xs_sidplay1_close(t_xs_status *);
 gboolean	xs_sidplay1_init(t_xs_status *);
 gboolean	xs_sidplay1_initsong(t_xs_status *);
--- a/src/sid/xs_sidplay2.cc	Fri Jan 19 09:56:06 2007 -0800
+++ b/src/sid/xs_sidplay2.cc	Fri Jan 19 10:55:44 2007 -0800
@@ -65,11 +65,10 @@
 	if ( vfs_fread( magic_bytes , 1 , 4 , fp ) != 4 )
 		return FALSE;
 
-	if ( !strncmp( magic_bytes , "PSID" , 4 ) )
+	if ( !strncmp( magic_bytes , "PSID" , 4 ) || !strncmp( magic_bytes , "RSID" , 4 ) )
 		return TRUE;
 	else
 		return FALSE;
-  return FALSE;
 }
 
 
@@ -129,6 +128,13 @@
 }
 
 
+/* Check if we can play the given file (VFS)
+ */
+gboolean xs_sidplay2_isourfile_vfs(gchar * pcFilename, VFSFile * fp)
+{
+	return xs_sidplay2_detect_by_content( fp );
+}
+
 
 /* Initialize SIDPlay2
  */
--- a/src/sid/xs_sidplay2.h	Fri Jan 19 09:56:06 2007 -0800
+++ b/src/sid/xs_sidplay2.h	Fri Jan 19 10:55:44 2007 -0800
@@ -8,6 +8,7 @@
 #endif
 
 gboolean	xs_sidplay2_isourfile(gchar *);
+gboolean	xs_sidplay2_isourfile_vfs(gchar *,VFSFile *);
 void		xs_sidplay2_close(t_xs_status *);
 gboolean	xs_sidplay2_init(t_xs_status *);
 gboolean	xs_sidplay2_initsong(t_xs_status *);