From: Bastien N. <ha...@us...> - 2004-05-31 11:24:32
|
Update of /cvsroot/xine/xine-lib/src/demuxers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11783 Modified Files: demux_wav.c Log Message: - get the file length using seek() instead of the data_TAG, for the benefit of broken wave files seeking is still quite broken, and it doesn't like being played back without an audio output Index: demux_wav.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/demuxers/demux_wav.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- demux_wav.c 10 Apr 2004 04:13:37 -0000 1.55 +++ demux_wav.c 31 May 2004 11:24:01 -0000 1.56 @@ -132,7 +132,11 @@ if (chunk_tag == data_TAG) { this->data_start = this->input->get_current_pos(this->input); - this->data_size = chunk_size; + /* Get the data length from the file itself, instead of the data + * TAG, for broken files */ + this->input->seek(this->input, 0, SEEK_END); + this->data_size = this->input->get_current_pos(this->input); + this->input->seek(this->input, this->data_start, SEEK_SET); } else { this->input->seek(this->input, chunk_size, SEEK_CUR); } @@ -351,6 +355,7 @@ static int demux_wav_get_stream_length (demux_plugin_t *this_gen) { demux_wav_t *this = (demux_wav_t *) this_gen; + printf ("(int)((int64_t) %lld * 1000 / %d) = %d\n", this->data_size ,this->wave->nAvgBytesPerSec, (int)((int64_t) this->data_size * 1000 / this->wave->nAvgBytesPerSec)); return (int)((int64_t) this->data_size * 1000 / this->wave->nAvgBytesPerSec); } |