From bb71a2f5edd080de06db93c0d03f495fb24b1ec4 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 1 Jun 2004 01:43:38 +0000 Subject: estimate start_pos from start_time. it is not as accurate as original idea but at least it work. note: there is still something wrong with flac decoder. it may freeze under certain conditions. CVS patchset: 6619 CVS date: 2004/06/01 01:43:38 --- src/libflac/demux_flac.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/libflac/demux_flac.c b/src/libflac/demux_flac.c index 7d5c7619a..7de820321 100644 --- a/src/libflac/demux_flac.c +++ b/src/libflac/demux_flac.c @@ -405,8 +405,19 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int lprintf("demux_flac_seek\n"); + if (!start_pos && start_time) { + double distance = (double)start_time; + + if (this->length_in_msec != 0) + { + distance /= (double)this->length_in_msec; + } + start_pos = (uint64_t)(distance * (this->data_size - this->data_start)); + } + if (start_pos || !start_time) { + start_pos += this->data_start; this->input->seek (this->input, start_pos, SEEK_SET); lprintf ("Seek to position: %lld\n", start_pos); -- cgit v1.2.3