diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-06-01 01:43:38 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-06-01 01:43:38 +0000 |
commit | bb71a2f5edd080de06db93c0d03f495fb24b1ec4 (patch) | |
tree | 316495ae2a843d07e12eb2ba7d7144c53af56a70 | |
parent | a099d01dd980c772258afe76b8c4443bc9777838 (diff) | |
download | xine-lib-bb71a2f5edd080de06db93c0d03f495fb24b1ec4.tar.gz xine-lib-bb71a2f5edd080de06db93c0d03f495fb24b1ec4.tar.bz2 |
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
-rw-r--r-- | src/libflac/demux_flac.c | 11 |
1 files changed, 11 insertions, 0 deletions
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); |