Mercurial > hg > xmms-sid
diff src/xs_sidplay2.cc @ 467:9dafc55c4270
Beginnings of vfs portability.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 25 Jan 2007 03:46:02 +0000 |
parents | 9e683fb666ba |
children | 3fdc7238f208 |
line wrap: on
line diff
--- a/src/xs_sidplay2.cc Thu Jan 25 03:44:01 2007 +0000 +++ b/src/xs_sidplay2.cc Thu Jan 25 03:46:02 2007 +0000 @@ -27,7 +27,6 @@ #include <stdio.h> #include "xs_sidplay2.h" #include "xs_config.h" -#include "xs_support.h" #include <sidplay/sidplay2.h> @@ -51,27 +50,37 @@ extern "C" { +/* Return song information + */ +#define TFUNCTION xs_sidplay2_getinfo +#define TFUNCTION2 xs_sidplay2_updateinfo +#define TTUNEINFO SidTuneInfo +#define TTUNE SidTune +#define TENGINE t_xs_sidplay2 +#include "xs_sidplay.h" + + /* Check if we can play the given file */ -gboolean xs_sidplay2_isourfile(gchar *pcFilename) +gboolean xs_sidplay2_isourfile(t_xs_file *f) { - SidTune *testTune = new SidTune(pcFilename); - - if (!testTune) return FALSE; - - if (!testTune->getStatus()) { - delete testTune; + gchar tmpBuf[4]; + + if (!f) return FALSE; + + if (xs_fread(tmpBuf, sizeof(gchar), 4, f) != 4) return FALSE; - } - - delete testTune; - return TRUE; + + if (!strncmp(tmpBuf, "PSID", 4) || !strncmp(tmpBuf, "RSID", 4)) + return TRUE; + else + return FALSE; } /* Initialize SIDPlay2 */ -gboolean xs_sidplay2_init(t_xs_ t_xs_status * myStatus) +gboolean xs_sidplay2_init(t_xs_status * myStatus) { gint tmpFreq; t_xs_sidplay2 *myEngine; @@ -348,7 +357,7 @@ myEngine->currTune = NULL; } - xs_sidplay2_deletesid(myStatus); + xs_sidplay2_delete(myStatus); g_free(myEngine); myStatus->sidEngine = NULL; @@ -427,13 +436,5 @@ } -/* Return song information - */ -#define TFUNCTION xs_sidplay2_getinfo -#define TFUNCTION2 xs_sidplay2_updateinfo -#define TTUNEINFO SidTuneInfo -#define TTUNE SidTune -#include "xs_sidplay.h" - } /* extern "C" */ #endif /* HAVE_SIDPLAY2 */