[vlc-commits] commit: Export title length in dvdnav access_demux. (Laurent Aimar )

git at videolan.org git at videolan.org
Wed Aug 11 23:12:34 CEST 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Aug 11 23:11:23 2010 +0200| [d1b18e9403b16796513887203d5d107465b1a057] | committer: Laurent Aimar 

Export title length in dvdnav access_demux.

You need a recent enough libdvdnav. It is related to #4021.

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

 configure.ac            |    3 +++
 modules/access/dvdnav.c |   25 +++++++++++++++++++------
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6833bd0..f077c7b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
 
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 9f5cf88..8bf9f14 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -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 );



More information about the vlc-commits mailing list