diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-06-13 21:28:52 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-06-13 21:28:52 +0000 |
commit | f85a943fdff3f12db8faf4b84e4f63aafdc60db3 (patch) | |
tree | e16cc52e6b9a9548714a1ee31a5265ff34127467 /src/libflac/demux_flac.c | |
parent | 62f8ce9ec67fb85da1023b5db90a0a5f1609cff7 (diff) | |
download | xine-lib-f85a943fdff3f12db8faf4b84e4f63aafdc60db3.tar.gz xine-lib-f85a943fdff3f12db8faf4b84e4f63aafdc60db3.tar.bz2 |
implement steps 1, 2, 3 and 4 of the seeking proposal:
http://article.gmane.org/gmane.comp.video.xine.devel/9532
it is now up to demuxers to decide what the 0..65535 position means.
demuxers tested: ogg, voc, flac, rm, asf, vqa, vob, avi, y4m, au, mov, ts, mp3, mpg, wav, ra, mve
CVS patchset: 6686
CVS date: 2004/06/13 21:28:52
Diffstat (limited to 'src/libflac/demux_flac.c')
-rw-r--r-- | src/libflac/demux_flac.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libflac/demux_flac.c b/src/libflac/demux_flac.c index dadc03e2e..94cb96c47 100644 --- a/src/libflac/demux_flac.c +++ b/src/libflac/demux_flac.c @@ -274,7 +274,7 @@ static int demux_flac_send_chunk (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; buf_element_t *buf = NULL; - off_t current_file_pos; + off_t current_file_pos, file_size = 0; int64_t current_pts; unsigned int remaining_sample_bytes = 0; @@ -282,11 +282,13 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { current_file_pos = this->input->get_current_pos (this->input) - this->data_start; + if( (this->data_size - this->data_start) > 0 ) + file_size = (this->data_size - this->data_start); current_pts = current_file_pos; current_pts *= this->length_in_msec * 90; - if( (this->data_size - this->data_start) > 0 ) - current_pts /= (this->data_size - this->data_start); + if( file_size ) + current_pts /= file_size; if (this->seek_flag) { #ifdef USE_ESTIMATED_PTS @@ -307,8 +309,8 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); buf->type = BUF_AUDIO_FLAC; - buf->extra_info->input_pos = current_file_pos; - buf->extra_info->input_length = this->data_size - this->data_start; + if( file_size ) + buf->extra_info->input_normpos = (int) ((double)current_file_pos * 65535 / file_size); buf->extra_info->input_time = current_pts / 90; #ifdef USE_ESTIMATED_PTS buf->pts = current_pts; @@ -406,6 +408,9 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int lprintf("demux_flac_seek\n"); + start_pos = (off_t) ( (double) start_pos / 65535 * + this->input->get_length (this->input) ); + if (!start_pos && start_time) { double distance = (double)start_time; |