Code: Select all
scan: title 1 has 29 chapters
scan: chap 1 c=0->0, b=0->56984 (56985), 139247 ms
scan: chap 2 c=1->1, b=56985->125385 (68401), 169598 ms
scan: chap 3 c=2->2, b=125386->168825 (43440), 107244 ms
scan: chap 4 c=3->3, b=168826->282218 (113393), 282580 ms
scan: chap 5 c=4->4, b=282219->327410 (45192), 112441 ms
scan: chap 6 c=5->5, b=327411->501946 (174536), 433593 ms
scan: chap 7 c=6->6, b=501947->598822 (96876), 238601 ms
scan: chap 8 c=7->7, b=598823->667773 (68951), 171430 ms
scan: chap 9 c=8->8, b=667774->746028 (78255), 193630 ms
scan: chap 10 c=9->9, b=746029->822960 (76932), 191297 ms
scan: chap 11 c=10->10, b=822961->907836 (84876), 211324 ms
scan: chap 12 c=11->11, b=907837->979007 (71171), 176447 ms
scan: chap 13 c=12->12, b=979008->1042601 (63594), 157532 ms
scan: chap 14 c=13->13, b=1042602->1146960 (104359), 259599 ms
scan: chap 15 c=14->14, b=1146961->1274918 (127958), 318589 ms
scan: chap 16 c=15->15, b=1274919->1432693 (157775), 389664 ms
scan: chap 17 c=16->16, b=1432694->1610400 (177707), 440773 ms
scan: chap 18 c=17->17, b=1610401->1785579 (175179), 435876 ms
scan: chap 19 c=18->19, b=1785580->1837272 (51693), 129634 ms
scan: chap 20 c=20->20, b=1837273->2054843 (217571), 561005 ms
scan: chap 21 c=21->21, b=2054844->2112722 (57879), 154377 ms
scan: chap 22 c=22->22, b=2112723->2326333 (213611), 550981 ms
scan: chap 23 c=23->23, b=2326334->2422556 (96223), 245540 ms
scan: chap 24 c=24->24, b=2422557->2540602 (118046), 305431 ms
scan: chap 25 c=25->25, b=2540603->2567548 (26946), 69303 ms
scan: chap 26 c=26->26, b=2567549->2609527 (41979), 108145 ms
scan: chap 27 c=27->27, b=2609528->2639968 (30441), 77464 ms
scan: chap 28 c=28->28, b=2639969->2747133 (107165), 318639 ms
scan: chap 29 c=29->29, b=0->56984 (56985), 1001 ms
For me the following patch works, but I think someone who actually understands how this stuff works should look at it. Also I'm not sure how memory management in HB works, so the simple removal of the chapter may leak memory.
Code: Select all
Index: libhb/dvd.c
===================================================================
--- libhb/dvd.c (revision 2320)
+++ libhb/dvd.c (working copy)
@@ -578,6 +578,18 @@
c++;
}
+ /* Sometimes the last chapter is really a fake reference to the first chapter.
+ We check for that and delete such a chapter. */
+ if (hb_list_count( title->list_chapter ) > 1)
+ {
+ hb_chapter_t * first_chapter = hb_list_item( title->list_chapter, 0 );
+ hb_chapter_t * last_chapter = hb_list_item( title->list_chapter, hb_list_count( title->list_chapter ) - 1 );
+ if (first_chapter->block_start == last_chapter->block_start) {
+ /* The last chapter would repeat the first chapter. That would be wrong. */
+ hb_list_rem( title->list_chapter, last_chapter );
+ }
+ }
+
/* The durations we get for chapters aren't precise. Scale them so
the total matches the title duration */
duration = 0;