Commit d61a9519 authored by Steve Lhomme's avatar Steve Lhomme

libebml2: add EBML_ElementGetName() and EBML_ElementGetClassName() helper functions

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@595 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent 39fe4e72
......@@ -26,8 +26,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __LIBEBML2_H
#define __LIBEBML2_H
#ifndef LIBEBML2_H
#define LIBEBML2_H
#include "node/node.h"
#include "file/file.h"
......@@ -213,6 +213,10 @@ EBML_DLL int EBML_CodedValueLength(filepos_t Length, size_t CodedSize, uint8_t *
EBML_DLL int EBML_CodedValueLengthSigned(filepos_t Length, size_t CodedSize, uint8_t * OutBuffer); // TODO: turn into a macro ?
EBML_DLL filepos_t EBML_ReadCodedSizeValue(const uint8_t *InBuffer, size_t *BufferSize, filepos_t *SizeUnknown);
EBML_DLL filepos_t EBML_ReadCodedSizeSignedValue(const uint8_t *InBuffer, size_t *BufferSize, filepos_t *SizeUnknown);
EBML_DLL void EBML_ElementGetName(const ebml_element *Element, tchar_t *Out, size_t OutLen);
EBML_DLL const char *EBML_ElementGetClassName(const ebml_element *Element);
EBML_DLL filepos_t EBML_ElementFullSize(const ebml_element *Element, bool_t bWithDefault);
EBML_DLL ebml_element *EBML_ElementSkipData(ebml_element *Element, stream *Input, const ebml_parser_context *Context, ebml_element *TestReadElt, bool_t AllowDummy);
......@@ -322,4 +326,4 @@ extern const ebml_semantic EBML_SemanticGlobals[];
}
#endif
#endif /* __LIBEBML2_H */
#endif /* LIBEBML2_H */
......@@ -273,3 +273,13 @@ err_t EBML_ElementRenderHead(ebml_element *Element, stream *Output, bool_t bKeep
return Err;
}
#endif
void EBML_ElementGetName(const ebml_element *Element, tchar_t *Out, size_t OutLen)
{
Node_FromStr(Element,Out,OutLen,Element->Context->ElementName);
}
const char *EBML_ElementGetClassName(const ebml_element *Element)
{
return Element->Context->ElementName;
}
\ No newline at end of file
......@@ -110,7 +110,7 @@ static ebml_element *OutputElement(ebml_element *Element, const ebml_parser_cont
int LevelPrint;
for (LevelPrint=0;LevelPrint<*Level;++LevelPrint)
fprintf(stdout,"+ ");
fprintf(stdout,"%s: ",Element->Context->ElementName);
fprintf(stdout,"%s: ", EBML_ElementGetClassName(Element));
if (Node_IsPartOf(Element,EBML_MASTER_CLASS))
{
int UpperElement = 0;
......
......@@ -176,7 +176,7 @@ static filepos_t CheckUnknownElements(ebml_element *Elt)
{
if (Node_IsPartOf(SubElt,EBML_DUMMY_ID))
{
Node_FromStr(Elt,String,TSIZEOF(String),Elt->Context->ElementName);
EBML_ElementGetName(Elt,String,TSIZEOF(String));
EBML_IdToString(IdStr,TSIZEOF(IdStr),SubElt->Context->Id);
OutputError(12,T("Unknown element in %s %s at %") TPRId64 T(" (size %") TPRId64 T(")"),String,IdStr,SubElt->ElementPosition,SubElt->DataSize);
}
......@@ -430,9 +430,9 @@ static int CheckMandatory(ebml_element *Elt, int ProfileMask)
tchar_t String[MAXPATH],Missing[MAXPATH];
ebml_element *SubElt;
Node_FromStr(Elt,String,TSIZEOF(String),Elt->Context->ElementName);
if (Node_IsPartOf(Elt,EBML_MASTER_CLASS))
{
EBML_ElementGetName(Elt,String,TSIZEOF(String));
const ebml_semantic *i;
for (i=Elt->Context->Semantic;i->eClass;++i)
{
......
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