[vlc-commits] [Git][videolan/vlc][master] demux: mkv: simplify the KaxClusterTimestamp lookup

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 7 08:51:33 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
730dff2c by Steve Lhomme at 2026-05-07T08:23:36+00:00
demux: mkv: simplify the KaxClusterTimestamp lookup

There's a fancy template for that.

- - - - -


1 changed file:

- modules/demux/mkv/matroska_segment_parse.cpp


Changes:

=====================================
modules/demux/mkv/matroska_segment_parse.cpp
=====================================
@@ -1653,25 +1653,16 @@ bool matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_
     if ( !ReadMaster( *cluster, read_fully ) )
         return false;
 
-    bool b_has_timecode = false;
-
-    for (auto c : *cluster)
-    {
-        if( MKV_CHECKED_PTR_DECL_CONST( p_ctc, KaxClusterTimestamp, c ) )
-        {
-            cluster->InitTimestamp( static_cast<uint64_t>( *p_ctc ), i_timescale );
-            _seeker.add_cluster( cluster );
-            b_has_timecode = true;
-            break;
-        }
-    }
-
-    if( !b_has_timecode )
+    auto *p_ctc = FindChild<KaxClusterTimestamp>(*cluster);
+    if( p_ctc == nullptr )
     {
         msg_Err( &sys.demuxer, "Detected cluster without mandatory timecode" );
         return false;
     }
 
+    cluster->InitTimestamp( static_cast<uint64_t>( *p_ctc ), i_timescale );
+    _seeker.add_cluster( cluster );
+
     if( b_update_start_time )
         i_mk_start_time = VLC_TICK_FROM_NS( cluster->GlobalTimestamp() );
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/730dff2c7db814f50c715e5a8615b2360ea98c79

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/730dff2c7db814f50c715e5a8615b2360ea98c79
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list