[vlc-devel] [PATCH 3/9] mkv: call PreparePlayback() when switching segment during seeking

Steve Lhomme robux4 at videolabs.io
Thu Mar 17 16:53:02 CET 2016


it do the proper seek by itself
---
 modules/demux/mkv/virtual_segment.cpp | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 34e82b7..ec11a09 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -521,14 +521,22 @@ void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date,
             demuxer.info.i_seekpoint = p_vchapter->i_seekpoint_num - 1;
         }
 
-        if( &p_current_vchapter->segment != &p_vchapter->segment )
+        if( p_current_vchapter == NULL || &p_current_vchapter->segment != &p_vchapter->segment )
         {
-            KeepTrackSelection( p_current_vchapter->segment, p_vchapter->segment );
-            p_current_vchapter->segment.UnSelect();
-            p_vchapter->segment.Select( i_mk_date );
+            if ( p_current_vchapter )
+            {
+                KeepTrackSelection( p_current_vchapter->segment, p_vchapter->segment );
+                p_current_vchapter->segment.UnSelect();
+            }
+            msg_Dbg( &demuxer, "SWITCH CHAPTER uid=%" PRId64, p_vchapter->p_chapter ? p_vchapter->p_chapter->i_uid : 0 );
+            p_current_vchapter = p_vchapter;
+            p_sys->PreparePlayback( *this, i_mk_date );
+        }
+        else
+        {
+            p_current_vchapter = p_vchapter;
+            p_current_vchapter->segment.Seek( i_mk_date, i_mk_time_offset, i_global_position );
         }
-        p_current_vchapter = p_vchapter;
-        p_vchapter->segment.Seek( i_mk_date, i_mk_time_offset, i_global_position );
     }
 }
 
-- 
2.7.1



More information about the vlc-devel mailing list