summaryrefslogtreecommitdiff
path: root/plugins/dca
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-31 21:24:42 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-31 21:24:42 +0200
commit522c98726a3d069b9463a2147628c3461954f02e (patch)
tree63d612ff26d1f0bfd48e4e89f5049cfd2ad1c87b /plugins/dca
parentbbe6cfdd9da8d03946c36e6ca287a6c0af9e0268 (diff)
fixed dts + cue
Diffstat (limited to 'plugins/dca')
-rw-r--r--plugins/dca/dcaplug.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/plugins/dca/dcaplug.c b/plugins/dca/dcaplug.c
index d0d487a8..f9be2c29 100644
--- a/plugins/dca/dcaplug.c
+++ b/plugins/dca/dcaplug.c
@@ -377,16 +377,6 @@ dts_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
}
_info->plugin = &plugin;
-
- if (it->endsample > 0) {
- info->startsample = it->startsample;
- info->endsample = it->endsample;
- plugin.seek_sample (_info, 0);
- }
- else {
- info->startsample = 0;
- info->endsample = totalsamples-1;
- }
info->gain = 1;
info->bufptr = info->buf;
info->bufpos = info->buf + HEADER_SIZE;
@@ -409,6 +399,16 @@ dts_init (DB_fileinfo_t *_info, DB_playItem_t *it) {
_info->channels = channels_multi (info->flags);
_info->samplerate = info->sample_rate;
+ if (it->endsample > 0) {
+ info->startsample = it->startsample;
+ info->endsample = it->endsample;
+ plugin.seek_sample (_info, 0);
+ }
+ else {
+ info->startsample = 0;
+ info->endsample = totalsamples-1;
+ }
+
trace ("dca_init: nchannels: %d, samplerate: %d\n", _info->channels, _info->samplerate);
return 0;
}
@@ -488,6 +488,7 @@ dts_seek_sample (DB_fileinfo_t *_info, int sample) {
ddb_dca_state_t *info = (ddb_dca_state_t *)_info;
// calculate file offset from framesize / framesamples
+ sample += info->startsample;
int nframe = sample / info->frame_length;
int offs = info->frame_byte_size * nframe + info->offset;
deadbeef->fseek (info->file, offs, SEEK_SET);
@@ -495,7 +496,7 @@ dts_seek_sample (DB_fileinfo_t *_info, int sample) {
info->skipsamples = sample - nframe * info->frame_length;
info->currentsample = sample;
- _info->readpos = sample / _info->samplerate;
+ _info->readpos = (float)(sample - info->startsample) / _info->samplerate;
return 0;
}