]> git.sesse.net Git - vlc/commitdiff
Export title length in dvdnav access_demux.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 11 Aug 2010 21:11:23 +0000 (23:11 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 11 Aug 2010 21:11:23 +0000 (23:11 +0200)
You need a recent enough libdvdnav. It is related to #4021.

configure.ac
modules/access/dvdnav.c

index 6833bd061470b776fa4f33015ef50da4ed5d6e2c..f077c7b4f2a77c0e790b40080ffd59279ac40158 100644 (file)
@@ -1944,6 +1944,9 @@ then
     AC_CHECK_LIB(dvdnav, dvdnav_get_video_resolution,
                AC_DEFINE(HAVE_DVDNAV_GET_VIDEO_RESOLUTION, 1, [Define if you have dvdnav_get_video_resolution.]),
                [], [${LIBS_dvdnav}])
+    AC_CHECK_LIB(dvdnav, dvdnav_describe_title_chapters,
+               AC_DEFINE(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS, 1, [Define if you have dvdnav_describe_title_chapters.]),
+               [], [${LIBS_dvdnav}])
   fi
 fi
 
index 9f5cf88343e97120621a65c77f07df48a78f58cb..8bf9f14390d88d14382917505f7b75610f1ef4ca 100644 (file)
@@ -998,13 +998,26 @@ static void DemuxTitles( demux_t *p_demux )
     dvdnav_get_number_of_titles( p_sys->dvdnav, &i_titles );
     for( i = 1; i <= i_titles; i++ )
     {
-        int32_t i_chapters = 0;
-        int j;
-
-        dvdnav_get_number_of_parts( p_sys->dvdnav, i, &i_chapters );
-
+        int32_t i_chapters;
+        uint64_t i_title_length;
+
+#if defined(HAVE_DVDNAV_DESCRIBE_TITLE_CHAPTERS)
+        uint64_t *p_chapters_time;
+        i_chapters = dvdnav_describe_title_chapters( p_sys->dvdnav, i,
+                                                     &p_chapters_time,
+                                                     &i_title_length );
+        if( i_chapters > 0 )
+            free( p_chapters_time );
+        else
+            i_title_length = 0;
+#else
+        if( dvdnav_get_number_of_parts( p_sys->dvdnav, i, &i_chapters ) != DVDNAV_STATUS_OK )
+            i_chapters = 0;
+        i_title_length = 0;
+#endif
         t = vlc_input_title_New();
-        for( j = 0; j < __MAX( i_chapters, 1 ); j++ )
+        t->i_length = i_title_length * 1000 / 90;
+        for( int j = 0; j < __MAX( i_chapters, 1 ); j++ )
         {
             s = vlc_seekpoint_New();
             TAB_APPEND( t->i_seekpoint, t->seekpoint, s );