Commit b7d2846e authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* 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.
parent e01e9935
...@@ -387,10 +387,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -387,10 +387,10 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
} }
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * ); 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 * *pi64 = (int64_t) dvdtime_to_time( &p_sys->p_cur_pgc->playback_time, 0 ) /
p_sys->i_title_offset / 50 / p_sys->i_mux_rate; p_sys->i_title_blocks * p_sys->i_title_offset;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
*pi64 = 0; *pi64 = 0;
...@@ -398,10 +398,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -398,10 +398,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_LENGTH: case DEMUX_GET_LENGTH:
pi64 = (int64_t*)va_arg( args, int64_t * ); 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 * *pi64 = (int64_t)dvdtime_to_time( &p_sys->p_cur_pgc->playback_time, 0 );
p_sys->i_title_blocks / 50 / p_sys->i_mux_rate;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
*pi64 = 0; *pi64 = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment