[vlc-commits] commit: Bluray: correctly select the main title (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Sun Oct 17 17:25:14 CEST 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Oct 17 17:24:26 2010 +0200| [26a669a991b3479dd89f52133ef467ff27c503a2] | committer: Jean-Baptiste Kempf 

Bluray: correctly select the main title

This should fix the usual playback issues we had so far.

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

 modules/access/bluray.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index bbe7c7a..9610cb3 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -88,7 +88,7 @@ static int blurayOpen( vlc_object_t *object )
 
     access_sys_t *p_sys;
     char *pos_title;
-    int i_title = 0;
+    int i_title = -1;
     char bd_path[PATH_MAX];
 
     if( strcmp( p_access->psz_access, "bluray" ) ) {
@@ -157,6 +157,20 @@ static int bluraySetTitle(access_t *p_access, int i_title)
 {
     access_sys_t *p_sys = p_access->p_sys;
 
+    unsigned int i_nb_titles = bd_get_titles(p_sys->bluray, TITLES_RELEVANT);
+
+    /* Looking for the main title, ie the longest duration */
+    if (i_title == -1) {
+        uint64_t duration=0;
+        for (unsigned int i = 0; i < i_nb_titles; i++) {
+            BLURAY_TITLE_INFO *info = bd_get_title_info(p_sys->bluray, i);
+            if (info->duration > duration) {
+                i_title = i;
+                duration = info->duration;
+            }
+        }
+    }
+
     /* Select Blu-Ray title */
     if ( bd_select_title(p_access->p_sys->bluray, i_title) == 0 ) {
         msg_Err( p_access, "cannot select bd title '%d'", p_access->info.i_title);



More information about the vlc-commits mailing list