diff options
author | titer <[email protected]> | 2006-01-15 13:51:39 +0000 |
---|---|---|
committer | titer <[email protected]> | 2006-01-15 13:51:39 +0000 |
commit | 858555894dacb9cece778b4d49f693db0a29d473 (patch) | |
tree | d1144492c5c8249e02fc06b96060b6875b424c81 /libhb/dvd.c | |
parent | f0746b160593e1237101cbef5e959d0dc04aaf70 (diff) |
Fixed dvd_seek for titles which are not linear
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@20 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/dvd.c')
-rw-r--r-- | libhb/dvd.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/libhb/dvd.c b/libhb/dvd.c index 3888f41db..54b5e5e92 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -536,26 +536,34 @@ void hb_dvd_stop( hb_dvd_t * d ) **********************************************************************/ int hb_dvd_seek( hb_dvd_t * d, float f ) { - int target; + int count, sizeCell; + int i; - target = d->title_start + (int) ( f * d->title_block_count ); + count = f * d->title_block_count; - /* Find the cell we shall start in */ - d->cell_cur = d->cell_start; - FindNextCell( d ); - for( ;; ) + for( i = d->cell_start; i <= d->cell_end; i++ ) { - if( target < d->pgc->cell_playback[d->cell_cur].last_sector ) + sizeCell = d->pgc->cell_playback[i].last_sector + 1 - + d->pgc->cell_playback[i].first_sector; + + if( count < sizeCell ) { + d->cell_cur = i; + FindNextCell( d ); + + /* Now let hb_dvd_read find the next VOBU */ + d->next_vobu = d->pgc->cell_playback[i].first_sector + count; + d->pack_len = 0; break; } - d->cell_cur = d->cell_next; - FindNextCell( d ); + + count -= sizeCell; } - /* Now let hb_dvd_read find the next VOBU */ - d->next_vobu = target; - d->pack_len = 0; + if( i > d->cell_end ) + { + return 0; + } return 1; } |