]> git.sesse.net Git - vlc/commitdiff
* Fix the duration of the dvdread module. refs #198.
authorDerk-Jan Hartman <hartman@videolan.org>
Sat, 11 Feb 2006 01:37:30 +0000 (01:37 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Sat, 11 Feb 2006 01:37:30 +0000 (01:37 +0000)
  Now duration is accurate, but current time is still block based, so on VBR discs the duration of a second may have some weird variations. Getting accurate time is possible (see what was reverted in [12862]), but this will break the relative SET_TIME (might actually go seeking in the wrong direction for instance). The correct fix here is to expand dvdread with a method that checks the TMAPTI IFO table of a Title, to find what block approximately goes with a certain time. (the TMAPTI table is usually in .5 secs interpolation might possibly be required as well) As a backup an estimate can be made using the ADMAP table.

The behaviour of the dvdread module is now equal to that of the dvdnav module when it comes to time and seeking.

modules/access/dvdread.c

index 4347d7bf9fca9a1a6c22b783cbce34c810a16bed..ec24d53a42821e9894bad920de21754dc58ff895 100644 (file)
@@ -387,10 +387,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         }
         case DEMUX_GET_TIME:
             pi64 = (int64_t*)va_arg( args, int64_t * );
-            if( p_sys->i_mux_rate > 0 )
+            if( p_demux->info.i_title >= 0 && p_demux->info.i_title < p_sys->i_titles )
             {
-                *pi64 = (int64_t)1000000 * DVD_VIDEO_LB_LEN *
-                        p_sys->i_title_offset / 50 / p_sys->i_mux_rate;
+                *pi64 = (int64_t) dvdtime_to_time( &p_sys->p_cur_pgc->playback_time, 0 ) / 
+                        p_sys->i_title_blocks * p_sys->i_title_offset;
                 return VLC_SUCCESS;
             }
             *pi64 = 0;
@@ -398,10 +398,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_GET_LENGTH:
             pi64 = (int64_t*)va_arg( args, int64_t * );
-            if( p_sys->i_mux_rate > 0 )
+            if( p_demux->info.i_title >= 0 && p_demux->info.i_title < p_sys->i_titles )
             {
-                *pi64 = (int64_t)1000000 * DVD_VIDEO_LB_LEN *
-                        p_sys->i_title_blocks / 50 / p_sys->i_mux_rate;
+                *pi64 = (int64_t)dvdtime_to_time( &p_sys->p_cur_pgc->playback_time, 0 );
                 return VLC_SUCCESS;
             }
             *pi64 = 0;