[vlc-devel] [PATCH 04/14] mkv: replaced loop with (already present) helper

Filip Roséen filip at videolabs.io
Wed Mar 9 12:49:59 CET 2016


BlockFindTrackIndex does what the explicit loop is doing; we should use
it.
---
 modules/demux/mkv/matroska_segment.cpp | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 2694514..04fe24c 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -982,19 +982,12 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
                 return;
             }
 
-            /* check if block's track is in our list */
-            for( i_track = 0; i_track < tracks.size(); i_track++ )
-            {
-                if( (simpleblock && tracks[i_track]->i_number == simpleblock->TrackNum()) ||
-                    (block && tracks[i_track]->i_number == block->TrackNum()) )
-                    break;
-            }
-
             if( simpleblock )
                 i_mk_pts = sys.i_mk_chapter_time + simpleblock->GlobalTimecode() / INT64_C(1000);
             else
                 i_mk_pts = sys.i_mk_chapter_time + block->GlobalTimecode() / INT64_C(1000);
-            if( i_track < tracks.size() )
+
+            if( BlockFindTrackIndex( &i_track, block, simpleblock ) == VLC_SUCCESS )
             {
                 if( tracks[i_track]->fmt.i_cat == i_cat && b_key_picture )
                 {
-- 
2.7.2



More information about the vlc-devel mailing list