[libbluray-devel] main title selection: prefer playlists with more chapters

hpi1 git at videolan.org
Thu Mar 3 10:19:51 CET 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Mar  3 10:52:20 2016 +0200| [4c173a189f23a1b9c8203295badae7c90722ec9d] | committer: hpi1

main title selection: prefer playlists with more chapters

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=4c173a189f23a1b9c8203295badae7c90722ec9d
---

 src/libbluray/bdnav/navigation.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index b54cc08..b4e8108 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -205,11 +205,26 @@ _filter_repeats(MPLS_PL *pl, unsigned repeats)
  * find main movie playlist
  */
 
+#define DBG_MAIN_PL DBG_NAV
+
 static int _pl_guess_main_title(MPLS_PL *p1, MPLS_PL *p2)
 {
     uint32_t d1 = _pl_duration(p1);
     uint32_t d2 = _pl_duration(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 */
+            BD_DEBUG(DBG_MAIN_PL, "main title: chapter count difference %d\n", chap_diff);
+            return chap_diff;
+        }
+
+    }
+
     /* compare playlist duration, select longer playlist */
     if (d1 < d2) {
         return 1;



More information about the libbluray-devel mailing list