Commit 22d88be5 authored by Steve Lhomme's avatar Steve Lhomme

libebml2: add a EBML_ElementIsType() function to test an element with an EBML class

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@605 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent 5d0cc4e3
......@@ -232,6 +232,8 @@ EBML_DLL filepos_t EBML_ElementPositionEnd(const ebml_element *Element);
EBML_DLL filepos_t EBML_ElementDataSize(const ebml_element *Element, bool_t bWithDefault);
EBML_DLL bool_t EBML_ElementIsType(const ebml_element *Element, const ebml_context *Context);
#if defined(CONFIG_EBML_WRITING)
// TODO: replace the list of bools by flags ?
EBML_DLL err_t EBML_ElementRender(ebml_element *Element, stream *Output, bool_t bWithDefault, bool_t bKeepPosition, bool_t bForceRender, filepos_t *Rendered);
......
......@@ -137,6 +137,11 @@ filepos_t EBML_ElementDataSize(const ebml_element *Element, bool_t bWithDefault)
return Element->DataSize;
}
bool_t EBML_ElementIsType(const ebml_element *Element, const ebml_context *Context)
{
return Element->Context->Id == Context->Id;
}
fourcc_t EBML_ElementClassID(const ebml_element *Element)
{
return Element->Context->Id;
......
......@@ -285,7 +285,7 @@ static err_t ReadData(ebml_master *Element, stream *Input, const ebml_parser_con
{
if (EBML_ElementReadData(SubElement,ReadStream,&Context,AllowDummyElt, Scope, DepthCheckCRC?DepthCheckCRC-1:0)==ERR_NONE)
{
if (bFirst && DepthCheckCRC && Scope!=SCOPE_NO_DATA && SubElement->Context->Id==EBML_ContextEbmlCrc32.Id && CRCElement==NULL)
if (bFirst && DepthCheckCRC && Scope!=SCOPE_NO_DATA && EBML_ElementIsType(SubElement, &EBML_ContextEbmlCrc32) && CRCElement==NULL)
{
if (EBML_ElementIsFiniteSize((ebml_element*)Element))
{
......
......@@ -3,7 +3,7 @@
GROUP ebml2_group
{
PROJECT_NAME "libebml2"
PROJECT_VERSION 0.12.2
PROJECT_VERSION 0.20.0
PROJECT_VENDOR "Matroska Foundation"
EXPDEFINE HAS_EBML2
......
This diff is collapsed.
This diff is collapsed.
......@@ -56,7 +56,7 @@ static timecode_t ClusterTime = INVALID_TIMECODE_T;
// some macros for code readability
#define EL_Pos(elt) EBML_ElementPosition((const ebml_element*)elt)
#define EL_Int(elt) EBML_IntegerValue((const ebml_integer*)elt)
#define EL_Type(elt, type) (((const ebml_element*)elt)->Context->Id == (type)->Id)
#define EL_Type(elt, type) EBML_ElementIsType((const ebml_element*)elt, type)
#define EL_DataSize(elt) EBML_ElementDataSize((const ebml_element*)elt, 1)
typedef struct track_info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment