From: Thibaut M. <tma...@us...> - 2005-07-26 22:10:48
|
Update of /cvsroot/xine/xine-lib/src/demuxers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25601 Modified Files: demux_wc3movie.c Log Message: *BUGFIX* Fixed seeking problem reported by the testsuite (segfault). Problem was easy to reproduce : press play, wait 5s seek back to the beginning seek to the end Index: demux_wc3movie.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/demuxers/demux_wc3movie.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- demux_wc3movie.c 13 Jun 2004 21:28:55 -0000 1.52 +++ demux_wc3movie.c 26 Jul 2005 22:10:40 -0000 1.53 @@ -173,11 +173,13 @@ this->seek_flag = 0; } else { /* record the offset of the SHOT chunk */ - this->shot_offsets[this->current_shot] = - this->input->get_current_pos(this->input) - PREAMBLE_SIZE; + if (this->current_shot < this->number_of_shots) { + this->shot_offsets[this->current_shot] = + this->input->get_current_pos(this->input) - PREAMBLE_SIZE; + } } this->current_shot++; - + /* this is the start of a new shot; send a new palette */ if (this->input->read(this->input, preamble, 4) != 4) { this->status = DEMUX_FINISHED; @@ -376,7 +378,7 @@ if (this->input->read(this->input, preamble, 4) != 4) return 0; this->number_of_shots = LE_32(&preamble[0]); - + /* allocate space for the shot offset index and set offsets to 0 */ this->shot_offsets = xine_xmalloc(this->number_of_shots * sizeof(off_t)); this->current_shot = 0; @@ -579,6 +581,15 @@ /* if the next shot offset has not been recorded, traverse through the * file until it is found */ if (this->shot_offsets[i + 1] == 0) { + off_t current_pos; + + /* be sure to be just after the last known shot_offset */ + current_pos = this->input->get_current_pos(this->input); + if (current_pos < this->shot_offsets[i]) { + this->input->seek(this->input, + this->shot_offsets[i] + PREAMBLE_SIZE + 4, + SEEK_SET); + } while (1) { |