diff options
author | Rodeo <[email protected]> | 2013-06-16 01:56:22 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-06-16 01:56:22 +0000 |
commit | 1c2b58073556734601426a05eea98901f9a5ae14 (patch) | |
tree | 16b13fbbeab9c6bc650b4cd8d5ef40d997e2748b /libhb | |
parent | a94a706fe972e05db65bef06dddc5dd169d4552c (diff) |
libhb: fix calculation of chapter durations in dvdread and dvdnav.
The values printed to the scan log were incorrect.
Patch by Stuart Webster. Thanks!
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5588 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/dvd.c | 16 | ||||
-rw-r--r-- | libhb/dvdnav.c | 11 |
2 files changed, 4 insertions, 23 deletions
diff --git a/libhb/dvd.c b/libhb/dvd.c index 56c1ba571..240582a52 100644 --- a/libhb/dvd.c +++ b/libhb/dvd.c @@ -173,8 +173,6 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur ifo_handle_t * vts = NULL; int pgc_id, pgn, i; hb_chapter_t * chapter; - uint64_t duration; - float duration_correction; unsigned char unused[1024]; const char * codec_name; @@ -609,19 +607,9 @@ static hb_title_t * hb_dvdread_title_scan( hb_dvd_t * e, int t, uint64_t min_dur hb_list_add( title->list_chapter, chapter ); } - /* The durations we get for chapters aren't precise. Scale them so - the total matches the title duration */ - duration = 0; - for( i = 0; i < hb_list_count( title->list_chapter ); i++ ) - { - chapter = hb_list_item( title->list_chapter, i ); - duration += chapter->duration; - } - duration_correction = (float) title->duration / (float) duration; for( i = 0; i < hb_list_count( title->list_chapter ); i++ ) { chapter = hb_list_item( title->list_chapter, i ); - chapter->duration = duration_correction * chapter->duration; int seconds = ( chapter->duration + 45000 ) / 90000; chapter->hours = ( seconds / 3600 ); @@ -1270,8 +1258,8 @@ static int dvdtime2msec(dvd_time_t * dt) if( fps > 0 ) { - ms += ((dt->frame_u & 0x30) >> 3) * 5 + - (dt->frame_u & 0x0f) * 1000.0 / fps; + ms += (((dt->frame_u & 0x30) >> 3) * 5 + + (dt->frame_u & 0x0f)) * 1000.0 / fps; } return ms; diff --git a/libhb/dvdnav.c b/libhb/dvdnav.c index 0d741b05e..ef80bf541 100644 --- a/libhb/dvdnav.c +++ b/libhb/dvdnav.c @@ -318,7 +318,6 @@ static hb_title_t * hb_dvdnav_title_scan( hb_dvd_t * e, int t, uint64_t min_dura int count; uint64_t duration, longest; int longest_pgcn, longest_pgn, longest_pgcn_end; - float duration_correction; const char * name; const char * codec_name; @@ -758,7 +757,6 @@ static hb_title_t * hb_dvdnav_title_scan( hb_dvd_t * e, int t, uint64_t min_dura hb_log( "scan: title %d has %d chapters", t, c ); - duration = 0; count = hb_list_count( title->list_chapter ); for (i = 0; i < count; i++) { @@ -797,16 +795,11 @@ static hb_title_t * hb_dvdnav_title_scan( hb_dvd_t * e, int t, uint64_t min_dura #undef cp cell_cur = FindNextCell( pgc, cell_cur ); } - duration += chapter->duration; } - /* The durations we get for chapters aren't precise. Scale them so - the total matches the title duration */ - duration_correction = (float) title->duration / (float) duration; for( i = 0; i < hb_list_count( title->list_chapter ); i++ ) { chapter = hb_list_item( title->list_chapter, i ); - chapter->duration = duration_correction * chapter->duration; int seconds = ( chapter->duration + 45000 ) / 90000; chapter->hours = ( seconds / 3600 ); @@ -1998,8 +1991,8 @@ static int dvdtime2msec(dvd_time_t * dt) if( fps > 0 ) { - ms += ((dt->frame_u & 0x30) >> 3) * 5 + - (dt->frame_u & 0x0f) * 1000.0 / fps; + ms += (((dt->frame_u & 0x30) >> 3) * 5 + + (dt->frame_u & 0x0f)) * 1000.0 / fps; } return ms; |