[vlc-devel] [PATCH 07/11] mkv: removed old seeking

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


Remove legacy logic in regards of seeking.
---
 modules/demux/mkv/matroska_segment.cpp        |  54 +----------
 modules/demux/mkv/matroska_segment_seeker.cpp | 124 --------------------------
 modules/demux/mkv/matroska_segment_seeker.hpp |   6 --
 3 files changed, 3 insertions(+), 181 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 99d6487..573d11e 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -803,58 +803,10 @@ void matroska_segment_c::FastSeek( mtime_t i_mk_date, mtime_t i_mk_time_offset )
 
 void matroska_segment_c::Seek( mtime_t i_absolute_mk_date, mtime_t i_mk_time_offset )
 {
-    uint64_t i_seek_position = -1;
-    mtime_t  i_mk_seek_time  = -1;
-
-    mtime_t i_mk_date = i_absolute_mk_date - i_mk_time_offset;
-
-    SegmentSeeker::tracks_seekpoint_t seekpoints;
-
-    try {
-        seekpoints = _seeker.get_seekpoints_cues( *this, i_mk_date );
-
-    }
-    catch( std::exception const& e )
-    {
-        msg_Err( &sys.demuxer, "error during seek: \"%s\", aborting!", e.what() );
-        return;
-    }
-
-    for( SegmentSeeker::tracks_seekpoint_t::iterator it = seekpoints.begin(); it != seekpoints.end(); ++it )
-    {
-        mkv_track_t& track = tracks[ it->first ];
-
-        if( i_seek_position > it->second.fpos )
-        {
-            i_seek_position = it->second.fpos;
-            i_mk_seek_time  = it->second.pts;
-        }
-
-        track.i_skip_until_fpos = it->second.fpos;
-        track.i_last_dts        = it->second.pts;
-
-
-        bool is_active = false;
-
-        if( track.p_es && es_out_Control( sys.demuxer.out, ES_OUT_GET_ES_STATE, track.p_es, &is_active ) )
-        {
-            msg_Err( &sys.demuxer, "Unable to query track %u for ES_OUT_GET_ES_STATE", it->first );
-        }
-        else if( !is_active )
-        {
-            track.i_last_dts = VLC_TS_INVALID;
-        }
-    }
-
-    _seeker.mkv_jump_to( *this, i_seek_position );
-
-    sys.i_pcr       = VLC_TS_INVALID;
-    sys.i_pts       = VLC_TS_0 + i_mk_seek_time + i_mk_time_offset;
-    sys.i_start_pts = VLC_TS_0 + i_absolute_mk_date;
-
-    es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, sys.i_start_pts );
+    VLC_UNUSED( i_absolute_mk_date );
+    VLC_UNUSED( i_mk_time_offset );
 
-    msg_Dbg( &sys.demuxer, "seek got i_mk_date = % " PRId64 ", i_mk_seek_time = %" PRId64 ", i_seek_position = %" PRId64 ", i_absolute_mk_date = %" PRId64 ", i_mk_time_offset = %" PRId64, i_mk_date, i_mk_seek_time, i_seek_position, i_absolute_mk_date,  i_mk_time_offset );
+    // TODO: reimplement
 }
 
 
diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp b/modules/demux/mkv/matroska_segment_seeker.cpp
index a9ad735..056d3b2 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -127,130 +127,6 @@ SegmentSeeker::add_seekpoint( track_id_t track_id, int trust_level, fptr_t fpos,
     }
 }
 
-SegmentSeeker::seekpoint_pair_t
-SegmentSeeker::get_seekpoints_around( mtime_t pts, seekpoints_t const& seekpoints, int trust_level )
-{
-    if( seekpoints.empty() )
-    {
-        return seekpoint_pair_t();
-    }
-
-    typedef seekpoints_t::const_iterator iterator;
-
-    Seekpoint const needle ( Seekpoint::DISABLED, -1, pts );
-
-    iterator const it_begin  = seekpoints.begin();
-    iterator const it_end    = seekpoints.end();
-    iterator const it_middle = greatest_lower_bound( it_begin, it_end, needle );
-
-    iterator it_before;
-    iterator it_after;
-
-    // rewrind to _previous_ seekpoint with appropriate trust
-    for( it_before = it_middle; it_before != it_begin; --it_before )
-    {
-        if( it_before->trust_level >= trust_level )
-            break;
-    }
-
-    // forward to following seekpoint with appropriate trust
-    for( it_after = next_( it_middle ); it_after != it_end; ++it_after )
-    {
-        if( it_after->trust_level >= trust_level )
-            break;
-    }
-
-    return seekpoint_pair_t( *it_before,
-      it_after == it_end ? Seekpoint() : *it_after
-    );
-}
-
-SegmentSeeker::seekpoint_pair_t
-SegmentSeeker::get_seekpoints_around( mtime_t pts, int trust_level )
-{
-    if( _tracks_seekpoints.empty() )
-    {
-        return seekpoint_pair_t( );
-    }
-
-    seekpoint_pair_t points;
-    {
-        typedef tracks_seekpoints_t::const_iterator iterator;
-
-        iterator const begin = _tracks_seekpoints.begin();
-        iterator const end   = _tracks_seekpoints.end();
-
-        for( iterator it = begin; it != end; ++it )
-        {
-            seekpoint_pair_t track_points = get_seekpoints_around(
-              pts, it->second, trust_level
-            );
-
-            if( it == begin )
-            {
-                points = track_points;
-                continue;
-            }
-
-            if( points.first.fpos > track_points.first.fpos )
-                points.first = track_points.first;
-
-            if( points.second.fpos > track_points.second.fpos )
-                points.second = track_points.second;
-        }
-    }
-
-    return points;
-}
-
-// -----------------------------------------------------------------------------
-
-SegmentSeeker::tracks_seekpoint_t
-SegmentSeeker::find_greatest_seekpoints_in_range( mtime_t start_pts, mtime_t end_pts )
-{
-    tracks_seekpoint_t tpoints; 
-
-    for( tracks_seekpoints_t::const_iterator it = _tracks_seekpoints.begin(); it != _tracks_seekpoints.end(); ++it )
-    {
-        Seekpoint sp = get_seekpoints_around( end_pts, it->second, Seekpoint::TRUSTED ).first;
-
-        if( sp.pts < start_pts )
-            continue;
-
-        tpoints.insert( tracks_seekpoint_t::value_type( it->first, sp ) );
-    }
-    
-    return tpoints;
-}
-
-SegmentSeeker::tracks_seekpoint_t
-SegmentSeeker::get_seekpoints_cues( matroska_segment_c& ms, mtime_t target_pts )
-{
-    seekpoint_pair_t sp_range = get_seekpoints_around( target_pts );
-
-    Seekpoint& sp_start = sp_range.first;
-    Seekpoint& sp_end   = sp_range.second;
-
-    // TODO: jump to most likely range for the PTS, using _clusters 
-
-    index_range( ms, Range( sp_start.fpos, sp_end.fpos ), target_pts );
-    {
-        tracks_seekpoint_t tpoints;
-
-        for( ; tpoints.size() != _tracks_seekpoints.size(); sp_start.pts -= 1 )
-        {
-            tpoints = find_greatest_seekpoints_in_range( sp_start.pts, target_pts );
-
-            sp_end   = sp_start;
-            sp_start = get_seekpoints_around( sp_start.pts ).first;
-
-            index_range( ms, Range( sp_start.fpos, sp_end.fpos ), sp_end.pts );
-        }
-
-        return tpoints;
-    }
-}
-
 void
 SegmentSeeker::index_range( matroska_segment_c& ms, Range search_area, mtime_t max_pts )
 {
diff --git a/modules/demux/mkv/matroska_segment_seeker.hpp b/modules/demux/mkv/matroska_segment_seeker.hpp
index ee78356..6393545 100644
--- a/modules/demux/mkv/matroska_segment_seeker.hpp
+++ b/modules/demux/mkv/matroska_segment_seeker.hpp
@@ -99,12 +99,6 @@ class SegmentSeeker
 
         void add_seekpoint( track_id_t track_id, int level, fptr_t fpos, mtime_t pts );
 
-        seekpoint_pair_t get_seekpoints_around( mtime_t, int = Seekpoint::DISABLED );
-        seekpoint_pair_t get_seekpoints_around( mtime_t, seekpoints_t const&, int = Seekpoint::DISABLED );
-
-        tracks_seekpoint_t get_seekpoints_cues( matroska_segment_c&, mtime_t );
-        tracks_seekpoint_t find_greatest_seekpoints_in_range( mtime_t , mtime_t );
-
         cluster_positions_t::iterator add_cluster_position( fptr_t pos );
         cluster_map_t      ::iterator add_cluster( KaxCluster * const );
 
-- 
2.8.2



More information about the vlc-devel mailing list