[vlc-devel] [PATCH] MKV: init the index time to -1 as it was intended

Steve Lhomme robUx4 at videolabs.io
Fri Mar 13 14:12:45 CET 2015


As witnessed here git.videolan.org/?p=vlc.git;a=blob;f=modules/demux/mkv/matroska_segment.cpp;hb=HEAD#l1427
---
 modules/demux/mkv/matroska_segment.cpp | 4 ++--
 modules/demux/mkv/mkv.cpp              | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 18558f7..acfc321 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -129,7 +129,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
             idx.i_track       = -1;
             idx.i_block_number= -1;
             idx.i_position    = -1;
-            idx.i_time        = 0;
+            idx.i_time        = -1;
             idx.b_key         = true;
 
             ep->Down();
@@ -953,7 +953,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_
     {
 
         for( ; i_idx < i_index; i_idx++ )
-            if( p_indexes[i_idx].i_time + i_time_offset > i_date )
+            if( p_indexes[i_idx].i_time != -1 && p_indexes[i_idx].i_time + i_time_offset > i_date )
                 break;
 
         if( i_idx > 0 )
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index cd2d334..a7c267b 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -467,7 +467,7 @@ static void Seek( demux_t *p_demux, mtime_t i_date, double f_percent, virtual_ch
             for( i_index = 0; i_index < p_segment->i_index; i_index++ )
             {
                 if( p_segment->p_indexes[i_index].i_position >= i_pos &&
-                    p_segment->p_indexes[i_index].i_time > 0 )
+                    p_segment->p_indexes[i_index].i_time != -1 )
                     break;
             }
             if( i_index == p_segment->i_index )
-- 
2.3.2




More information about the vlc-devel mailing list