summaryrefslogtreecommitdiff
path: root/plugins/gme
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-01 15:39:52 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-05-01 15:39:52 +0200
commit76a27d6a8ffcc8d6ca608e674a78115cdf14b6ec (patch)
tree801dc43105be2d5e36124f02359c48cdc2805abb /plugins/gme
parentddfbdc8c68cb2c8ebc65d4f4576dbc1eb270c209 (diff)
improved decoder API to be able to interrupt .init at any moment
Diffstat (limited to 'plugins/gme')
-rw-r--r--plugins/gme/cgme.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/gme/cgme.c b/plugins/gme/cgme.c
index 77253df0..0b95fc22 100644
--- a/plugins/gme/cgme.c
+++ b/plugins/gme/cgme.c
@@ -33,14 +33,18 @@ typedef struct {
} gme_info_t;
static DB_fileinfo_t *
-cgme_init (DB_playItem_t *it) {
+cgme_open (void) {
DB_fileinfo_t *_info = malloc (sizeof (gme_info_t));
- gme_info_t *info = (gme_info_t*)_info;
memset (_info, 0, sizeof (gme_info_t));
+ return _info;
+}
+
+static int
+cgme_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
+ gme_info_t *info = (gme_info_t*)_info;
int samplerate = deadbeef->conf_get_int ("synth.samplerate", 48000);
if (gme_open_file (it->fname, &info->emu, samplerate)) {
- plugin.free (_info);
- return NULL;
+ return -1;
}
gme_mute_voices (info->emu, info->cgme_voicemask);
gme_start_track (info->emu, it->tracknum);
@@ -56,7 +60,7 @@ cgme_init (DB_playItem_t *it) {
info->duration = deadbeef->pl_get_item_duration (it);
info->reallength = inf.length;
_info->readpos = 0;
- return _info;
+ return 0;
}
static void
@@ -232,6 +236,7 @@ static DB_decoder_t plugin = {
.plugin.start = cgme_start,
.plugin.stop = cgme_stop,
.plugin.configdialog = settings_dlg,
+ .open = cgme_open,
.init = cgme_init,
.free = cgme_free,
.read_int16 = cgme_read,