From: Derk-Jan Hartman Date: Sat, 11 Feb 2006 01:37:30 +0000 (+0000) Subject: * Fix the duration of the dvdread module. refs #198. X-Git-Tag: 0.9.0-test0~12431 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b7d2846e63f846a0f4c0d5a9db7df5af4e01ae48;p=vlc * Fix the duration of the dvdread module. refs #198. 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. --- diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c index 4347d7bf9f..ec24d53a42 100644 --- a/modules/access/dvdread.c +++ b/modules/access/dvdread.c @@ -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;