diff options
author | John Stebbins <[email protected]> | 2016-05-18 09:15:55 -0600 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-05-18 09:15:55 -0600 |
commit | f07f5b7054ffd89613f250ae36c6fd4d75f15ca5 (patch) | |
tree | d25a9b5c387192358b9970c1491179a1267cf51d /libhb | |
parent | e4a613d9db4c0d9818b8f7ee9971683f6ff5f728 (diff) |
sync: fix progress statistics when title longer than sum of chapters
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/sync.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/libhb/sync.c b/libhb/sync.c index 6d4467de7..288b6434d 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -1604,13 +1604,29 @@ static int syncVideoInit( hb_work_object_t * w, hb_job_t * job) } else { - int64_t duration; + int64_t duration, total_duration, extra_duration = 0; if (job->pts_to_stop) { duration = job->pts_to_stop + 90000; } else { + total_duration = 0; + for (ii = 0; ii <= hb_list_count(job->list_chapter); ii++) + { + hb_chapter_t * chapter; + chapter = hb_list_item(job->list_chapter, ii - 1); + if (chapter != NULL) + { + total_duration += chapter->duration; + } + } + // Some titles are longer than the sum duration of their + // chapters. Account for this extra duration. + if (job->title->duration > total_duration) + { + extra_duration = job->title->duration - total_duration; + } duration = 0; for (ii = job->chapter_start; ii <= job->chapter_end; ii++) { @@ -1621,6 +1637,10 @@ static int syncVideoInit( hb_work_object_t * w, hb_job_t * job) duration += chapter->duration; } } + if (job->chapter_end == hb_list_count(job->list_chapter)) + { + duration += extra_duration; + } } pv->common->est_frame_count = duration * job->title->vrate.num / job->title->vrate.den / 90000; |