Mercurial > audlegacy-plugins
changeset 2456:e67bce91d70c
revive support for zip and other archive formats. T.M aka teknocat pointed out this problem and provided preliminary patch.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 20 Mar 2008 01:37:46 +0900 |
parents | 50ae65a59351 |
children | bb55de702ffb |
files | src/modplug/archive/open.cxx src/modplug/modplugbmp.cxx src/modplug/plugin.cxx |
diffstat | 3 files changed, 68 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/src/modplug/archive/open.cxx Mon Mar 17 21:38:04 2008 +0100 +++ b/src/modplug/archive/open.cxx Thu Mar 20 01:37:46 2008 +0900 @@ -11,102 +11,114 @@ #include "arch_rar.h" #include "arch_bz2.h" -Archive* OpenArchive(const string& aFileName) +Archive* OpenArchive(const string& aFileName) //aFilename is url --yaz { string lExt; uint32 lPos; - lPos = aFileName.find_last_of('.'); - if(lPos > aFileName.length()) + // convert from uri to fs based filepath + gchar *filename; + filename = g_filename_from_uri(aFileName.c_str(), NULL, NULL); + string lRealFileName(filename); + g_free(filename); + + lPos = lRealFileName.find_last_of('.'); + if(lPos > lRealFileName.length()) return NULL; - lExt = aFileName.substr(lPos); + lExt = lRealFileName.substr(lPos); for(uint32 i = 0; i < lExt.length(); i++) lExt[i] = tolower(lExt[i]); if (lExt == ".mdz") - return new arch_Zip(aFileName); + return new arch_Zip(lRealFileName); if (lExt == ".mdr") - return new arch_Rar(aFileName); + return new arch_Rar(lRealFileName); if (lExt == ".mdgz") - return new arch_Gzip(aFileName); + return new arch_Gzip(lRealFileName); if (lExt == ".mdbz") - return new arch_Bzip2(aFileName); + return new arch_Bzip2(lRealFileName); if (lExt == ".s3z") - return new arch_Zip(aFileName); + return new arch_Zip(lRealFileName); if (lExt == ".s3r") - return new arch_Rar(aFileName); + return new arch_Rar(lRealFileName); if (lExt == ".s3gz") - return new arch_Gzip(aFileName); + return new arch_Gzip(lRealFileName); if (lExt == ".xmz") - return new arch_Zip(aFileName); + return new arch_Zip(lRealFileName); if (lExt == ".xmr") - return new arch_Rar(aFileName); + return new arch_Rar(lRealFileName); if (lExt == ".xmgz") - return new arch_Gzip(aFileName); + return new arch_Gzip(lRealFileName); if (lExt == ".itz") - return new arch_Zip(aFileName); + return new arch_Zip(lRealFileName); if (lExt == ".itr") - return new arch_Rar(aFileName); + return new arch_Rar(lRealFileName); if (lExt == ".itgz") - return new arch_Gzip(aFileName); + return new arch_Gzip(lRealFileName); if (lExt == ".zip") - return new arch_Zip(aFileName); + return new arch_Zip(lRealFileName); if (lExt == ".rar") - return new arch_Rar(aFileName); + return new arch_Rar(lRealFileName); if (lExt == ".gz") - return new arch_Gzip(aFileName); + return new arch_Gzip(lRealFileName); if (lExt == ".bz2") - return new arch_Bzip2(aFileName); + return new arch_Bzip2(lRealFileName); - return new arch_Raw(aFileName); + return new arch_Raw(lRealFileName); } -bool ContainsMod(const string& aFileName) +bool ContainsMod(const string& aFileName) //aFilename is url --yaz { string lExt; uint32 lPos; - lPos = aFileName.find_last_of('.'); - if(lPos > aFileName.length()) + // convert from uri to fs based filepath + gchar *filename; + filename = g_filename_from_uri(aFileName.c_str(), NULL, NULL); + string lRealFileName(filename); + g_free(filename); + + lPos = lRealFileName.find_last_of('.'); + if(lPos > lRealFileName.length()) return false; - lExt = aFileName.substr(lPos); + lExt = lRealFileName.substr(lPos); for(uint32 i = 0; i < lExt.length(); i++) lExt[i] = tolower(lExt[i]); if (lExt == ".mdz") - return arch_Zip::ContainsMod(aFileName); + return arch_Zip::ContainsMod(lRealFileName); if (lExt == ".mdr") - return arch_Rar::ContainsMod(aFileName); + return arch_Rar::ContainsMod(lRealFileName); if (lExt == ".mdgz") - return arch_Gzip::ContainsMod(aFileName); + return arch_Gzip::ContainsMod(lRealFileName); if (lExt == ".mdbz") - return arch_Bzip2::ContainsMod(aFileName); + return arch_Bzip2::ContainsMod(lRealFileName); if (lExt == ".s3z") - return arch_Zip::ContainsMod(aFileName); + return arch_Zip::ContainsMod(lRealFileName); if (lExt == ".s3r") - return arch_Rar::ContainsMod(aFileName); + return arch_Rar::ContainsMod(lRealFileName); if (lExt == ".s3gz") - return arch_Gzip::ContainsMod(aFileName); + return arch_Gzip::ContainsMod(lRealFileName); if (lExt == ".xmz") - return arch_Zip::ContainsMod(aFileName); + return arch_Zip::ContainsMod(lRealFileName); if (lExt == ".xmr") - return arch_Rar::ContainsMod(aFileName); + return arch_Rar::ContainsMod(lRealFileName); if (lExt == ".xmgz") - return arch_Gzip::ContainsMod(aFileName); + return arch_Gzip::ContainsMod(lRealFileName); if (lExt == ".itz") - return arch_Zip::ContainsMod(aFileName); + return arch_Zip::ContainsMod(lRealFileName); if (lExt == ".itr") - return arch_Rar::ContainsMod(aFileName); + return arch_Rar::ContainsMod(lRealFileName); if (lExt == ".itgz") - return arch_Gzip::ContainsMod(aFileName); + return arch_Gzip::ContainsMod(lRealFileName); if (lExt == ".zip") - return arch_Zip::ContainsMod(aFileName); + return arch_Zip::ContainsMod(lRealFileName); if (lExt == ".rar") - return arch_Rar::ContainsMod(aFileName); + return arch_Rar::ContainsMod(lRealFileName); if (lExt == ".gz") - return arch_Gzip::ContainsMod(aFileName); + return arch_Gzip::ContainsMod(lRealFileName); if (lExt == ".bz2") - return arch_Bzip2::ContainsMod(aFileName); + return arch_Bzip2::ContainsMod(lRealFileName); - return arch_Raw::ContainsMod(aFileName); + return arch_Raw::ContainsMod(lRealFileName); }
--- a/src/modplug/modplugbmp.cxx Mon Mar 17 21:38:04 2008 +0100 +++ b/src/modplug/modplugbmp.cxx Thu Mar 20 01:37:46 2008 +0900 @@ -1,3 +1,4 @@ +#define AUD_DEBUG 1 /* Modplug XMMS Plugin * Authors: Kenton Varda <temporal@gauge3d.org> * @@ -238,6 +239,10 @@ return ContainsMod(aFilename); if (lExt == ".bz2") return ContainsMod(aFilename); + if (lExt == ".rar") + return ContainsMod(aFilename); + if (lExt == ".rb") + return ContainsMod(aFilename); return false; }
--- a/src/modplug/plugin.cxx Mon Mar 17 21:38:04 2008 +0100 +++ b/src/modplug/plugin.cxx Thu Mar 20 01:37:46 2008 +0900 @@ -4,6 +4,8 @@ * This source code is public domain. */ +// #define AUD_DEBUG 1 + #include "modplug.h" #include "gui/main.h" extern "C" { @@ -20,6 +22,7 @@ static int CanPlayFileFromVFS(char* aFilename, VFSFile *VFSFile) { + AUDDBG("aFilename=%s\n", aFilename); if(gModplugXMMS.CanPlayFileFromVFS(aFilename, VFSFile)) return 1; return 0; @@ -27,7 +30,7 @@ static void PlayFile(InputPlayback *data) { - char* aFilename = data->filename; + char* aFilename = data->filename; gModplugXMMS.SetOutputPlugin(*data->output); gModplugXMMS.PlayFile(aFilename, data); } @@ -81,7 +84,9 @@ const gchar *fmts[] = { "amf", "ams", "dbm", "dbf", "dsm", "far", "mdl", "stm", "ult", "j2b", "mt2", "mdz", "mdr", "mdgz", "mdbz", "mod", "s3z", "s3r", "s3gz", "s3m", "xmz", "xmr", "xmgz", - "itz", "itr", "itgz", "dmf", "umx", "it", "669", "xm", "mtm", "psm", "ft2", NULL }; + "itz", "itr", "itgz", "dmf", "umx", "it", "669", "xm", "mtm", "psm", "ft2", + "zip", "gz", "bz2", "rar", "rb", + NULL }; InputPlugin gModPlug = {