summaryrefslogtreecommitdiff
path: root/plugins/tta/ttadec.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-06-01 21:16:22 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-06-01 21:16:22 +0200
commit6af58c42136a609eecbc44598f27fb92197e95b2 (patch)
tree3e3c11e54f1f8c7d863add3be3f059db4dfa88a3 /plugins/tta/ttadec.c
parente8ce29669bce6aaba8944aa9cdc39618523cb109 (diff)
sample-accurate seeking
Diffstat (limited to 'plugins/tta/ttadec.c')
-rw-r--r--plugins/tta/ttadec.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/tta/ttadec.c b/plugins/tta/ttadec.c
index 6eb9d6aa..6610acf7 100644
--- a/plugins/tta/ttadec.c
+++ b/plugins/tta/ttadec.c
@@ -380,8 +380,11 @@ static void seek_table_init (unsigned int *seek_table,
}
}
-int set_position (tta_info *info, unsigned int pos) {
- unsigned int seek_pos;
+int set_position (tta_info *info, unsigned int _pos) {
+ // pos: seek position = seek_time_ms / SEEK_STEP
+// int pos = _pos / SEEK_STEP * 1000 / info->SAMPLERATE;
+ int pos = _pos / info->framelen;
+ unsigned int seek_pos;
if (pos >= info->fframes) return 0;
if (!info->st_state) {
@@ -401,7 +404,9 @@ int set_position (tta_info *info, unsigned int pos) {
// init bit reader
init_buffer_read(info);
- return 0;
+ trace ("seek to sample %d, skip %d (%d - %d * %d)\n", _pos, _pos - pos * info->FRAMELEN, _pos, pos, info->FRAMELEN);
+
+ return _pos - pos * info->FRAMELEN;
}
int player_init (tta_info *info) {
@@ -598,7 +603,7 @@ static unsigned int unpack_sint32 (const char *ptr) {
static int skip_id3_tag (tta_info *info) {
int id3v2_size = deadbeef->junk_get_leading_size (info->HANDLE);
- printf ("id3v2_size: %d\n", id3v2_size);
+ trace ("id3v2_size: %d\n", id3v2_size);
if (id3v2_size < 0) {
id3v2_size = 0;
deadbeef->rewind (info->HANDLE);