summaryrefslogtreecommitdiffstats
path: root/libhb/dvdnav.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-06-16 01:56:22 +0000
committerRodeo <[email protected]>2013-06-16 01:56:22 +0000
commit1c2b58073556734601426a05eea98901f9a5ae14 (patch)
tree16b13fbbeab9c6bc650b4cd8d5ef40d997e2748b /libhb/dvdnav.c
parenta94a706fe972e05db65bef06dddc5dd169d4552c (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/dvdnav.c')
-rw-r--r--libhb/dvdnav.c11
1 files changed, 2 insertions, 9 deletions
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;