[vlc-devel] [PATCH 8/9] mkv: add a helper method to check if 2 Segments are from the same family
Steve Lhomme
robux4 at videolabs.io
Tue Mar 15 15:46:01 CET 2016
---
modules/demux/mkv/matroska_segment.cpp | 23 +++++++++++++++--------
modules/demux/mkv/matroska_segment.hpp | 2 ++
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 4806eb7..9c9e28b 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -480,14 +480,8 @@ bool matroska_segment_c::PreloadFamily( const matroska_segment_c & of_segment )
if ( b_preloaded )
return false;
- for (size_t i=0; i<families.size(); i++)
- {
- for (size_t j=0; j<of_segment.families.size(); j++)
- {
- if ( *(families[i]) == *(of_segment.families[j]) )
- return Preload( );
- }
- }
+ if ( SameFamily( of_segment ) )
+ return Preload( );
return false;
}
@@ -519,6 +513,19 @@ bool matroska_segment_c::CompareSegmentUIDs( const matroska_segment_c * p_item_a
return false;
}
+bool matroska_segment_c::SameFamily( const matroska_segment_c & of_segment ) const
+{
+ for (size_t i=0; i<families.size(); i++)
+ {
+ for (size_t j=0; j<of_segment.families.size(); j++)
+ {
+ if ( *(families[i]) == *(of_segment.families[j]) )
+ return true;
+ }
+ }
+ return false;
+}
+
bool matroska_segment_c::Preload( )
{
if ( b_preloaded )
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index a1b8b92..b19ba03 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -153,6 +153,8 @@ public:
static bool CompareSegmentUIDs( const matroska_segment_c * item_a, const matroska_segment_c * item_b );
+ bool SameFamily( const matroska_segment_c & of_segment ) const;
+
private:
void LoadCues( KaxCues *cues );
void LoadTags( KaxTags *tags );
--
2.7.2.windows.1
More information about the vlc-devel
mailing list