[vlc-commits] mkv: fix matroska_segment_c::ParseCluster to use new functionality

Filip Roséen git at videolan.org
Mon May 9 15:09:29 CEST 2016


vlc | branch: master | Filip Roséen <filip at videolabs.io> | Mon May  9 14:53:12 2016 +0200| [d7f5f4b2c7d2bb9b83a140d506ae4683396d6f32] | committer: Jean-Baptiste Kempf

mkv: fix matroska_segment_c::ParseCluster to use new functionality

Make use of _seeker in matroska_segment_c::ParseCluster, as well as
making the code a little bit more readable by using more descriptive
variable names.

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

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

 modules/demux/mkv/matroska_segment_parse.cpp |   27 +++++++++++---------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 8550c14..5727633 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -1193,20 +1193,18 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters )
 
 void matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_time, ScopeMode read_fully )
 {
-    EbmlElement *el;
-    EbmlMaster  *m;
-    int i_upper_level = 0;
-
-    /* Master elements */
-    m = static_cast<EbmlMaster *>( cluster );
-    if( unlikely( m->IsFiniteSize() && m->GetSize() >= SIZE_MAX ) )
+    if( unlikely( cluster->IsFiniteSize() && cluster->GetSize() >= SIZE_MAX ) )
     {
         msg_Err( &sys.demuxer, "Cluster too big, aborting" );
         return;
     }
+
     try
     {
-        m->Read( es, EBML_CONTEXT(cluster), i_upper_level, el, true, read_fully );
+        EbmlElement *el;
+        int i_upper_level = 0;
+
+        cluster->Read( es, EBML_CONTEXT(cluster), i_upper_level, el, true, read_fully );
     }
     catch(...)
     {
@@ -1214,21 +1212,18 @@ void matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_
         return;
     }
 
-    for( unsigned int i = 0; i < m->ListSize(); i++ )
+    for( unsigned int i = 0; i < cluster->ListSize(); ++i )
     {
-        EbmlElement *l = (*m)[i];
-
-        if( MKV_IS_ID( l, KaxClusterTimecode ) )
+        if( MKV_CHECKED_PTR_DECL( p_ctc, KaxClusterTimecode, (*cluster)[i] ) )
         {
-            KaxClusterTimecode &ctc = *static_cast<KaxClusterTimecode*>( l );
-
-            cluster->InitTimecode( static_cast<uint64>( ctc ), i_timescale );
+            cluster->InitTimecode( static_cast<uint64>( *p_ctc ), i_timescale );
+            _seeker.add_cluster( cluster );
             break;
         }
     }
 
     if( b_update_start_time )
-        i_mk_start_time = cluster->GlobalTimecode() / 1000;
+        i_mk_start_time = cluster->GlobalTimecode() / INT64_C( 1000 );
 }
 
 



More information about the vlc-commits mailing list