[vlc-devel] Matroska dummy
Steve Lhomme
robux4 at gmail.com
Wed Feb 18 15:44:24 CET 2015
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.
---
modules/demux/mkv/Ebml_parser.cpp | 25 ++++++++++++++++++++++++-
modules/demux/mkv/Ebml_parser.hpp | 1 +
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/modules/demux/mkv/Ebml_parser.cpp
b/modules/demux/mkv/Ebml_parser.cpp
index 21e219e..6041eaf 100644
--- a/modules/demux/mkv/Ebml_parser.cpp
+++ b/modules/demux/mkv/Ebml_parser.cpp
@@ -146,6 +146,28 @@ void EbmlParser::Reset( demux_t *p_demux )
mb_dummy = var_InheritBool( p_demux, "mkv-use-dummy" );
}
+
+// Define a special Segment context that doesn't allow void/crc32 elements
+static const EbmlSemanticContext & GetEbmlNoGlobal_Context();
+static const EbmlSemanticContext Context_EbmlNoGlobal =
EbmlSemanticContext(0, NULL, NULL, *GetEbmlNoGlobal_Context, NULL);
+static const EbmlSemantic EbmlNoGlobal_ContextList[0] =
+{
+ //EbmlSemantic(false, false, EBML_INFO(EbmlCrc32)), ///< EbmlCrc32
+ //EbmlSemantic(false, false, EBML_INFO(EbmlVoid)), ///< EbmlVoid
+};
+static const EbmlSemanticContext EbmlNoGlobal_Context =
EbmlSemanticContext(countof(EbmlNoGlobal_ContextList),
EbmlNoGlobal_ContextList, NULL, *GetEbmlNoGlobal_Context, NULL);
+static const EbmlSemanticContext & GetEbmlNoGlobal_Context()
+{
+ return EbmlNoGlobal_Context;
+}
+
+// the Segment Context should not allow Void or CRC32 elements to avoid
lookup false alarm
+const EbmlSemanticContext Context_KaxSegmentVLC =
EbmlSemanticContext(KaxSegment_Context.GetSize(),
+
KaxSegment_Context.MyTable,
+
KaxSegment_Context.Parent(),
+
GetEbmlNoGlobal_Context,
+
KaxSegment_Context.GetMaster());
+
EbmlElement *EbmlParser::Get( int n_call )
{
int i_ulev = 0;
@@ -171,7 +193,8 @@ EbmlElement *EbmlParser::Get( int n_call )
}
/* Ignore unknown level 0 or 1 elements */
- m_el[mi_level] = m_es->FindNextElement( EBML_CONTEXT(m_el[mi_level -
1]),
+ EbmlSemanticContext e_context = mi_level == 1 ? Context_KaxSegmentVLC
: EBML_CONTEXT(m_el[mi_level - 1]);
+ m_el[mi_level] = m_es->FindNextElement( e_context,
i_ulev, UINT64_MAX,
( mb_dummy | (mi_level > 1)
), 1 );
if( i_ulev > 0 )
diff --git a/modules/demux/mkv/Ebml_parser.hpp
b/modules/demux/mkv/Ebml_parser.hpp
index 57fdf23..96f9f4b 100644
--- a/modules/demux/mkv/Ebml_parser.hpp
+++ b/modules/demux/mkv/Ebml_parser.hpp
@@ -60,6 +60,7 @@ class EbmlParser
int mi_user_level;
bool mb_keep;
+ /* Allow dummy/unknown EBML elements */
bool mb_dummy;
};
--
1.9.5.msysgit.0
On Wed, Feb 18, 2015 at 11:16 AM, Denis Charmet <typx at dinauz.org> wrote:
> Hi,
>
> Le mercredi 18 février 2015 à 09:19:53, Steve Lhomme a écrit :
> > I'm looking at this issue https://trac.videolan.org/vlc/ticket/9623
> >
> > This is a live stream from GStreamer that doesn't play in normal
> condition.
> > For playback to work you need to enable "--mkv-use-dummy" which allows
> > unknown elements in Matroska.
> >
> > The problem is that a normal Matroska implementation *should* handle
> > unknown elements by default and skip them. Some vendors or users might
> add
> > their own stuff (like DivX does) and VLC wouldn't play the files.
> > libmatroska is not supposed to keep track of all known custom IDs
> floating
> > around and VLC be compiled with the latest for playback to work.
>
> By default it does. In fact I always check for dummy elements to detect
> broken
> files and silently discard them.
>
> Regards,
>
> --
> Denis Charmet - TypX
> Le mauvais esprit est un art de vivre
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150218/0e5e963c/attachment.html>
More information about the vlc-devel
mailing list