<div dir="ltr"><div>I just realised that the EbmlParser class is also used to parse other things than the Segment and its children (seek head for example). So this code is incorrect.<br><br></div>I'll send a better patch.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 3:44 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">Mh, my emails don't seem to go through with the videolabs alias... So here is the patch I made to fix the original issue, by not allowing anything but level-1 elements when we look for them. They are specially designed to avoid false alarm like in this case.<br><br><br>---<br> modules/demux/mkv/Ebml_parser.cpp | 25 ++++++++++++++++++++++++-<br> modules/demux/mkv/Ebml_parser.hpp | 1 +<br> 2 files changed, 25 insertions(+), 1 deletion(-)<br><br>diff --git a/modules/demux/mkv/Ebml_parser.cpp b/modules/demux/mkv/Ebml_parser.cpp<br>index 21e219e..6041eaf 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,8 @@ 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 = mi_level == 1 ? Context_KaxSegmentVLC : 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><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 18, 2015 at 11:16 AM, Denis Charmet <span dir="ltr"><<a href="mailto:typx@dinauz.org" target="_blank">typx@dinauz.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Le mercredi 18 février 2015 à 09:19:53, Steve Lhomme a écrit :<br>
<span>> I'm looking at this issue <a href="https://trac.videolan.org/vlc/ticket/9623" target="_blank">https://trac.videolan.org/vlc/ticket/9623</a><br>
><br>
> This is a live stream from GStreamer that doesn't play in normal condition.<br>
> For playback to work you need to enable "--mkv-use-dummy" which allows<br>
> unknown elements in Matroska.<br>
><br>
> The problem is that a normal Matroska implementation *should* handle<br>
> unknown elements by default and skip them. Some vendors or users might add<br>
> their own stuff (like DivX does) and VLC wouldn't play the files.<br>
> libmatroska is not supposed to keep track of all known custom IDs floating<br>
> around and VLC be compiled with the latest for playback to work.<br>
<br>
</span>By default it does. In fact I always check for dummy elements to detect broken<br>
files and silently discard them.<br>
<br>
Regards,<br>
<span><font color="#888888"><br>
--<br>
Denis Charmet - TypX<br>
Le mauvais esprit est un art de vivre<br>
</font></span><div><div>_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>