summaryrefslogtreecommitdiff
path: root/plugins/gme
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-11-09 21:07:20 +0100
committerGravatar waker <wakeroid@gmail.com>2011-11-09 21:07:20 +0100
commit22abcdce0c82110828336972cf2720e3dfcc2ba1 (patch)
treef4f1ba319fc4519e90dd4004b368e1b02fc20c6f /plugins/gme
parent9e4a5021eb7bd880b90fde42b6b19bbeda7ffd01 (diff)
gme: always try to detect gzipped files ignoring file extension
Diffstat (limited to 'plugins/gme')
-rw-r--r--plugins/gme/cgme.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/plugins/gme/cgme.c b/plugins/gme/cgme.c
index e94a4773..0e428e1f 100644
--- a/plugins/gme/cgme.c
+++ b/plugins/gme/cgme.c
@@ -115,18 +115,15 @@ cgme_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
gme_fileinfo_t *info = (gme_fileinfo_t*)_info;
int samplerate = deadbeef->conf_get_int ("synth.samplerate", 44100);
- gme_err_t res;
+ gme_err_t res = "gme uninitialized";
const char *ext = strrchr (deadbeef->pl_find_meta (it, ":URI"), '.');
- if (ext && !strcasecmp (ext, ".vgz")) {
- trace ("opening gzipped vgm...\n");
- char *buffer;
- int sz;
- if (!read_gzfile (deadbeef->pl_find_meta (it, ":URI"), &buffer, &sz)) {
- res = gme_open_data (buffer, sz, &info->emu, samplerate);
- free (buffer);
- }
+ char *buffer;
+ int sz;
+ if (!read_gzfile (deadbeef->pl_find_meta (it, ":URI"), &buffer, &sz)) {
+ res = gme_open_data (buffer, sz, &info->emu, samplerate);
+ free (buffer);
}
- else {
+ if (res) {
DB_FILE *f = deadbeef->fopen (deadbeef->pl_find_meta (it, ":URI"));
int64_t sz = deadbeef->fgetlength (f);
if (sz <= 0) {
@@ -268,19 +265,16 @@ cgme_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) {
Music_Emu *emu;
trace ("gme_open_file %s\n", fname);
- gme_err_t res;
+ gme_err_t res = "gme uninitialized";
const char *ext = strrchr (fname, '.');
- if (ext && !strcasecmp (ext, ".vgz")) {
- trace ("opening gzipped vgm...\n");
- char *buffer;
- int sz;
- if (!read_gzfile (fname, &buffer, &sz)) {
- res = gme_open_data (buffer, sz, &emu, gme_info_only);
- free (buffer);
- }
+ char *buffer;
+ int sz;
+ if (!read_gzfile (fname, &buffer, &sz)) {
+ res = gme_open_data (buffer, sz, &emu, gme_info_only);
+ free (buffer);
}
- else {
+ if (res) {
DB_FILE *f = deadbeef->fopen (fname);
if (!f) {
return NULL;