[vlc-devel] [PATCH 11/11] mkv: added support for --mkv-pedantic-seek

Filip Roséen filip at videolabs.io
Sat May 21 02:18:03 CEST 2016


This flag is used to force the demuxer to find appropriate seekpoints
for all the tracks inside the file, not just the ones that are
prioritized.

--

This will of course affect performance when seeking, but will provide
better experience since all tracks will be prerolled correctly.
---
 modules/demux/mkv/matroska_segment.cpp | 16 +++++++++++++++-
 modules/demux/mkv/mkv.cpp              |  4 ++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index e3773b0..f90843d 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -822,7 +822,21 @@ void matroska_segment_c::Seek( mtime_t i_absolute_mk_date, mtime_t i_mk_time_off
     // find appropriate seekpoints //
 
     try {
-        seekpoints = _seeker.get_seekpoints( *this, i_mk_date, priority_tracks );
+        SegmentSeeker::track_ids_t track_ids;
+
+        if( var_InheritBool( &sys.demuxer, "mkv-pedantic-seek" ) )
+        {
+            // mark all tracks are important //
+
+            for( tracks_map_t::iterator it = tracks.begin(); it != tracks.end(); ++it )
+                track_ids.push_back( it->first );
+        }
+        else
+        {
+            track_ids = priority_tracks;
+        }
+
+        seekpoints = _seeker.get_seekpoints( *this, i_mk_date, track_ids );
     }
     catch( std::exception const& e )
     {
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 65c5fd5..4d0d88b 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -72,6 +72,10 @@ vlc_module_begin ()
             N_("Seek based on percent not time"),
             N_("Seek based on percent not time."), true );
 
+    add_bool( "mkv-pedantic-seek", false,
+            N_("Enable pedantic seek"),
+            N_("All tracks are important during seek (find I-frames for all, not just prioritized ones)"), true );
+
     add_bool( "mkv-use-dummy", false,
             N_("Dummy Elements"),
             N_("Read and discard unknown EBML elements (not good for broken files)."), true );
-- 
2.8.2



More information about the vlc-devel mailing list