[vlc-commits] contribs: bluray: improve menuless playlist selection

Francois Cartegnie git at videolan.org
Tue Feb 5 15:01:51 CET 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Feb  5 14:47:19 2019 +0100| [44b30c268ba19e2eb9c27289eb47ae53e14dde0d] | committer: Francois Cartegnie

contribs: bluray: improve menuless playlist selection

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=44b30c268ba19e2eb9c27289eb47ae53e14dde0d
---

 .../bluray/0001-improve-main-playlist-guess.patch  | 54 ++++++++++++++++++++++
 contrib/src/bluray/rules.mak                       |  1 +
 2 files changed, 55 insertions(+)

diff --git a/contrib/src/bluray/0001-improve-main-playlist-guess.patch b/contrib/src/bluray/0001-improve-main-playlist-guess.patch
new file mode 100644
index 0000000000..d1e6beb6c6
--- /dev/null
+++ b/contrib/src/bluray/0001-improve-main-playlist-guess.patch
@@ -0,0 +1,54 @@
+From c11f3fcb34a8b7af864f4e2addcf28b0e7851605 Mon Sep 17 00:00:00 2001
+From: Francois Cartegnie <fcartegnie at free.fr>
+Date: Tue, 5 Feb 2019 14:40:07 +0100
+Subject: [PATCH] improve main playlist guess
+
+---
+ src/libbluray/bdnav/navigation.c | 24 +++++++++++++++++++++++-
+ 1 file changed, 23 insertions(+), 1 deletion(-)
+
+diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
+index f72d253..e48461a 100644
+--- a/src/libbluray/bdnav/navigation.c
++++ b/src/libbluray/bdnav/navigation.c
+@@ -71,6 +71,25 @@ _pl_chapter_count(MPLS_PL *pl)
+     return chapters;
+ }
+ 
++static uint32_t
++_pl_streams_score(MPLS_PL *pl)
++{
++    MPLS_PI *pi;
++    uint32_t i_num_audio = 0;
++    uint32_t i_num_pg = 0;
++
++    for (int ii = 0; ii < pl->list_count; ii++) {
++        pi = &pl->play_item[ii];
++        if(pi->stn.num_audio > i_num_audio)
++            i_num_audio= pi->stn.num_audio;
++
++        if(pi->stn.num_pg > i_num_pg)
++            i_num_pg = pi->stn.num_pg;
++    }
++
++    return i_num_audio * 2 + i_num_pg;
++}
++
+ /*
+  * Check if two playlists are the same
+  */
+@@ -353,7 +372,10 @@ static int _pl_guess_main_title(MPLS_PL *p1, MPLS_PL *p2,
+         return -1;
+     }
+ 
+-    return 0;
++    /* prefer playlist with higher number of tracks */
++    int sc1 = _pl_streams_score(p1);
++    int sc2 = _pl_streams_score(p2);
++    return sc2 - sc1;
+ }
+ 
+ /*
+-- 
+2.20.1
+
diff --git a/contrib/src/bluray/rules.mak b/contrib/src/bluray/rules.mak
index 4211c38b70..f9ad5591c9 100644
--- a/contrib/src/bluray/rules.mak
+++ b/contrib/src/bluray/rules.mak
@@ -52,6 +52,7 @@ bluray: libbluray-$(BLURAY_VERSION).tar.bz2 .sum-bluray
 	$(APPLY) $(SRC)/bluray/0001-keep-on-with-menuless-user-selected-streams-between-.patch
 	$(APPLY) $(SRC)/bluray/0001-install-bdjo_data-header.patch
 	$(APPLY) $(SRC)/bluray/0001-library-paths-Explicitly-add-usr-local-lib.patch
+	$(APPLY) $(SRC)/bluray/0001-improve-main-playlist-guess.patch
 	$(call pkg_static,"src/libbluray.pc.in")
 	$(MOVE)
 



More information about the vlc-commits mailing list