[vlc-commits] demux:mkv: make all EbmlParser respect the mkv-use-dummy setting

Steve Lhomme git at videolan.org
Thu Jan 25 17:39:39 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jan 25 13:37:38 2018 +0100| [c89c37d27975773b381c03c250cbf127d21bef78] | committer: Jean-Baptiste Kempf

demux:mkv: make all EbmlParser respect the mkv-use-dummy setting

LoadTags() had a hard value for no reason. If the user wants a strict check
then we must respect that choice.

(cherry picked from cbbc8d8dd1cbc7a2c80c84b985058b8b8a6d5d92)

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/mkv/Ebml_parser.cpp            | 15 +++------------
 modules/demux/mkv/Ebml_parser.hpp            |  4 +---
 modules/demux/mkv/matroska_segment.cpp       | 13 ++++++-------
 modules/demux/mkv/matroska_segment_parse.cpp |  3 +--
 4 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp
index 5e56d4381e..4ab667c04f 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -29,15 +29,14 @@
 /*****************************************************************************
  * Ebml Stream parser
  *****************************************************************************/
-EbmlParser::EbmlParser( EbmlStream *es, EbmlElement *el_start, demux_t *p_demux,
-                        bool b_with_dummy ) :
+EbmlParser::EbmlParser( EbmlStream *es, EbmlElement *el_start, demux_t *p_demux ) :
     p_demux( p_demux ),
     m_es( es ),
     mi_level( 1 ),
     m_got( NULL ),
     mi_user_level( 1 ),
     mb_keep( false ),
-    mb_dummy( b_with_dummy )
+    mb_dummy( var_InheritBool( p_demux, "mkv-use-dummy" ) )
 {
     memset( m_el, 0, sizeof( *m_el ) * M_EL_MAXSIZE);
     m_el[0] = el_start;
@@ -64,17 +63,9 @@ EbmlParser::~EbmlParser( void )
 
 void EbmlParser::reconstruct( EbmlStream* es, EbmlElement* el_start, demux_t* p_demux )
 {
-    this->reconstruct( es, el_start, p_demux, var_InheritBool( p_demux, "mkv-use-dummy" ) );
-}
-
-void EbmlParser::reconstruct( EbmlStream* es, EbmlElement* el_start, demux_t* p_demux,
-  bool b_with_dummy)
-{
     this->~EbmlParser();
 
-    new( static_cast<void*>( this ) ) EbmlParser(
-      es, el_start, p_demux, b_with_dummy
-    );
+    new( static_cast<void*>( this ) ) EbmlParser( es, el_start, p_demux );
 }
 
 void EbmlParser::Up( void )
diff --git a/modules/demux/mkv/Ebml_parser.hpp b/modules/demux/mkv/Ebml_parser.hpp
index 20e0d4e80b..1d5dd8c072 100644
--- a/modules/demux/mkv/Ebml_parser.hpp
+++ b/modules/demux/mkv/Ebml_parser.hpp
@@ -33,12 +33,10 @@
 class EbmlParser
 {
   public:
-    EbmlParser( EbmlStream *es, EbmlElement *el_start, demux_t *p_demux,
-                bool b_with_dummy );
+    EbmlParser( EbmlStream *es, EbmlElement *el_start, demux_t *p_demux );
     ~EbmlParser( void );
 
     void reconstruct( EbmlStream*, EbmlElement*, demux_t*);
-    void reconstruct( EbmlStream*, EbmlElement*, demux_t*, bool b_with_dummy );
 
     void Up( void );
     void Down( void );
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 7fca0fc60c..53c72b77f2 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -58,7 +58,7 @@ matroska_segment_c::matroska_segment_c( demux_sys_t & demuxer, EbmlStream & estr
     ,psz_date_utc(NULL)
     ,i_default_edition(0)
     ,sys(demuxer)
-    ,ep( EbmlParser(&estream, p_seg, &demuxer.demuxer, var_InheritBool( &demuxer.demuxer, "mkv-use-dummy" ) ))
+    ,ep( EbmlParser(&estream, p_seg, &demuxer.demuxer ))
     ,b_preloaded(false)
     ,b_ref_external_segments(false)
 {
@@ -100,7 +100,7 @@ void matroska_segment_c::LoadCues( KaxCues *cues )
         return;
     }
 
-    EbmlParser eparser (&es, cues, &sys.demuxer, var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+    EbmlParser eparser (&es, cues, &sys.demuxer );
     while( ( el = eparser.Get() ) != NULL )
     {
         if( MKV_IS_ID( el, KaxCuePoint ) )
@@ -266,7 +266,7 @@ static const struct {
 
 bool matroska_segment_c::ParseSimpleTags( SimpleTag* pout_simple, KaxTagSimple *tag, int target_type )
 {
-    EbmlParser eparser ( &es, tag, &sys.demuxer, var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+    EbmlParser eparser ( &es, tag, &sys.demuxer );
     EbmlElement *el;
     size_t max_size = tag->GetSize();
     size_t size = 0;
@@ -348,7 +348,7 @@ done:
 void matroska_segment_c::LoadTags( KaxTags *tags )
 {
     /* Master elements */
-    EbmlParser eparser = EbmlParser( &es, tags, &sys.demuxer, true );
+    EbmlParser eparser = EbmlParser( &es, tags, &sys.demuxer );
     EbmlElement *el;
 
     while( ( el = eparser.Get() ) != NULL )
@@ -504,7 +504,7 @@ bool matroska_segment_c::PreloadClusters(uint64 i_cluster_pos)
 
         while (payload.stop_parsing == false)
         {
-            EbmlParser parser ( &es, segment, &sys.demuxer, var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+            EbmlParser parser ( &es, segment, &sys.demuxer );
             EbmlElement* el = parser.Get();
 
             if( el == NULL )
@@ -1029,8 +1029,7 @@ void matroska_segment_c::EnsureDuration()
 
     es.I_O().setFilePointer( i_last_cluster_pos, seek_beginning );
 
-    EbmlParser eparser ( &es, segment, &sys.demuxer, var_InheritBool(
-          &sys.demuxer, "mkv-use-dummy" ) );
+    EbmlParser eparser ( &es, segment, &sys.demuxer );
 
     // locate the definitely last cluster in the stream
 
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index f1bc27810a..cfd39dea03 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -94,8 +94,7 @@ void matroska_segment_c::ParseSeekHead( KaxSeekHead *seekhead )
     if( !b_seekable )
         return;
 
-    EbmlParser eparser ( &es, seekhead, &sys.demuxer,
-                        var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+    EbmlParser eparser ( &es, seekhead, &sys.demuxer );
 
     while( ( l = eparser.Get() ) != NULL )
     {



More information about the vlc-commits mailing list