<div dir="ltr">Slightly better version with the right macros to access the semantic context master.<br><br>---<br> modules/demux/mkv/Ebml_parser.cpp | 29 ++++++++++++++++++++++++++++-<br> modules/demux/mkv/Ebml_parser.hpp | 1 +<br> 2 files changed, 29 insertions(+), 1 deletion(-)<br><br>diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp<br>index 21e219e..a42b936 100644<br>--- a/modules/demux/mkv/Ebml_parser.cpp<br>+++ b/modules/demux/mkv/Ebml_parser.cpp<br>@@ -146,6 +146,28 @@ void EbmlParser::Reset( demux_t *p_demux )<br> mb_dummy = var_InheritBool( p_demux, "mkv-use-dummy" );<br> }<br> <br>+<br>+// Define a special Segment context that doesn't allow void/crc32 elements<br>+static const EbmlSemanticContext & GetEbmlNoGlobal_Context();<br>+static const EbmlSemanticContext Context_EbmlNoGlobal = EbmlSemanticContext(0, NULL, NULL, *GetEbmlNoGlobal_Context, NULL);<br>+static const EbmlSemantic EbmlNoGlobal_ContextList[0] =<br>+{<br>+ //EbmlSemantic(false, false, EBML_INFO(EbmlCrc32)), ///< EbmlCrc32<br>+ //EbmlSemantic(false, false, EBML_INFO(EbmlVoid)), ///< EbmlVoid<br>+};<br>+static const EbmlSemanticContext EbmlNoGlobal_Context = EbmlSemanticContext(countof(EbmlNoGlobal_ContextList), EbmlNoGlobal_ContextList, NULL, *GetEbmlNoGlobal_Context, NULL);<br>+static const EbmlSemanticContext & GetEbmlNoGlobal_Context()<br>+{<br>+ return EbmlNoGlobal_Context;<br>+}<br>+<br>+// the Segment Context should not allow Void or CRC32 elements to avoid lookup false alarm<br>+const EbmlSemanticContext Context_KaxSegmentVLC = EbmlSemanticContext(KaxSegment_Context.GetSize(),<br>+ KaxSegment_Context.MyTable,<br>+ KaxSegment_Context.Parent(),<br>+ GetEbmlNoGlobal_Context,<br>+ KaxSegment_Context.GetMaster());<br>+<br> EbmlElement *EbmlParser::Get( int n_call )<br> {<br> int i_ulev = 0;<br>@@ -170,8 +192,13 @@ EbmlElement *EbmlParser::Get( int n_call )<br> <br> }<br> <br>+ // ignore global Void/CRC32 elements when looking for level 1 elements in the Segment<br>+ EbmlSemanticContext e_context =<br>+ EBML_CTX_MASTER( EBML_CONTEXT(m_el[mi_level - 1]) ) == EBML_CTX_MASTER( Context_KaxSegmentVLC )<br>+ ? Context_KaxSegmentVLC<br>+ : EBML_CONTEXT(m_el[mi_level - 1]);<br> /* Ignore unknown level 0 or 1 elements */<br>- m_el[mi_level] = m_es->FindNextElement( EBML_CONTEXT(m_el[mi_level - 1]),<br>+ m_el[mi_level] = m_es->FindNextElement( e_context,<br> i_ulev, UINT64_MAX,<br> ( mb_dummy | (mi_level > 1) ), 1 );<br> if( i_ulev > 0 )<br>diff --git a/modules/demux/mkv/Ebml_parser.hpp b/modules/demux/mkv/Ebml_parser.hpp<br>index 57fdf23..96f9f4b 100644<br>--- a/modules/demux/mkv/Ebml_parser.hpp<br>+++ b/modules/demux/mkv/Ebml_parser.hpp<br>@@ -60,6 +60,7 @@ class EbmlParser<br> <br> int mi_user_level;<br> bool mb_keep;<br>+ /* Allow dummy/unknown EBML elements */<br> bool mb_dummy;<br> };<br> <br>-- <br>1.9.5.msysgit.0<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 5:57 PM, Steve Lhomme <span dir="ltr"><<a href="mailto:robux4@gmail.com" target="_blank">robux4@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Fixes <a href="https://trac.videolan.org/vlc/ticket/9623" target="_blank">https://trac.videolan.org/vlc/ticket/9623</a> without requiring `--mkv-use-dummy` and only when Parsing at the Segment level.<br><br>---<br> modules/demux/mkv/Ebml_parser.cpp | 27 ++++++++++++++++++++++++++-<br> modules/demux/mkv/Ebml_parser.hpp | 1 +<br> 2 files changed, 27 insertions(+), 1 deletion(-)<br><br>diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp<br>index 21e219e..119d5c9 100644<br>--- a/modules/demux/mkv/Ebml_parser.cpp<br>+++ b/modules/demux/mkv/Ebml_parser.cpp<br>@@ -146,6 +146,28 @@ void EbmlParser::Reset( demux_t *p_demux )<br> mb_dummy = var_InheritBool( p_demux, "mkv-use-dummy" );<br> }<br> <br>+<br>+// Define a special Segment context that doesn't allow void/crc32 elements<br>+static const EbmlSemanticContext & GetEbmlNoGlobal_Context();<br>+static const EbmlSemanticContext Context_EbmlNoGlobal = EbmlSemanticContext(0, NULL, NULL, *GetEbmlNoGlobal_Context, NULL);<br>+static const EbmlSemantic EbmlNoGlobal_ContextList[0] =<br>+{<br>+ //EbmlSemantic(false, false, EBML_INFO(EbmlCrc32)), ///< EbmlCrc32<br>+ //EbmlSemantic(false, false, EBML_INFO(EbmlVoid)), ///< EbmlVoid<br>+};<br>+static const EbmlSemanticContext EbmlNoGlobal_Context = EbmlSemanticContext(countof(EbmlNoGlobal_ContextList), EbmlNoGlobal_ContextList, NULL, *GetEbmlNoGlobal_Context, NULL);<br>+static const EbmlSemanticContext & GetEbmlNoGlobal_Context()<br>+{<br>+ return EbmlNoGlobal_Context;<br>+}<br>+<br>+// the Segment Context should not allow Void or CRC32 elements to avoid lookup false alarm<br>+const EbmlSemanticContext Context_KaxSegmentVLC = EbmlSemanticContext(KaxSegment_Context.GetSize(),<br>+ KaxSegment_Context.MyTable,<br>+ KaxSegment_Context.Parent(),<br>+ GetEbmlNoGlobal_Context,<br>+ KaxSegment_Context.GetMaster());<br>+<br> EbmlElement *EbmlParser::Get( int n_call )<br> {<br> int i_ulev = 0;<br>@@ -171,7 +193,10 @@ EbmlElement *EbmlParser::Get( int n_call )<br> }<br> <br> /* Ignore unknown level 0 or 1 elements */<br>- m_el[mi_level] = m_es->FindNextElement( EBML_CONTEXT(m_el[mi_level - 1]),<br>+ EbmlSemanticContext e_context = ( EBML_CONTEXT(m_el[mi_level - 1]).GetMaster() == Context_KaxSegmentVLC.GetMaster() )<br>+ ? Context_KaxSegmentVLC<br>+ : EBML_CONTEXT(m_el[mi_level - 1]);<br>+ m_el[mi_level] = m_es->FindNextElement( e_context,<br> i_ulev, UINT64_MAX,<br> ( mb_dummy | (mi_level > 1) ), 1 );<br> if( i_ulev > 0 )<br>diff --git a/modules/demux/mkv/Ebml_parser.hpp b/modules/demux/mkv/Ebml_parser.hpp<br>index 57fdf23..96f9f4b 100644<br>--- a/modules/demux/mkv/Ebml_parser.hpp<br>+++ b/modules/demux/mkv/Ebml_parser.hpp<br>@@ -60,6 +60,7 @@ class EbmlParser<br> <br> int mi_user_level;<br> bool mb_keep;<br>+ /* Allow dummy/unknown EBML elements */<br> bool mb_dummy;<br> };<span class="HOEnZb"><font color="#888888"><br> <br>-- <br>1.9.5.msysgit.0<br><br><br></font></span></div>
</blockquote></div><br></div>