[vlc-devel] [PATCH 04/11] mkv: add cue position regardless of partial support or not

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


Even though there are currently some type of cues that we cannot handle,
we should add the aprox. location denoted by such cues as a seekpoint to
optimize seeking.

Adding the location with Seekpoint::DISABLED means that we will never
seek directly to the position, but it can be used as a hint when looking
for an appropriate keyframe during the preparation for seeking.
---
 modules/demux/mkv/matroska_segment.cpp | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 66198e5..99d6487 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -215,19 +215,18 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
             }
             eparser.Up();
 
-            if( likely( !b_invalid_cue ) && track_id != 0 && cue_mk_time != -1 && cue_position != static_cast<uint64_t>( -1 ) ) {
+            if( track_id != 0 && cue_mk_time != -1 && cue_position != static_cast<uint64_t>( -1 ) ) {
 
                 if( tracks.find( track_id ) != tracks.end() )
                 {
-                    for( tracks_map_t::iterator it = tracks.begin(); it != tracks.end(); ++it )
-                    {
-                        int const tlevel = SegmentSeeker::Seekpoint::QUESTIONABLE; // TODO: var_inheritBool( ..., "mkv-trust-cues" ) => TRUSTED;
-                        int const qlevel = SegmentSeeker::Seekpoint::QUESTIONABLE;
-
-                        int level = ( track_id == it->first ? tlevel : qlevel );
+                    int level = SegmentSeeker::Seekpoint::DISABLED;
 
-                        _seeker.add_seekpoint( it->first, level, cue_position, cue_mk_time );
+                    if( ! b_invalid_cue )
+                    {
+                        level = SegmentSeeker::Seekpoint::QUESTIONABLE; // TODO: var_InheritBool( ..., "mkv-trust-cues" );
                     }
+
+                    _seeker.add_seekpoint( track_id, level, cue_position, cue_mk_time );
                 }
                 else
                     msg_Warn( &sys.demuxer, "Found cue with invalid track id = %u", track_id );
-- 
2.8.2



More information about the vlc-devel mailing list