diff options
author | waker <wakeroid@gmail.com> | 2011-04-09 12:09:15 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-04-09 12:09:15 +0200 |
commit | 6cae47358db5a6534be79b22967b4d9714f34ca0 (patch) | |
tree | 8ec20fca0d0799ec5035ab6629ee707a6c6d6b07 /plugins/ao | |
parent | 39b0b844afdbf4f4458f89ecf7efac261eb25bd1 (diff) |
fixed duration + fade in aosdk plugin
Diffstat (limited to 'plugins/ao')
-rw-r--r-- | plugins/ao/Makefile | 1 | ||||
-rw-r--r-- | plugins/ao/plugin.c | 17 |
2 files changed, 15 insertions, 3 deletions
diff --git a/plugins/ao/Makefile b/plugins/ao/Makefile index 9c4285b8..5e0b3f3f 100644 --- a/plugins/ao/Makefile +++ b/plugins/ao/Makefile @@ -4,6 +4,7 @@ CC=gcc ZLIB_LIBS=-lz +CFLAGS?=-O2 -fomit-frame-pointer CFLAGS+=-Wall -fPIC -DPATH_MAX=1024 -DHAS_PSXCPU=1 -I../.. -I./ -Ieng_ssf -Ieng_qsf -Ieng_dsf LDFLAGS+=-module -shared $(ZLIB_LIBS) -lm diff --git a/plugins/ao/plugin.c b/plugins/ao/plugin.c index 6c9233dc..02f70ef2 100644 --- a/plugins/ao/plugin.c +++ b/plugins/ao/plugin.c @@ -154,6 +154,7 @@ aoplug_read (DB_fileinfo_t *_info, char *bytes, int size) { } } info->currentsample += (initsize-size) / (_info->fmt.channels * _info->fmt.bps/8); + _info->readpos = (float)info->currentsample / _info->fmt.samplerate; return initsize-size; } @@ -282,15 +283,21 @@ aoplug_insert (DB_playItem_t *after, const char *fname) { } float duration = 120; + float fade = 0; if (have_info) { int i; for (i = 1; i < 9; i++) { if (!strncasecmp (info.title[i], "Length: ", 8)) { - int min, sec; - if (sscanf (info.info[i], "%d:%d", &min, &sec) == 2) { + printf ("len: %s\n", info.info[i]); + int min; + float sec; + if (sscanf (info.info[i], "%d:%f", &min, &sec) == 2) { duration = min * 60 + sec; } + else if (sscanf (info.info[i], "%f", &sec) == 1) { + duration = sec; + } aoplug_add_meta (it, NULL, info.info[i], info.title[i]); } else if (!strncasecmp (info.title[i], "Name: ", 6) || !strncasecmp (info.title[i], "Song: ", 6)) { @@ -311,12 +318,16 @@ aoplug_insert (DB_playItem_t *after, const char *fname) { else if (!strncasecmp (info.title[i], "Ripper: ", 8)) { aoplug_add_meta (it, "vendor", info.info[i], info.title[i]); } + else if (!strncasecmp (info.title[i], "Fade: ", 6)) { + fade = atof (info.info[i]); + aoplug_add_meta (it, NULL, info.info[i], info.title[i]); + } else { aoplug_add_meta (it, NULL, info.info[i], info.title[i]); } } } - deadbeef->pl_set_item_duration (it, duration); + deadbeef->pl_set_item_duration (it, duration+fade); deadbeef->pl_add_meta (it, "title", NULL); after = deadbeef->pl_insert_item (after, it); deadbeef->pl_item_unref (it); |