[vlc-commits] demux:mkv: use an enum for the seekpoint trust level

Steve Lhomme git at videolan.org
Wed Aug 2 17:54:58 CEST 2017


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Wed Aug  2 15:56:05 2017 +0200| [5d3b9bdbe2fefeb305c933fe592ccc82df452175] | committer: Jean-Baptiste Kempf

demux:mkv: use an enum for the seekpoint trust level

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

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

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

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 24fce246bb..664a868037 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -209,7 +209,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
 
                 if( tracks.find( track_id ) != tracks.end() )
                 {
-                    int level = SegmentSeeker::Seekpoint::DISABLED;
+                    SegmentSeeker::Seekpoint::TrustLevel level = SegmentSeeker::Seekpoint::DISABLED;
 
                     if( ! b_invalid_cue )
                     {
diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp b/modules/demux/mkv/matroska_segment_seeker.cpp
index ac833e0d84..b8c28f2579 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -112,7 +112,7 @@ SegmentSeeker::add_cluster( KaxCluster * const p_cluster )
 }
 
 void
-SegmentSeeker::add_seekpoint( track_id_t track_id, int trust_level, fptr_t fpos, mtime_t pts )
+SegmentSeeker::add_seekpoint( track_id_t track_id, Seekpoint::TrustLevel trust_level, fptr_t fpos, mtime_t pts )
 {
     Seekpoint sp ( trust_level, fpos, pts );
 
diff --git a/modules/demux/mkv/matroska_segment_seeker.hpp b/modules/demux/mkv/matroska_segment_seeker.hpp
index f569ffaa13..8633f463ab 100644
--- a/modules/demux/mkv/matroska_segment_seeker.hpp
+++ b/modules/demux/mkv/matroska_segment_seeker.hpp
@@ -55,16 +55,18 @@ class SegmentSeeker
 
         struct Seekpoint
         {
-            static int const      TRUSTED = +3;
-            static int const QUESTIONABLE = +2;
-            static int const     DISABLED = -1;
+            enum TrustLevel {
+                TRUSTED = +3,
+                QUESTIONABLE = +2,
+                DISABLED = -1,
+            };
 
-            Seekpoint( int trust_level, fptr_t fpos, mtime_t pts, mtime_t duration = -1 )
+            Seekpoint( TrustLevel trust_level, fptr_t fpos, mtime_t pts, mtime_t duration = -1 )
                 : fpos( fpos ), pts( pts ), duration( duration ), trust_level( trust_level )
             { }
 
             Seekpoint()
-                : fpos( std::numeric_limits<fptr_t>::max() ), pts( -1 ), duration( -1 ), trust_level( -1 )
+                : fpos( std::numeric_limits<fptr_t>::max() ), pts( -1 ), duration( -1 ), trust_level( DISABLED )
             { }
 
             bool operator<( Seekpoint const& rhs ) const
@@ -75,7 +77,7 @@ class SegmentSeeker
             fptr_t fpos;
             mtime_t pts;
             mtime_t duration;
-            int trust_level;
+            TrustLevel trust_level;
         };
 
         struct Cluster {
@@ -97,7 +99,7 @@ class SegmentSeeker
 
         typedef std::pair<Seekpoint, Seekpoint> seekpoint_pair_t;
 
-        void add_seekpoint( track_id_t track_id, int level, fptr_t fpos, mtime_t pts );
+        void add_seekpoint( track_id_t track_id, Seekpoint::TrustLevel level, fptr_t fpos, mtime_t pts );
 
         seekpoint_pair_t get_seekpoints_around( mtime_t, seekpoints_t const&, int = Seekpoint::DISABLED );
         seekpoint_pair_t get_seekpoints_around( mtime_t, track_ids_t const& );



More information about the vlc-commits mailing list