[libbluray-devel] main title selection: improve chapter rule
hpi1
git at videolan.org
Mon Mar 7 08:16:15 CET 2016
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Mar 4 11:52:31 2016 +0200| [a1a23c3d45dbc00648e5968efd44ac4d3dc932c7] | committer: hpi1
main title selection: improve chapter rule
Prefer playlist with many chapters over playlist with no chapters.
(was select playlist with more chapters)
Fixes ex.:
Nick & Norah's Infinite Playlist/
index: 1 duration: 01:29:33 chapters: 189 angles: 1 clips: 1 (playlist: 00004.mpls) V:1 A:5 PG:16 IG:0 SV:0 SA:0
index: 2 duration: 01:29:33 chapters: 16 angles: 1 clips: 1 (playlist: 00040.mpls) V:1 A:5 PG:16 IG:0 SV:0 SA:0
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=a1a23c3d45dbc00648e5968efd44ac4d3dc932c7
---
src/libbluray/bdnav/navigation.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index a5995e5..6840188 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -249,10 +249,12 @@ static int _pl_guess_main_title(MPLS_PL *p1, MPLS_PL *p2)
/* if both longer than 30 min */
if (d1 > 30*60*45000 && d2 > 30*60*45000) {
- /* prefer many chapters over few chapters */
- int chap_diff = _pl_chapter_count(p2) - _pl_chapter_count(p1);
- if (chap_diff < -3 || chap_diff > 3) {
- /* chapter count differs by more than 3 */
+ /* prefer many chapters over no chapters */
+ int chap1 = _pl_chapter_count(p1);
+ int chap2 = _pl_chapter_count(p2);
+ int chap_diff = chap2 - chap1;
+ if ((chap1 < 2 || chap2 < 2) && (chap_diff < -5 || chap_diff > 5)) {
+ /* chapter count differs by more than 5 */
BD_DEBUG(DBG_MAIN_PL, "main title: chapter count difference %d\n", chap_diff);
return chap_diff;
}
More information about the libbluray-devel
mailing list