[vlc-commits] demux:mkv: pass a Seekpoint to add_seekpoint

Steve Lhomme git at videolan.org
Fri Aug 4 10:07:51 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Thu Aug  3 18:18:33 2017 +0200| [07e8e5e2ce206af4739804313ab4a9db4af0adef] | committer: Jean-Baptiste Kempf

demux:mkv: pass a Seekpoint to add_seekpoint

No need to pass all parameters, especially if the Seekpoint prototype grows.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=07e8e5e2ce206af4739804313ab4a9db4af0adef
---

 modules/demux/mkv/matroska_segment.cpp        | 16 +++++++++++-----
 modules/demux/mkv/matroska_segment_seeker.cpp |  6 ++----
 modules/demux/mkv/matroska_segment_seeker.hpp |  2 +-
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index a7431816b2..bffcf0063e 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -216,7 +216,8 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
                         level = SegmentSeeker::Seekpoint::QUESTIONABLE; // TODO: var_InheritBool( ..., "mkv-trust-cues" );
                     }
 
-                    _seeker.add_seekpoint( track_id, level, cue_position, cue_mk_time );
+                    _seeker.add_seekpoint( track_id,
+                        SegmentSeeker::Seekpoint(level, cue_position, cue_mk_time) );
                 }
                 else
                     msg_Warn( &sys.demuxer, "Found cue with invalid track id = %u", track_id );
@@ -637,8 +638,9 @@ bool matroska_segment_c::Preload( )
             for( tracks_map_t::const_iterator it = tracks.begin();
                  it != tracks.end(); ++it )
             {
-                _seeker.add_seekpoint( it->first, SegmentSeeker::Seekpoint::TRUSTED,
-                  cluster->GetElementPosition(), 0 );
+                _seeker.add_seekpoint( it->first,
+                    SegmentSeeker::Seekpoint( SegmentSeeker::Seekpoint::TRUSTED,
+                                              cluster->GetElementPosition(), 0 ) );
             }
 
             ep->Down();
@@ -1206,7 +1208,9 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
             {
                 bool const b_valid_track = vars.obj->FindTrackByBlock( NULL, &ksblock ) != NULL;
                 if (b_valid_track)
-                    vars.obj->_seeker.add_seekpoint( ksblock.TrackNum(), SegmentSeeker::Seekpoint::TRUSTED, ksblock.GetElementPosition(), ksblock.GlobalTimecode() / 1000 );
+                    vars.obj->_seeker.add_seekpoint( ksblock.TrackNum(),
+                        SegmentSeeker::Seekpoint( SegmentSeeker::Seekpoint::TRUSTED,
+                                                  ksblock.GetElementPosition(), ksblock.GlobalTimecode() / 1000 ) );
             }
         }
     };
@@ -1224,7 +1228,9 @@ int matroska_segment_c::BlockGet( KaxBlock * & pp_block, KaxSimpleBlock * & pp_s
             const mkv_track_t *p_track = vars.obj->FindTrackByBlock( &kblock, NULL );
             if( p_track != NULL && p_track->fmt.i_cat == SPU_ES )
             {
-                vars.obj->_seeker.add_seekpoint( kblock.TrackNum(), SegmentSeeker::Seekpoint::TRUSTED, kblock.GetElementPosition(), kblock.GlobalTimecode() / 1000 );
+                vars.obj->_seeker.add_seekpoint( kblock.TrackNum(),
+                    SegmentSeeker::Seekpoint( SegmentSeeker::Seekpoint::TRUSTED,
+                                              kblock.GetElementPosition(), kblock.GlobalTimecode() / 1000 ) );
             }
 
             vars.obj->ep->Keep ();
diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp b/modules/demux/mkv/matroska_segment_seeker.cpp
index f9ee930d62..186a10bfe5 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -112,10 +112,8 @@ SegmentSeeker::add_cluster( KaxCluster * const p_cluster )
 }
 
 void
-SegmentSeeker::add_seekpoint( track_id_t track_id, Seekpoint::TrustLevel trust_level, fptr_t fpos, mtime_t pts )
+SegmentSeeker::add_seekpoint( track_id_t track_id, Seekpoint sp )
 {
-    Seekpoint sp ( trust_level, fpos, pts );
-
     seekpoints_t&  seekpoints = _tracks_seekpoints[ track_id ];
     seekpoints_t::iterator it = std::lower_bound( seekpoints.begin(), seekpoints.end(), sp );
 
@@ -348,7 +346,7 @@ SegmentSeeker::index_unsearched_range( matroska_segment_c& ms, Range search_area
         if( b_valid_track )
         {
             if( b_key_picture )
-                add_seekpoint( track_id, Seekpoint::TRUSTED, block_pos, block_pts );
+                add_seekpoint( track_id, Seekpoint( Seekpoint::TRUSTED, block_pos, block_pts ) );
 
             if( max_pts < block_pts )
                 break;
diff --git a/modules/demux/mkv/matroska_segment_seeker.hpp b/modules/demux/mkv/matroska_segment_seeker.hpp
index e80a367def..4e23e93886 100644
--- a/modules/demux/mkv/matroska_segment_seeker.hpp
+++ b/modules/demux/mkv/matroska_segment_seeker.hpp
@@ -98,7 +98,7 @@ class SegmentSeeker
 
         typedef std::pair<Seekpoint, Seekpoint> seekpoint_pair_t;
 
-        void add_seekpoint( track_id_t track_id, Seekpoint::TrustLevel level, fptr_t fpos, mtime_t pts );
+        void add_seekpoint( track_id_t, Seekpoint );
 
         seekpoint_pair_t get_seekpoints_around( mtime_t, seekpoints_t const& );
         Seekpoint get_first_seekpoint_around( mtime_t, seekpoints_t const&, Seekpoint::TrustLevel = Seekpoint::TRUSTED );



More information about the vlc-commits mailing list