demux:mkv: fix the position displayed for ordered chapters
authorSteve Lhomme <robux4@ycbcr.xyz>
Fri, 23 Feb 2018 08:51:51 +0000 (09:51 +0100)
committerSteve Lhomme <robux4@ycbcr.xyz>
Fri, 23 Feb 2018 09:50:54 +0000 (10:50 +0100)
modules/demux/mkv/mkv.cpp

index 2a9ada5..9549abe 100644 (file)
@@ -335,7 +335,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_GET_POSITION:
             pf = va_arg( args, double * );
             if ( p_sys->f_duration > 0.0 )
-                *pf = static_cast<double> (p_sys->i_pcr >= p_sys->i_start_pts ? p_sys->i_pcr : p_sys->i_start_pts ) / (1000.0 * p_sys->f_duration);
+                *pf = static_cast<double> (p_sys->i_pcr >= (p_sys->i_start_pts + p_sys->i_mk_chapter_time) ?
+                                               p_sys->i_pcr :
+                                               (p_sys->i_start_pts + p_sys->i_mk_chapter_time) ) / (1000.0 * p_sys->f_duration);
             return VLC_SUCCESS;
 
         case DEMUX_SET_POSITION: