From: Rocky B. <ro...@us...> - 2003-03-12 01:26:20
|
Update of /cvsroot/xine/xine-vcdnav/input In directory sc8-pr-cvs1:/tmp/cvs-serv10549 Modified Files: vcdplayer.c Log Message: vcdplayer_format_str(): Fix off-by-one bug in handling %S. Add SLEEP_1_SEC_AND_HANDLE_EVENTS to simplify code a little. Index: vcdplayer.c =================================================================== RCS file: /cvsroot/xine/xine-vcdnav/input/vcdplayer.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- vcdplayer.c 11 Mar 2003 20:31:42 -0000 1.62 +++ vcdplayer.c 12 Mar 2003 01:26:18 -0000 1.63 @@ -254,8 +254,11 @@ if ( VCDINFO_ITEM_TYPE_SEGMENT==this->play_item.type ) { char seg_type_str[10]; + /* We have this bad discrepency that vcdinfo segments start at 0, + while we have numbered them starting at 1. Yuck. + */ sprintf(seg_type_str, " %s", - vcdinfo_video_type2str(obj, this->play_item.num)); + vcdinfo_video_type2str(obj, this->play_item.num-1)); strncat(tp, seg_type_str, TEMP_STR_LEN-(tp-temp_str)); tp += strlen(seg_type_str); } @@ -713,6 +716,17 @@ buf[0] = 0; buf[1] = 0; buf[2] = 0x01; \ return READ_BLOCK +#define SLEEP_1_SEC_AND_HANDLE_EVENTS \ + this->force_redisplay(); \ + if (this->handle_events()) goto skip_next_play; \ + this->sleep(250000); \ + if (this->handle_events()) goto skip_next_play; \ + this->sleep(250000); \ + if (this->handle_events()) goto skip_next_play; \ + this->sleep(250000); \ + if (this->handle_events()) goto skip_next_play; \ + this->sleep(250000); + /*! Read nlen bytes into buf and return the status back. @@ -777,14 +791,7 @@ goto skip_next_play; } else { for ( ; wait_time > 0 ; wait_time-- ) { - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); + SLEEP_1_SEC_AND_HANDLE_EVENTS } } break; @@ -805,27 +812,22 @@ if (wait_time == -1) { /* In an infinite loop waiting on an input event */ while ( ! this->handle_events() ) { - this->sleep(250000); + SLEEP_1_SEC_AND_HANDLE_EVENTS ; } goto skip_next_play; } else { dbg_print(INPUT_DBG_PBC, "sleeping: %d\n", wait_time); for ( ; wait_time > 0 ; wait_time-- ) { - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); + SLEEP_1_SEC_AND_HANDLE_EVENTS ; } } /* Handle any looping given. */ if ( max_loop == 0 || this->loop_count < max_loop ) { this->loop_count++; + if (this->loop_count == 0x7f) this->loop_count = 0; vcdplayer_play_single_item(this, this->loop_item); + if (this->in_still) this->force_redisplay(); goto skip_next_play; } @@ -855,17 +857,8 @@ goto skip_next_play; } else if (this->in_still) { /* Hack: Just go back and do still again */ - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; - this->sleep(250000); - if (this->handle_events()) goto skip_next_play; + SLEEP_1_SEC_AND_HANDLE_EVENTS ; RETURN_NULL_BLOCK ; - /*this->force_redisplay();*/ } } |