--- vobcopy.c 2009-02-25 19:23:23.977654017 +0100 +++ vobcopy.c 2009-01-03 15:15:49.850033852 +0100 @@ -1255,7 +1255,8 @@ file_block_count = block_count; for( i = start; ( i - start ) * DVD_VIDEO_LB_LEN < file_size; i += file_block_count) { - int tries = 0, skipped_blocks = 0; + int tries = 0, skipped_blocks = 0; + static int skip_factor = 1; /* Only read and write as many blocks as there are left in the file */ if ( ( i - start + file_block_count ) * DVD_VIDEO_LB_LEN > file_size ) { @@ -1264,21 +1265,22 @@ /* DVDReadBlocks( dvd_file, i, 1, bufferin );this has to be wrong with the 1 there...*/ - while( ( blocks = DVDReadBlocks( dvd_file, i, file_block_count, bufferin ) ) <= 0 && tries < 10 ) + while( ( blocks = DVDReadBlocks( dvd_file, i, file_block_count, bufferin ) ) <= 0) { - if( tries == 9 ) - { - i += file_block_count; - skipped_blocks +=1; - tries=0; - } - if( verbosity_level >= 1 ) - fprintf( stderr, "[Warn] Had to skip %d blocks! ", skipped_blocks ); -/* fprintf( stderr, "[Debug] tries=%d\n", tries ); */ - tries++; + i += file_block_count * skip_factor; + skipped_blocks += skip_factor; + if( verbosity_level >= 1 ) + { + fprintf( stderr, "[Warn] Had to skip %d blocks! Now reading at offset %d\n", skipped_blocks, i ); + skip_factor = skip_factor * 2; + fprintf( stderr, "\n[Warn] Increasing skip factor to %d\n", skip_factor ); + } + } + if (skip_factor > 2) + { + fprintf( stderr, "\n[Warn] Resetting skip factor from %d to %d\n", skip_factor, skip_factor/2 ); + skip_factor /= 2; } - - if( write( streamout, bufferin, DVD_VIDEO_LB_LEN * blocks ) < 0 ) { fprintf( stderr, "\n[Error] Error writing to %s \n", output_file ); @@ -1298,7 +1300,7 @@ fprintf( stderr, "%4.0fMB of %4.0fMB written ", ( ( tmp_i+1 )*DVD_VIDEO_LB_LEN )/( 1024*1024 ), ( tmp_file_size+2048 )/( 1024*1024 ) ); - fprintf( stderr,"( %3.1f %% ) \r", percent ); + fprintf( stderr,"( %3.1f %% ) Offset is %d\r", percent, i ); l = 0; } @@ -1308,7 +1310,7 @@ fprintf( stderr, "%4.0fMB of %4.0fMB written ", ( ( tmp_i+1 )*DVD_VIDEO_LB_LEN )/( 1024*1024 ), ( tmp_file_size+2048 )/( 1024*1024 ) ); - fprintf( stderr,"( 100.0%% ) \r" ); + fprintf( stderr,"( 100.0%% ) Offset is %d\r", i ); start=i; fprintf( stderr, "\n" );