[vlc-commits] mkv: add a helper method to check if 2 Segments are from the same family
Steve Lhomme
git at videolan.org
Wed Mar 16 07:04:42 CET 2016
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Mar 15 15:46:01 2016 +0100| [e3aa28785b9ca367b3f225990210129a9b7510e4] | committer: Jean-Baptiste Kempf
mkv: add a helper method to check if 2 Segments are from the same family
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e3aa28785b9ca367b3f225990210129a9b7510e4
---
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 );
More information about the vlc-commits
mailing list